Commit 515ebf01 authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji

[IPV6]: Use LL_RESERVED_SPACE() where applicable.

parent 7ed96284
...@@ -218,7 +218,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, ...@@ -218,7 +218,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
*/ */
head_room = opt->opt_nflen + opt->opt_flen; head_room = opt->opt_nflen + opt->opt_flen;
seg_len += head_room; seg_len += head_room;
head_room += sizeof(struct ipv6hdr) + ((dst->dev->hard_header_len + 15)&~15); head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev);
if (skb_headroom(skb) < head_room) { if (skb_headroom(skb) < head_room) {
struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room);
...@@ -844,7 +844,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -844,7 +844,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
mtu = inet->cork.fragsize; mtu = inet->cork.fragsize;
} }
hh_len = (rt->u.dst.dev->hard_header_len&~15) + 16; hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
fragheaderlen = sizeof(struct ipv6hdr) + (opt ? opt->opt_nflen : 0); fragheaderlen = sizeof(struct ipv6hdr) + (opt ? opt->opt_nflen : 0);
maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr); maxfraglen = ((mtu - fragheaderlen) & ~7) + fragheaderlen - sizeof(struct frag_hdr);
...@@ -881,14 +881,14 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse ...@@ -881,14 +881,14 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offse
alloclen += sizeof(struct frag_hdr); alloclen += sizeof(struct frag_hdr);
if (transhdrlen) { if (transhdrlen) {
skb = sock_alloc_send_skb(sk, skb = sock_alloc_send_skb(sk,
alloclen + hh_len + 15, alloclen + hh_len,
(flags & MSG_DONTWAIT), &err); (flags & MSG_DONTWAIT), &err);
} else { } else {
skb = NULL; skb = NULL;
if (atomic_read(&sk->sk_wmem_alloc) <= if (atomic_read(&sk->sk_wmem_alloc) <=
2 * sk->sk_sndbuf) 2 * sk->sk_sndbuf)
skb = sock_wmalloc(sk, skb = sock_wmalloc(sk,
alloclen + hh_len + 15, 1, alloclen + hh_len, 1,
sk->sk_allocation); sk->sk_allocation);
if (unlikely(skb == NULL)) if (unlikely(skb == NULL))
err = -ENOBUFS; err = -ENOBUFS;
......
...@@ -1233,12 +1233,13 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size) ...@@ -1233,12 +1233,13 @@ static struct sk_buff *mld_newpack(struct net_device *dev, int size)
IPV6_TLV_ROUTERALERT, 2, 0, 0, IPV6_TLV_ROUTERALERT, 2, 0, 0,
IPV6_TLV_PADN, 0 }; IPV6_TLV_PADN, 0 };
skb = sock_alloc_send_skb(sk, size + dev->hard_header_len+15, 1, &err); /* we assume size > sizeof(ra) here */
skb = sock_alloc_send_skb(sk, size + LL_RESERVED_SPACE(dev), 1, &err);
if (skb == 0) if (skb == 0)
return 0; return 0;
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
if (dev->hard_header) { if (dev->hard_header) {
unsigned char ha[MAX_ADDR_LEN]; unsigned char ha[MAX_ADDR_LEN];
...@@ -1580,12 +1581,12 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) ...@@ -1580,12 +1581,12 @@ static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type)
payload_len = len + sizeof(ra); payload_len = len + sizeof(ra);
full_len = sizeof(struct ipv6hdr) + payload_len; full_len = sizeof(struct ipv6hdr) + payload_len;
skb = sock_alloc_send_skb(sk, dev->hard_header_len + full_len + 15, 1, &err); skb = sock_alloc_send_skb(sk, LL_RESERVED_SPACE(dev) + full_len, 1, &err);
if (skb == NULL) if (skb == NULL)
return; return;
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
if (dev->hard_header) { if (dev->hard_header) {
unsigned char ha[MAX_ADDR_LEN]; unsigned char ha[MAX_ADDR_LEN];
ndisc_mc_map(snd_addr, ha, dev, 1); ndisc_mc_map(snd_addr, ha, dev, 1);
......
...@@ -459,7 +459,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -459,7 +459,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
inc_opt = 0; inc_opt = 0;
} }
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
...@@ -468,7 +468,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -468,7 +468,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, src_addr, daddr, IPPROTO_ICMPV6, len);
msg = (struct nd_msg *)skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
...@@ -545,7 +545,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -545,7 +545,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
if (send_llinfo) if (send_llinfo)
len += NDISC_OPT_SPACE(dev->addr_len); len += NDISC_OPT_SPACE(dev->addr_len);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK1("send_ns: alloc skb failed\n"); ND_PRINTK1("send_ns: alloc skb failed\n");
...@@ -553,7 +553,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -553,7 +553,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
msg = (struct nd_msg *)skb_put(skb, len); msg = (struct nd_msg *)skb_put(skb, len);
...@@ -617,7 +617,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -617,7 +617,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
if (dev->addr_len) if (dev->addr_len)
len += NDISC_OPT_SPACE(dev->addr_len); len += NDISC_OPT_SPACE(dev->addr_len);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK1("send_ns: alloc skb failed\n"); ND_PRINTK1("send_ns: alloc skb failed\n");
...@@ -625,7 +625,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -625,7 +625,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
return; return;
} }
skb_reserve(skb, (dev->hard_header_len + 15) & ~15); skb_reserve(skb, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
hdr = (struct icmp6hdr *)skb_put(skb, len); hdr = (struct icmp6hdr *)skb_put(skb, len);
...@@ -1305,7 +1305,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1305,7 +1305,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
rd_len &= ~0x7; rd_len &= ~0x7;
len += rd_len; len += rd_len;
buff = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15, buff = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev),
1, &err); 1, &err);
if (buff == NULL) { if (buff == NULL) {
ND_PRINTK1("ndisc_send_redirect: alloc_skb failed\n"); ND_PRINTK1("ndisc_send_redirect: alloc_skb failed\n");
...@@ -1315,7 +1315,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1315,7 +1315,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
hlen = 0; hlen = 0;
skb_reserve(buff, (dev->hard_header_len + 15) & ~15); skb_reserve(buff, LL_RESERVED_SPACE(dev));
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr, ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr,
IPPROTO_ICMPV6, len); IPPROTO_ICMPV6, len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment