diff options
Diffstat (limited to 'net/ipv6')
| -rw-r--r-- | net/ipv6/inet6_connection_sock.c | 3 | ||||
| -rw-r--r-- | net/ipv6/ip6_gre.c | 10 | ||||
| -rw-r--r-- | net/ipv6/ip6_output.c | 2 | ||||
| -rw-r--r-- | net/ipv6/ip6_tunnel.c | 8 | ||||
| -rw-r--r-- | net/ipv6/ip6mr.c | 2 | ||||
| -rw-r--r-- | net/ipv6/route.c | 19 | ||||
| -rw-r--r-- | net/ipv6/sit.c | 22 | ||||
| -rw-r--r-- | net/ipv6/xfrm6_output.c | 2 | 
8 files changed, 35 insertions, 33 deletions
| diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index c9138189415a..d4ade34ab375 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c @@ -224,9 +224,8 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk,  	return dst;  } -int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl_unused) +int inet6_csk_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl_unused)  { -	struct sock *sk = skb->sk;  	struct ipv6_pinfo *np = inet6_sk(sk);  	struct flowi6 fl6;  	struct dst_entry *dst; diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index c98338b81d30..9d921462b57f 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -1559,6 +1559,15 @@ static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],  	return 0;  } +static void ip6gre_dellink(struct net_device *dev, struct list_head *head) +{ +	struct net *net = dev_net(dev); +	struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); + +	if (dev != ign->fb_tunnel_dev) +		unregister_netdevice_queue(dev, head); +} +  static size_t ip6gre_get_size(const struct net_device *dev)  {  	return @@ -1636,6 +1645,7 @@ static struct rtnl_link_ops ip6gre_link_ops __read_mostly = {  	.validate	= ip6gre_tunnel_validate,  	.newlink	= ip6gre_newlink,  	.changelink	= ip6gre_changelink, +	.dellink	= ip6gre_dellink,  	.get_size	= ip6gre_get_size,  	.fill_info	= ip6gre_fill_info,  }; diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 3284d61577c0..40e7581374f7 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -132,7 +132,7 @@ static int ip6_finish_output(struct sk_buff *skb)  		return ip6_finish_output2(skb);  } -int ip6_output(struct sk_buff *skb) +int ip6_output(struct sock *sk, struct sk_buff *skb)  {  	struct net_device *dev = skb_dst(skb)->dev;  	struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb)); diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index e1df691d78be..b05b609f69d1 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c @@ -1340,8 +1340,8 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)  	int err = 0;  	struct ip6_tnl_parm p;  	struct __ip6_tnl_parm p1; -	struct ip6_tnl *t = NULL; -	struct net *net = dev_net(dev); +	struct ip6_tnl *t = netdev_priv(dev); +	struct net *net = t->net;  	struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id);  	switch (cmd) { @@ -1353,11 +1353,11 @@ ip6_tnl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)  			}  			ip6_tnl_parm_from_user(&p1, &p);  			t = ip6_tnl_locate(net, &p1, 0); +			if (t == NULL) +				t = netdev_priv(dev);  		} else {  			memset(&p, 0, sizeof(p));  		} -		if (t == NULL) -			t = netdev_priv(dev);  		ip6_tnl_parm_to_user(&p, &t->parms);  		if (copy_to_user(ifr->ifr_ifru.ifru_data, &p, sizeof (p))) {  			err = -EFAULT; diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 8737400af0a0..8659067da28e 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -700,7 +700,7 @@ static netdev_tx_t reg_vif_xmit(struct sk_buff *skb,  	struct mr6_table *mrt;  	struct flowi6 fl6 = {  		.flowi6_oif	= dev->ifindex, -		.flowi6_iif	= skb->skb_iif, +		.flowi6_iif	= skb->skb_iif ? : LOOPBACK_IFINDEX,  		.flowi6_mark	= skb->mark,  	};  	int err; diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5015c50a5ba7..4011617cca68 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -84,9 +84,9 @@ static void		ip6_dst_ifdown(struct dst_entry *,  static int		 ip6_dst_gc(struct dst_ops *ops);  static int		ip6_pkt_discard(struct sk_buff *skb); -static int		ip6_pkt_discard_out(struct sk_buff *skb); +static int		ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb);  static int		ip6_pkt_prohibit(struct sk_buff *skb); -static int		ip6_pkt_prohibit_out(struct sk_buff *skb); +static int		ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb);  static void		ip6_link_failure(struct sk_buff *skb);  static void		ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,  					   struct sk_buff *skb, u32 mtu); @@ -290,7 +290,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = {  		.obsolete	= DST_OBSOLETE_FORCE_CHK,  		.error		= -EINVAL,  		.input		= dst_discard, -		.output		= dst_discard, +		.output		= dst_discard_sk,  	},  	.rt6i_flags	= (RTF_REJECT | RTF_NONEXTHOP),  	.rt6i_protocol  = RTPROT_KERNEL, @@ -1058,7 +1058,7 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori  		new->__use = 1;  		new->input = dst_discard; -		new->output = dst_discard; +		new->output = dst_discard_sk;  		if (dst_metrics_read_only(&ort->dst))  			new->_metrics = ort->dst._metrics; @@ -1338,7 +1338,7 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)  	unsigned int mtu = dst_metric_raw(dst, RTAX_MTU);  	if (mtu) -		return mtu; +		goto out;  	mtu = IPV6_MIN_MTU; @@ -1348,7 +1348,8 @@ static unsigned int ip6_mtu(const struct dst_entry *dst)  		mtu = idev->cnf.mtu6;  	rcu_read_unlock(); -	return mtu; +out: +	return min_t(unsigned int, mtu, IP6_MAX_MTU);  }  static struct dst_entry *icmp6_dst_gc_list; @@ -1576,7 +1577,7 @@ int ip6_route_add(struct fib6_config *cfg)  		switch (cfg->fc_type) {  		case RTN_BLACKHOLE:  			rt->dst.error = -EINVAL; -			rt->dst.output = dst_discard; +			rt->dst.output = dst_discard_sk;  			rt->dst.input = dst_discard;  			break;  		case RTN_PROHIBIT: @@ -2128,7 +2129,7 @@ static int ip6_pkt_discard(struct sk_buff *skb)  	return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_INNOROUTES);  } -static int ip6_pkt_discard_out(struct sk_buff *skb) +static int ip6_pkt_discard_out(struct sock *sk, struct sk_buff *skb)  {  	skb->dev = skb_dst(skb)->dev;  	return ip6_pkt_drop(skb, ICMPV6_NOROUTE, IPSTATS_MIB_OUTNOROUTES); @@ -2139,7 +2140,7 @@ static int ip6_pkt_prohibit(struct sk_buff *skb)  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_INNOROUTES);  } -static int ip6_pkt_prohibit_out(struct sk_buff *skb) +static int ip6_pkt_prohibit_out(struct sock *sk, struct sk_buff *skb)  {  	skb->dev = skb_dst(skb)->dev;  	return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES); diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 1693c8d885f0..e5a453ca302e 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -974,8 +974,9 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,  		goto out;  	} -	err = iptunnel_xmit(rt, skb, fl4.saddr, fl4.daddr, IPPROTO_IPV6, tos, -			    ttl, df, !net_eq(tunnel->net, dev_net(dev))); +	err = iptunnel_xmit(skb->sk, rt, skb, fl4.saddr, fl4.daddr, +			    IPPROTO_IPV6, tos, ttl, df, +			    !net_eq(tunnel->net, dev_net(dev)));  	iptunnel_xmit_stats(err, &dev->stats, dev->tstats);  	return NETDEV_TX_OK; @@ -1126,8 +1127,8 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)  	int err = 0;  	struct ip_tunnel_parm p;  	struct ip_tunnel_prl prl; -	struct ip_tunnel *t; -	struct net *net = dev_net(dev); +	struct ip_tunnel *t = netdev_priv(dev); +	struct net *net = t->net;  	struct sit_net *sitn = net_generic(net, sit_net_id);  #ifdef CONFIG_IPV6_SIT_6RD  	struct ip_tunnel_6rd ip6rd; @@ -1138,16 +1139,15 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)  #ifdef CONFIG_IPV6_SIT_6RD  	case SIOCGET6RD:  #endif -		t = NULL;  		if (dev == sitn->fb_tunnel_dev) {  			if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p))) {  				err = -EFAULT;  				break;  			}  			t = ipip6_tunnel_locate(net, &p, 0); +			if (t == NULL) +				t = netdev_priv(dev);  		} -		if (t == NULL) -			t = netdev_priv(dev);  		err = -EFAULT;  		if (cmd == SIOCGETTUNNEL) { @@ -1243,9 +1243,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)  		err = -EINVAL;  		if (dev == sitn->fb_tunnel_dev)  			goto done; -		err = -ENOENT; -		if (!(t = netdev_priv(dev))) -			goto done;  		err = ipip6_tunnel_get_prl(t, ifr->ifr_ifru.ifru_data);  		break; @@ -1261,9 +1258,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)  		err = -EFAULT;  		if (copy_from_user(&prl, ifr->ifr_ifru.ifru_data, sizeof(prl)))  			goto done; -		err = -ENOENT; -		if (!(t = netdev_priv(dev))) -			goto done;  		switch (cmd) {  		case SIOCDELPRL: @@ -1291,8 +1285,6 @@ ipip6_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)  				   sizeof(ip6rd)))  			goto done; -		t = netdev_priv(dev); -  		if (cmd != SIOCDEL6RD) {  			err = ipip6_tunnel_update_6rd(t, &ip6rd);  			if (err < 0) diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c index 6cd625e37706..19ef329bdbf8 100644 --- a/net/ipv6/xfrm6_output.c +++ b/net/ipv6/xfrm6_output.c @@ -163,7 +163,7 @@ static int __xfrm6_output(struct sk_buff *skb)  	return x->outer_mode->afinfo->output_finish(skb);  } -int xfrm6_output(struct sk_buff *skb) +int xfrm6_output(struct sock *sk, struct sk_buff *skb)  {  	return NF_HOOK(NFPROTO_IPV6, NF_INET_POST_ROUTING, skb, NULL,  		       skb_dst(skb)->dev, __xfrm6_output); | 
