Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69398
b: refs/heads/master
c: 776c729
h: refs/heads/master
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 15, 2007
1 parent 2e5b2bb commit 320bf25
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1706d58763c36133d7fce6cc78b1444fd40db28c
refs/heads/master: 776c729e8d91b2740583a2169678f2d3f383458b
2 changes: 1 addition & 1 deletion trunk/include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ enum ip_defrag_users
IP_DEFRAG_VS_FWD
};

struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user);
int ip_defrag(struct sk_buff *skb, u32 user);
extern int ip_frag_nqueues;
extern atomic_t ip_frag_mem;

Expand Down
6 changes: 3 additions & 3 deletions trunk/net/ipv4/ip_fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *prev,
}

/* Process an incoming IP datagram fragment. */
struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
int ip_defrag(struct sk_buff *skb, u32 user)
{
struct ipq *qp;

Expand All @@ -759,12 +759,12 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)

spin_unlock(&qp->lock);
ipq_put(qp, NULL);
return ret ? NULL : skb;
return ret;
}

IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS);
kfree_skb(skb);
return NULL;
return -ENOMEM;
}

void __init ipfrag_init(void)
Expand Down
6 changes: 2 additions & 4 deletions trunk/net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
(!sk->sk_bound_dev_if ||
sk->sk_bound_dev_if == skb->dev->ifindex)) {
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
skb = ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN);
if (skb == NULL) {
if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) {
read_unlock(&ip_ra_lock);
return 1;
}
Expand Down Expand Up @@ -265,8 +264,7 @@ int ip_local_deliver(struct sk_buff *skb)
*/

if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
skb = ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER);
if (!skb)
if (ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER))
return 0;
}

Expand Down
26 changes: 10 additions & 16 deletions trunk/net/ipv4/ipvs/ip_vs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,14 @@ __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset)
return csum_fold(skb_checksum(skb, offset, skb->len - offset, 0));
}

static inline struct sk_buff *
ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
static inline int ip_vs_gather_frags(struct sk_buff *skb, u_int32_t user)
{
skb = ip_defrag(skb, user);
if (skb)
int err = ip_defrag(skb, user);

if (!err)
ip_send_check(ip_hdr(skb));
return skb;

return err;
}

/*
Expand Down Expand Up @@ -619,10 +620,8 @@ static int ip_vs_out_icmp(struct sk_buff **pskb, int *related)

/* reassemble IP fragments */
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
if (!skb)
if (ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT))
return NF_STOLEN;
*pskb = skb;
}

iph = ip_hdr(skb);
Expand Down Expand Up @@ -756,11 +755,9 @@ ip_vs_out(unsigned int hooknum, struct sk_buff **pskb,
/* reassemble IP fragments */
if (unlikely(iph->frag_off & htons(IP_MF|IP_OFFSET) &&
!pp->dont_defrag)) {
skb = ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT);
if (!skb)
if (ip_vs_gather_frags(skb, IP_DEFRAG_VS_OUT))
return NF_STOLEN;
iph = ip_hdr(skb);
*pskb = skb;
}

ihl = iph->ihl << 2;
Expand Down Expand Up @@ -861,12 +858,9 @@ ip_vs_in_icmp(struct sk_buff **pskb, int *related, unsigned int hooknum)

/* reassemble IP fragments */
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
skb = ip_vs_gather_frags(skb,
hooknum == NF_IP_LOCAL_IN ?
IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD);
if (!skb)
if (ip_vs_gather_frags(skb, hooknum == NF_IP_LOCAL_IN ?
IP_DEFRAG_VS_IN : IP_DEFRAG_VS_FWD))
return NF_STOLEN;
*pskb = skb;
}

iph = ip_hdr(skb);
Expand Down
20 changes: 10 additions & 10 deletions trunk/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,20 @@ static int ipv4_print_conntrack(struct seq_file *s,
}

/* Returns new sk_buff, or NULL */
static struct sk_buff *
nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
{
int err;

skb_orphan(skb);

local_bh_disable();
skb = ip_defrag(skb, user);
err = ip_defrag(skb, user);
local_bh_enable();

if (skb)
if (!err)
ip_send_check(ip_hdr(skb));

return skb;
return err;
}

static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
Expand Down Expand Up @@ -148,11 +149,10 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,

/* Gather fragments. */
if (ip_hdr(*pskb)->frag_off & htons(IP_MF | IP_OFFSET)) {
*pskb = nf_ct_ipv4_gather_frags(*pskb,
hooknum == NF_IP_PRE_ROUTING ?
IP_DEFRAG_CONNTRACK_IN :
IP_DEFRAG_CONNTRACK_OUT);
if (!*pskb)
if (nf_ct_ipv4_gather_frags(*pskb,
hooknum == NF_IP_PRE_ROUTING ?
IP_DEFRAG_CONNTRACK_IN :
IP_DEFRAG_CONNTRACK_OUT))
return NF_STOLEN;
}
return NF_ACCEPT;
Expand Down

0 comments on commit 320bf25

Please sign in to comment.