aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-25 20:54:47 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:14 -0400
commit0660e03f6b18f19b6bbafe7583265a51b90daf36 (patch)
tree82cc819ead5ab7858ba211ee8719a3e6d2bb984f /net/ipv6/ndisc.c
parentd0a92be05ed4aea7d35c2b257e3f9173565fe4eb (diff)
[SK_BUFF]: Introduce ipv6_hdr(), remove skb->nh.ipv6h
Now the skb->nh union has just one member, .raw, i.e. it is just like the skb->mac union, strange, no? I'm just leaving it like that till the transport layer is done with, when we'll rename skb->mac.raw to skb->mac_header (or ->mac_header_offset?), ditto for ->{h,nh}. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index a3e3d9e2f44b..00feb4c4d98b 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -598,7 +598,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
598 dev->addr_len, dev->type); 598 dev->addr_len, dev->type);
599 599
600 /* checksum */ 600 /* checksum */
601 msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, 601 msg->icmph.icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
602 daddr, len, 602 daddr, len,
603 IPPROTO_ICMPV6, 603 IPPROTO_ICMPV6,
604 csum_partial((__u8 *) msg, 604 csum_partial((__u8 *) msg,
@@ -697,7 +697,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
697 dev->addr_len, dev->type); 697 dev->addr_len, dev->type);
698 698
699 /* checksum */ 699 /* checksum */
700 hdr->icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, daddr, len, 700 hdr->icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr, daddr, len,
701 IPPROTO_ICMPV6, 701 IPPROTO_ICMPV6,
702 csum_partial((__u8 *) hdr, len, 0)); 702 csum_partial((__u8 *) hdr, len, 0));
703 703
@@ -736,8 +736,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
736 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; 736 struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
737 int probes = atomic_read(&neigh->probes); 737 int probes = atomic_read(&neigh->probes);
738 738
739 if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev, 1)) 739 if (skb && ipv6_chk_addr(&ipv6_hdr(skb)->saddr, dev, 1))
740 saddr = &skb->nh.ipv6h->saddr; 740 saddr = &ipv6_hdr(skb)->saddr;
741 741
742 if ((probes -= neigh->parms->ucast_probes) < 0) { 742 if ((probes -= neigh->parms->ucast_probes) < 0) {
743 if (!(neigh->nud_state & NUD_VALID)) { 743 if (!(neigh->nud_state & NUD_VALID)) {
@@ -761,8 +761,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
761static void ndisc_recv_ns(struct sk_buff *skb) 761static void ndisc_recv_ns(struct sk_buff *skb)
762{ 762{
763 struct nd_msg *msg = (struct nd_msg *)skb->h.raw; 763 struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
764 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 764 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
765 struct in6_addr *daddr = &skb->nh.ipv6h->daddr; 765 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
766 u8 *lladdr = NULL; 766 u8 *lladdr = NULL;
767 u32 ndoptlen = skb->tail - msg->opt; 767 u32 ndoptlen = skb->tail - msg->opt;
768 struct ndisc_options ndopts; 768 struct ndisc_options ndopts;
@@ -939,8 +939,8 @@ out:
939static void ndisc_recv_na(struct sk_buff *skb) 939static void ndisc_recv_na(struct sk_buff *skb)
940{ 940{
941 struct nd_msg *msg = (struct nd_msg *)skb->h.raw; 941 struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
942 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 942 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
943 struct in6_addr *daddr = &skb->nh.ipv6h->daddr; 943 struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
944 u8 *lladdr = NULL; 944 u8 *lladdr = NULL;
945 u32 ndoptlen = skb->tail - msg->opt; 945 u32 ndoptlen = skb->tail - msg->opt;
946 struct ndisc_options ndopts; 946 struct ndisc_options ndopts;
@@ -1044,7 +1044,7 @@ static void ndisc_recv_rs(struct sk_buff *skb)
1044 unsigned long ndoptlen = skb->len - sizeof(*rs_msg); 1044 unsigned long ndoptlen = skb->len - sizeof(*rs_msg);
1045 struct neighbour *neigh; 1045 struct neighbour *neigh;
1046 struct inet6_dev *idev; 1046 struct inet6_dev *idev;
1047 struct in6_addr *saddr = &skb->nh.ipv6h->saddr; 1047 struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
1048 struct ndisc_options ndopts; 1048 struct ndisc_options ndopts;
1049 u8 *lladdr = NULL; 1049 u8 *lladdr = NULL;
1050 1050
@@ -1110,7 +1110,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1110 1110
1111 optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg); 1111 optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg);
1112 1112
1113 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) { 1113 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
1114 ND_PRINTK2(KERN_WARNING 1114 ND_PRINTK2(KERN_WARNING
1115 "ICMPv6 RA: source address is not link-local.\n"); 1115 "ICMPv6 RA: source address is not link-local.\n");
1116 return; 1116 return;
@@ -1176,7 +1176,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1176 pref = ICMPV6_ROUTER_PREF_MEDIUM; 1176 pref = ICMPV6_ROUTER_PREF_MEDIUM;
1177#endif 1177#endif
1178 1178
1179 rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev); 1179 rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
1180 1180
1181 if (rt) 1181 if (rt)
1182 neigh = rt->rt6i_nexthop; 1182 neigh = rt->rt6i_nexthop;
@@ -1191,7 +1191,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
1191 ND_PRINTK3(KERN_DEBUG 1191 ND_PRINTK3(KERN_DEBUG
1192 "ICMPv6 RA: adding default router.\n"); 1192 "ICMPv6 RA: adding default router.\n");
1193 1193
1194 rt = rt6_add_dflt_router(&skb->nh.ipv6h->saddr, skb->dev, pref); 1194 rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
1195 if (rt == NULL) { 1195 if (rt == NULL) {
1196 ND_PRINTK0(KERN_ERR 1196 ND_PRINTK0(KERN_ERR
1197 "ICMPv6 RA: %s() failed to add default route.\n", 1197 "ICMPv6 RA: %s() failed to add default route.\n",
@@ -1263,7 +1263,7 @@ skip_defrtr:
1263 */ 1263 */
1264 1264
1265 if (!neigh) 1265 if (!neigh)
1266 neigh = __neigh_lookup(&nd_tbl, &skb->nh.ipv6h->saddr, 1266 neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
1267 skb->dev, 1); 1267 skb->dev, 1);
1268 if (neigh) { 1268 if (neigh) {
1269 u8 *lladdr = NULL; 1269 u8 *lladdr = NULL;
@@ -1292,7 +1292,7 @@ skip_defrtr:
1292 if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen) 1292 if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
1293 continue; 1293 continue;
1294 rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3, 1294 rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
1295 &skb->nh.ipv6h->saddr); 1295 &ipv6_hdr(skb)->saddr);
1296 } 1296 }
1297 } 1297 }
1298#endif 1298#endif
@@ -1351,7 +1351,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1351 int optlen; 1351 int optlen;
1352 u8 *lladdr = NULL; 1352 u8 *lladdr = NULL;
1353 1353
1354 if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) { 1354 if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
1355 ND_PRINTK2(KERN_WARNING 1355 ND_PRINTK2(KERN_WARNING
1356 "ICMPv6 Redirect: source address is not link-local.\n"); 1356 "ICMPv6 Redirect: source address is not link-local.\n");
1357 return; 1357 return;
@@ -1416,8 +1416,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
1416 1416
1417 neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1); 1417 neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1);
1418 if (neigh) { 1418 if (neigh) {
1419 rt6_redirect(dest, &skb->nh.ipv6h->daddr, 1419 rt6_redirect(dest, &ipv6_hdr(skb)->daddr,
1420 &skb->nh.ipv6h->saddr, neigh, lladdr, 1420 &ipv6_hdr(skb)->saddr, neigh, lladdr,
1421 on_link); 1421 on_link);
1422 neigh_release(neigh); 1422 neigh_release(neigh);
1423 } 1423 }
@@ -1453,14 +1453,14 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1453 return; 1453 return;
1454 } 1454 }
1455 1455
1456 if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) && 1456 if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
1457 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) { 1457 !(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
1458 ND_PRINTK2(KERN_WARNING 1458 ND_PRINTK2(KERN_WARNING
1459 "ICMPv6 Redirect: target address is not link-local.\n"); 1459 "ICMPv6 Redirect: target address is not link-local.\n");
1460 return; 1460 return;
1461 } 1461 }
1462 1462
1463 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr, 1463 ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &ipv6_hdr(skb)->saddr,
1464 dev->ifindex); 1464 dev->ifindex);
1465 1465
1466 dst = ip6_route_output(NULL, &fl); 1466 dst = ip6_route_output(NULL, &fl);
@@ -1515,7 +1515,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1515 hlen = 0; 1515 hlen = 0;
1516 1516
1517 skb_reserve(buff, LL_RESERVED_SPACE(dev)); 1517 skb_reserve(buff, LL_RESERVED_SPACE(dev));
1518 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr, 1518 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
1519 IPPROTO_ICMPV6, len); 1519 IPPROTO_ICMPV6, len);
1520 1520
1521 icmph = (struct icmp6hdr *)skb_put(buff, len); 1521 icmph = (struct icmp6hdr *)skb_put(buff, len);
@@ -1531,7 +1531,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1531 addrp = (struct in6_addr *)(icmph + 1); 1531 addrp = (struct in6_addr *)(icmph + 1);
1532 ipv6_addr_copy(addrp, target); 1532 ipv6_addr_copy(addrp, target);
1533 addrp++; 1533 addrp++;
1534 ipv6_addr_copy(addrp, &skb->nh.ipv6h->daddr); 1534 ipv6_addr_copy(addrp, &ipv6_hdr(skb)->daddr);
1535 1535
1536 opt = (u8*) (addrp + 1); 1536 opt = (u8*) (addrp + 1);
1537 1537
@@ -1552,9 +1552,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1552 *(opt++) = (rd_len >> 3); 1552 *(opt++) = (rd_len >> 3);
1553 opt += 6; 1553 opt += 6;
1554 1554
1555 memcpy(opt, skb->nh.ipv6h, rd_len - 8); 1555 memcpy(opt, ipv6_hdr(skb), rd_len - 8);
1556 1556
1557 icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &skb->nh.ipv6h->saddr, 1557 icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
1558 len, IPPROTO_ICMPV6, 1558 len, IPPROTO_ICMPV6,
1559 csum_partial((u8 *) icmph, len, 0)); 1559 csum_partial((u8 *) icmph, len, 0));
1560 1560
@@ -1588,10 +1588,10 @@ int ndisc_rcv(struct sk_buff *skb)
1588 1588
1589 __skb_push(skb, skb->data-skb->h.raw); 1589 __skb_push(skb, skb->data-skb->h.raw);
1590 1590
1591 if (skb->nh.ipv6h->hop_limit != 255) { 1591 if (ipv6_hdr(skb)->hop_limit != 255) {
1592 ND_PRINTK2(KERN_WARNING 1592 ND_PRINTK2(KERN_WARNING
1593 "ICMPv6 NDISC: invalid hop-limit: %d\n", 1593 "ICMPv6 NDISC: invalid hop-limit: %d\n",
1594 skb->nh.ipv6h->hop_limit); 1594 ipv6_hdr(skb)->hop_limit);
1595 return 0; 1595 return 0;
1596 } 1596 }
1597 1597