|
@@ -70,15 +70,15 @@ static void mangle_contents(struct sk_buff *skb,
|
|
|
}
|
|
|
|
|
|
/* Unusual, but possible case. */
|
|
|
-static int enlarge_skb(struct sk_buff *skb, unsigned int extra)
|
|
|
+static bool enlarge_skb(struct sk_buff *skb, unsigned int extra)
|
|
|
{
|
|
|
if (skb->len + extra > 65535)
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
if (pskb_expand_head(skb, 0, extra - skb_tailroom(skb), GFP_ATOMIC))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/* Generic function for mangling variable-length address changes inside
|
|
@@ -89,26 +89,26 @@ static int enlarge_skb(struct sk_buff *skb, unsigned int extra)
|
|
|
* skb enlargement, ...
|
|
|
*
|
|
|
* */
|
|
|
-int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
|
|
|
- struct nf_conn *ct,
|
|
|
- enum ip_conntrack_info ctinfo,
|
|
|
- unsigned int protoff,
|
|
|
- unsigned int match_offset,
|
|
|
- unsigned int match_len,
|
|
|
- const char *rep_buffer,
|
|
|
- unsigned int rep_len, bool adjust)
|
|
|
+bool __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
|
|
|
+ struct nf_conn *ct,
|
|
|
+ enum ip_conntrack_info ctinfo,
|
|
|
+ unsigned int protoff,
|
|
|
+ unsigned int match_offset,
|
|
|
+ unsigned int match_len,
|
|
|
+ const char *rep_buffer,
|
|
|
+ unsigned int rep_len, bool adjust)
|
|
|
{
|
|
|
const struct nf_nat_l3proto *l3proto;
|
|
|
struct tcphdr *tcph;
|
|
|
int oldlen, datalen;
|
|
|
|
|
|
if (!skb_make_writable(skb, skb->len))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
if (rep_len > match_len &&
|
|
|
rep_len - match_len > skb_tailroom(skb) &&
|
|
|
!enlarge_skb(skb, rep_len - match_len))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
SKB_LINEAR_ASSERT(skb);
|
|
|
|
|
@@ -128,7 +128,7 @@ int __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
|
|
|
nf_ct_seqadj_set(ct, ctinfo, tcph->seq,
|
|
|
(int)rep_len - (int)match_len);
|
|
|
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
EXPORT_SYMBOL(__nf_nat_mangle_tcp_packet);
|
|
|
|
|
@@ -142,7 +142,7 @@ EXPORT_SYMBOL(__nf_nat_mangle_tcp_packet);
|
|
|
* XXX - This function could be merged with nf_nat_mangle_tcp_packet which
|
|
|
* should be fairly easy to do.
|
|
|
*/
|
|
|
-int
|
|
|
+bool
|
|
|
nf_nat_mangle_udp_packet(struct sk_buff *skb,
|
|
|
struct nf_conn *ct,
|
|
|
enum ip_conntrack_info ctinfo,
|
|
@@ -157,12 +157,12 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
|
|
|
int datalen, oldlen;
|
|
|
|
|
|
if (!skb_make_writable(skb, skb->len))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
if (rep_len > match_len &&
|
|
|
rep_len - match_len > skb_tailroom(skb) &&
|
|
|
!enlarge_skb(skb, rep_len - match_len))
|
|
|
- return 0;
|
|
|
+ return false;
|
|
|
|
|
|
udph = (void *)skb->data + protoff;
|
|
|
|
|
@@ -176,13 +176,13 @@ nf_nat_mangle_udp_packet(struct sk_buff *skb,
|
|
|
|
|
|
/* fix udp checksum if udp checksum was previously calculated */
|
|
|
if (!udph->check && skb->ip_summed != CHECKSUM_PARTIAL)
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
|
|
|
l3proto = __nf_nat_l3proto_find(nf_ct_l3num(ct));
|
|
|
l3proto->csum_recalc(skb, IPPROTO_UDP, udph, &udph->check,
|
|
|
datalen, oldlen);
|
|
|
|
|
|
- return 1;
|
|
|
+ return true;
|
|
|
}
|
|
|
EXPORT_SYMBOL(nf_nat_mangle_udp_packet);
|
|
|
|