patch-2.4.4 linux/net/ipv6/ndisc.c

Next file: linux/net/ipv6/netfilter/Makefile
Previous file: linux/net/ipv6/mcast.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.3/linux/net/ipv6/ndisc.c linux/net/ipv6/ndisc.c
@@ -338,7 +338,7 @@
 	}
 
 	skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15,
-				  0, 0, &err);
+				  0, &err);
 
 	if (skb == NULL) {
 		ND_PRINTK1("send_na: alloc skb failed\n");
@@ -391,13 +391,15 @@
 	struct in6_addr addr_buf;
         int len;
 	int err;
+	int send_llinfo;
 
 	len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
-	if (dev->addr_len)
+	send_llinfo = dev->addr_len && ipv6_addr_type(saddr) != IPV6_ADDR_ANY;
+	if (send_llinfo)
 		len += NDISC_OPT_SPACE(dev->addr_len);
 
 	skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15,
-				  0, 0, &err);
+				  0, &err);
 	if (skb == NULL) {
 		ND_PRINTK1("send_ns: alloc skb failed\n");
 		return;
@@ -427,7 +429,7 @@
 	/* Set the target address. */
 	ipv6_addr_copy(&msg->target, solicit);
 
-	if (dev->addr_len)
+	if (send_llinfo)
 		ndisc_fill_option((void*)&msg->opt, ND_OPT_SOURCE_LL_ADDR, dev->dev_addr, dev->addr_len);
 
 	/* checksum */
@@ -458,7 +460,7 @@
 		len += NDISC_OPT_SPACE(dev->addr_len);
 
         skb = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15,
-				  0, 0, &err);
+				  0, &err);
 	if (skb == NULL) {
 		ND_PRINTK1("send_ns: alloc skb failed\n");
 		return;
@@ -869,7 +871,7 @@
  	}
 
 	buff = sock_alloc_send_skb(sk, MAX_HEADER + len + dev->hard_header_len + 15,
-				   0, 0, &err);
+				   0, &err);
 	if (buff == NULL) {
 		ND_PRINTK1("ndisc_send_redirect: alloc_skb failed\n");
 		return;
@@ -957,11 +959,11 @@
 
 static void pndisc_redo(struct sk_buff *skb)
 {
-	ndisc_rcv(skb, skb->len);
+	ndisc_rcv(skb);
 	kfree_skb(skb);
 }
 
-int ndisc_rcv(struct sk_buff *skb, unsigned long len)
+int ndisc_rcv(struct sk_buff *skb)
 {
 	struct net_device *dev = skb->dev;
 	struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
@@ -970,6 +972,8 @@
 	struct neighbour *neigh;
 	struct inet6_ifaddr *ifp;
 
+	__skb_push(skb, skb->data-skb->h.raw);
+
 	switch (msg->icmph.icmp6_type) {
 	case NDISC_NEIGHBOUR_SOLICITATION:
 		if ((ifp = ipv6_get_ifaddr(&msg->target, dev)) != NULL) {
@@ -1073,7 +1077,7 @@
 		return 0;
 
 	case NDISC_NEIGHBOUR_ADVERTISEMENT:
-		if ((ipv6_addr_type(saddr)&IPV6_ADDR_MULTICAST) &&
+		if ((ipv6_addr_type(daddr)&IPV6_ADDR_MULTICAST) &&
 		    msg->icmph.icmp6_solicited) {
 			ND_PRINTK0("NDISC: solicited NA is multicasted\n");
 			return 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)