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

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

diff -u --recursive --new-file v2.4.3/linux/net/ipv6/sit.c linux/net/ipv6/sit.c
@@ -6,7 +6,7 @@
  *	Pedro Roque		<roque@di.fc.ul.pt>	
  *	Alexey Kuznetsov	<kuznet@ms2.inr.ac.ru>
  *
- *	$Id: sit.c,v 1.47 2000/11/28 13:49:22 davem Exp $
+ *	$Id: sit.c,v 1.50 2001/04/19 22:32:55 davem Exp $
  *
  *	This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -229,7 +229,7 @@
 }
 
 
-void ipip6_err(struct sk_buff *skb, unsigned char *dp, int len)
+void ipip6_err(struct sk_buff *skb, u32 info)
 {
 #ifndef I_WISH_WORLD_WERE_PERFECT
 
@@ -237,14 +237,11 @@
    8 bytes of packet payload. It means, that precise relaying of
    ICMP in the real Internet is absolutely infeasible.
  */
-	struct iphdr *iph = (struct iphdr*)dp;
+	struct iphdr *iph = (struct iphdr*)skb->data;
 	int type = skb->h.icmph->type;
 	int code = skb->h.icmph->code;
 	struct ip_tunnel *t;
 
-	if (len < sizeof(struct iphdr))
-		return;
-
 	switch (type) {
 	default:
 	case ICMP_PARAMETERPROB:
@@ -382,20 +379,22 @@
 		IP6_ECN_set_ce(skb->nh.ipv6h);
 }
 
-int ipip6_rcv(struct sk_buff *skb, unsigned short len)
+int ipip6_rcv(struct sk_buff *skb)
 {
 	struct iphdr *iph;
 	struct ip_tunnel *tunnel;
 
+	if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
+		goto out;
+
 	iph = skb->nh.iph;
 
 	read_lock(&ipip6_lock);
 	if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
 		skb->mac.raw = skb->nh.raw;
-		skb->nh.raw = skb_pull(skb, skb->h.raw - skb->data);
+		skb->nh.raw = skb->data;
 		memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
 		skb->protocol = __constant_htons(ETH_P_IPV6);
-		skb->ip_summed = 0;
 		skb->pkt_type = PACKET_HOST;
 		tunnel->stat.rx_packets++;
 		tunnel->stat.rx_bytes += skb->len;
@@ -418,6 +417,7 @@
 	icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0);
 	kfree_skb(skb);
 	read_unlock(&ipip6_lock);
+out:
 	return 0;
 }
 
@@ -747,8 +747,6 @@
 	dev->do_ioctl		= ipip6_tunnel_ioctl;
 	dev->change_mtu		= ipip6_tunnel_change_mtu;
 
-	dev_init_buffers(dev);
-
 	dev->type		= ARPHRD_SIT;
 	dev->hard_header_len 	= LL_MAX_HEADER + sizeof(struct iphdr);
 	dev->mtu		= 1500 - sizeof(struct iphdr);
@@ -842,7 +840,7 @@
 void sit_cleanup(void)
 {
 	inet_del_protocol(&sit_protocol);
-	unregister_netdevice(&ipip6_fb_tunnel_dev);
+	unregister_netdev(&ipip6_fb_tunnel_dev);
 }
 #endif
 
@@ -852,13 +850,7 @@
 
 	ipip6_fb_tunnel_dev.priv = (void*)&ipip6_fb_tunnel;
 	strcpy(ipip6_fb_tunnel_dev.name, ipip6_fb_tunnel.parms.name);
-#ifdef MODULE
 	register_netdev(&ipip6_fb_tunnel_dev);
-#else
-	rtnl_lock();
-	register_netdevice(&ipip6_fb_tunnel_dev);
-	rtnl_unlock();
-#endif
 	inet_add_protocol(&sit_protocol);
 	return 0;
 }

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