]> Pileus Git - ~andy/linux/commitdiff
ipip: always notify change when params are updated
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Wed, 14 Nov 2012 05:14:01 +0000 (05:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 15 Nov 2012 03:02:38 +0000 (22:02 -0500)
netdev_state_change() was called only when end points or link was updated. Now
that all parameters are advertised via netlink, we must advertise any change.

This patch also prepares the support of ipip tunnels management via rtnl. The
code which update tunnels will be put in a new function.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipip.c

index 099fc1c428b419e3344b9f63cb19bacb0b5d0800..4be88cc9895782ca95d04a1b4dde3f31a0db52b8 100644 (file)
@@ -680,29 +680,27 @@ ipip_tunnel_ioctl (struct net_device *dev, struct ifreq *ifr, int cmd)
                                        break;
                                }
                                t = netdev_priv(dev);
-                               ipip_tunnel_unlink(ipn, t);
-                               synchronize_net();
-                               t->parms.iph.saddr = p.iph.saddr;
-                               t->parms.iph.daddr = p.iph.daddr;
-                               memcpy(dev->dev_addr, &p.iph.saddr, 4);
-                               memcpy(dev->broadcast, &p.iph.daddr, 4);
-                               ipip_tunnel_link(ipn, t);
-                               netdev_state_change(dev);
                        }
+
+                       ipip_tunnel_unlink(ipn, t);
+                       synchronize_net();
+                       t->parms.iph.saddr = p.iph.saddr;
+                       t->parms.iph.daddr = p.iph.daddr;
+                       memcpy(dev->dev_addr, &p.iph.saddr, 4);
+                       memcpy(dev->broadcast, &p.iph.daddr, 4);
+                       ipip_tunnel_link(ipn, t);
+                       t->parms.iph.ttl = p.iph.ttl;
+                       t->parms.iph.tos = p.iph.tos;
+                       t->parms.iph.frag_off = p.iph.frag_off;
+                       if (t->parms.link != p.link) {
+                               t->parms.link = p.link;
+                               ipip_tunnel_bind_dev(dev);
+                       }
+                       netdev_state_change(dev);
                }
 
                if (t) {
                        err = 0;
-                       if (cmd == SIOCCHGTUNNEL) {
-                               t->parms.iph.ttl = p.iph.ttl;
-                               t->parms.iph.tos = p.iph.tos;
-                               t->parms.iph.frag_off = p.iph.frag_off;
-                               if (t->parms.link != p.link) {
-                                       t->parms.link = p.link;
-                                       ipip_tunnel_bind_dev(dev);
-                                       netdev_state_change(dev);
-                               }
-                       }
                        if (copy_to_user(ifr->ifr_ifru.ifru_data, &t->parms, sizeof(p)))
                                err = -EFAULT;
                } else