Browse Source

make sure our allocated skbuffs always have enough head room

git.mgm/mediaproxy-ng/2.0
Richard Fuchs 14 years ago
parent
commit
1be81628b2
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      kernel-module/xt_MEDIAPROXY.c

+ 12
- 2
kernel-module/xt_MEDIAPROXY.c View File

@ -1245,12 +1245,17 @@ static unsigned int mediaproxy4(struct sk_buff *oskb, const struct xt_action_par
struct sk_buff *skb;
struct iphdr *ih;
struct mediaproxy_table *t;
int headroom;
t = get_table(pinfo->id);
if (!t)
goto skip;
skb = skb_copy(oskb, GFP_ATOMIC);
headroom = MAX_HEADER - sizeof(*ih);
if (skb_headroom(oskb) >= headroom)
skb = skb_copy(oskb, GFP_ATOMIC);
else
skb = skb_copy_expand(oskb, headroom, 0, GFP_ATOMIC);
if (!skb)
goto skip3;
@ -1282,12 +1287,17 @@ static unsigned int mediaproxy6(struct sk_buff *oskb, const struct xt_action_par
struct sk_buff *skb;
struct ipv6hdr *ih;
struct mediaproxy_table *t;
int headroom;
t = get_table(pinfo->id);
if (!t)
goto skip;
skb = skb_copy(oskb, GFP_ATOMIC);
headroom = MAX_HEADER - sizeof(*ih);
if (skb_headroom(oskb) >= headroom)
skb = skb_copy(oskb, GFP_ATOMIC);
else
skb = skb_copy_expand(oskb, headroom, 0, GFP_ATOMIC);
if (!skb)
goto skip3;


Loading…
Cancel
Save