patch-2.1.9 linux/net/ipv6/sit.c

Next file: linux/net/ipv6/tcp_ipv6.c
Previous file: linux/net/ipv6/ndisc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.8/linux/net/ipv6/sit.c linux/net/ipv6/sit.c
@@ -286,6 +286,9 @@
 {
 	struct sit_vif *vif;
 	struct device *dev;
+
+	if ((sit_device.flags & IFF_UP) == 0)
+		return NULL;
 	
 	vif = kmalloc(sizeof(struct sit_vif), GFP_KERNEL);
 	if (vif == NULL)
@@ -448,14 +451,30 @@
 	daddr = dev->pa_dstaddr;
 	if (daddr == 0)
 	{
-		addr6 = &skb->ipv6_hdr->daddr;
+		struct neighbour *neigh;
+
+		neigh = skb->nexthop;
+		if (neigh == NULL)
+		{
+			printk(KERN_DEBUG "sit: nexthop == NULL\n");
+			goto on_error;
+		}
+		
+		addr6 = &neigh->addr;
 		addr_type = ipv6_addr_type(addr6);
 
+		if (addr_type == IPV6_ADDR_ANY)
+		{
+			addr6 = &skb->ipv6_hdr->daddr;
+			addr_type = ipv6_addr_type(addr6);
+		}
+
 		if ((addr_type & IPV6_ADDR_COMPATv4) == 0)
 		{
 			printk(KERN_DEBUG "sit_xmit: non v4 address\n");
 			goto on_error;
 		}
+		daddr = addr6->s6_addr32[3];
 	}
 
 	len = skb->tail - (skb->data + sizeof(struct ipv6hdr));

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov