gre/ipip: use be16 variants of netlink functions
[cascardo/linux.git] / net / ipv4 / ip_gre.c
index 4f4bf5b..6207275 100644 (file)
@@ -659,12 +659,12 @@ static bool ipgre_netlink_encap_parms(struct nlattr *data[],
 
        if (data[IFLA_GRE_ENCAP_SPORT]) {
                ret = true;
-               ipencap->sport = nla_get_u16(data[IFLA_GRE_ENCAP_SPORT]);
+               ipencap->sport = nla_get_be16(data[IFLA_GRE_ENCAP_SPORT]);
        }
 
        if (data[IFLA_GRE_ENCAP_DPORT]) {
                ret = true;
-               ipencap->dport = nla_get_u16(data[IFLA_GRE_ENCAP_DPORT]);
+               ipencap->dport = nla_get_be16(data[IFLA_GRE_ENCAP_DPORT]);
        }
 
        return ret;
@@ -673,6 +673,7 @@ static bool ipgre_netlink_encap_parms(struct nlattr *data[],
 static int gre_tap_init(struct net_device *dev)
 {
        __gre_tunnel_init(dev);
+       dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
 
        return ip_tunnel_init(dev);
 }
@@ -785,10 +786,10 @@ static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)
 
        if (nla_put_u16(skb, IFLA_GRE_ENCAP_TYPE,
                        t->encap.type) ||
-           nla_put_u16(skb, IFLA_GRE_ENCAP_SPORT,
-                       t->encap.sport) ||
-           nla_put_u16(skb, IFLA_GRE_ENCAP_DPORT,
-                       t->encap.dport) ||
+           nla_put_be16(skb, IFLA_GRE_ENCAP_SPORT,
+                        t->encap.sport) ||
+           nla_put_be16(skb, IFLA_GRE_ENCAP_DPORT,
+                        t->encap.dport) ||
            nla_put_u16(skb, IFLA_GRE_ENCAP_FLAGS,
                        t->encap.flags))
                goto nla_put_failure;
@@ -828,6 +829,7 @@ static struct rtnl_link_ops ipgre_link_ops __read_mostly = {
        .dellink        = ip_tunnel_dellink,
        .get_size       = ipgre_get_size,
        .fill_info      = ipgre_fill_info,
+       .get_link_net   = ip_tunnel_get_link_net,
 };
 
 static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
@@ -842,6 +844,7 @@ static struct rtnl_link_ops ipgre_tap_ops __read_mostly = {
        .dellink        = ip_tunnel_dellink,
        .get_size       = ipgre_get_size,
        .fill_info      = ipgre_fill_info,
+       .get_link_net   = ip_tunnel_get_link_net,
 };
 
 static int __net_init ipgre_tap_init_net(struct net *net)