diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 15 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_queue.c | 10 | ||||
-rw-r--r-- | net/ipv6/sit.c | 12 |
3 files changed, 12 insertions, 25 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index cd940647bd12..2a124e9a1b2d 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -229,18 +229,11 @@ static struct ip6_tnl *ip6_tnl_create(struct ip6_tnl_parm *p) | |||
229 | char name[IFNAMSIZ]; | 229 | char name[IFNAMSIZ]; |
230 | int err; | 230 | int err; |
231 | 231 | ||
232 | if (p->name[0]) { | 232 | if (p->name[0]) |
233 | strlcpy(name, p->name, IFNAMSIZ); | 233 | strlcpy(name, p->name, IFNAMSIZ); |
234 | } else { | 234 | else |
235 | int i; | 235 | sprintf(name, "ip6tnl%%d"); |
236 | for (i = 1; i < IP6_TNL_MAX; i++) { | 236 | |
237 | sprintf(name, "ip6tnl%d", i); | ||
238 | if (__dev_get_by_name(&init_net, name) == NULL) | ||
239 | break; | ||
240 | } | ||
241 | if (i == IP6_TNL_MAX) | ||
242 | goto failed; | ||
243 | } | ||
244 | dev = alloc_netdev(sizeof (*t), name, ip6_tnl_dev_setup); | 237 | dev = alloc_netdev(sizeof (*t), name, ip6_tnl_dev_setup); |
245 | if (dev == NULL) | 238 | if (dev == NULL) |
246 | goto failed; | 239 | goto failed; |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index e869916b05f1..cc2f9afcf808 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -285,8 +285,8 @@ static int | |||
285 | ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e) | 285 | ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e) |
286 | { | 286 | { |
287 | int diff; | 287 | int diff; |
288 | int err; | ||
289 | struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload; | 288 | struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload; |
289 | struct sk_buff *nskb; | ||
290 | 290 | ||
291 | if (v->data_len < sizeof(*user_iph)) | 291 | if (v->data_len < sizeof(*user_iph)) |
292 | return 0; | 292 | return 0; |
@@ -298,14 +298,16 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e) | |||
298 | if (v->data_len > 0xFFFF) | 298 | if (v->data_len > 0xFFFF) |
299 | return -EINVAL; | 299 | return -EINVAL; |
300 | if (diff > skb_tailroom(e->skb)) { | 300 | if (diff > skb_tailroom(e->skb)) { |
301 | err = pskb_expand_head(e->skb, 0, | 301 | nskb = skb_copy_expand(e->skb, 0, |
302 | diff - skb_tailroom(e->skb), | 302 | diff - skb_tailroom(e->skb), |
303 | GFP_ATOMIC); | 303 | GFP_ATOMIC); |
304 | if (err) { | 304 | if (!nskb) { |
305 | printk(KERN_WARNING "ip6_queue: OOM " | 305 | printk(KERN_WARNING "ip6_queue: OOM " |
306 | "in mangle, dropping packet\n"); | 306 | "in mangle, dropping packet\n"); |
307 | return err; | 307 | return -ENOMEM; |
308 | } | 308 | } |
309 | kfree_skb(e->skb); | ||
310 | e->skb = nskb; | ||
309 | } | 311 | } |
310 | skb_put(e->skb, diff); | 312 | skb_put(e->skb, diff); |
311 | } | 313 | } |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index e77239d02bf5..dde7801abeff 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -164,16 +164,8 @@ static struct ip_tunnel * ipip6_tunnel_locate(struct ip_tunnel_parm *parms, int | |||
164 | 164 | ||
165 | if (parms->name[0]) | 165 | if (parms->name[0]) |
166 | strlcpy(name, parms->name, IFNAMSIZ); | 166 | strlcpy(name, parms->name, IFNAMSIZ); |
167 | else { | 167 | else |
168 | int i; | 168 | sprintf(name, "sit%%d"); |
169 | for (i=1; i<100; i++) { | ||
170 | sprintf(name, "sit%d", i); | ||
171 | if (__dev_get_by_name(&init_net, name) == NULL) | ||
172 | break; | ||
173 | } | ||
174 | if (i==100) | ||
175 | goto failed; | ||
176 | } | ||
177 | 169 | ||
178 | dev = alloc_netdev(sizeof(*t), name, ipip6_tunnel_setup); | 170 | dev = alloc_netdev(sizeof(*t), name, ipip6_tunnel_setup); |
179 | if (dev == NULL) | 171 | if (dev == NULL) |