netlink: implement nla_get_in_addr and nla_get_in6_addr
authorJiri Benc <jbenc@redhat.com>
Sun, 29 Mar 2015 14:59:26 +0000 (16:59 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Mar 2015 17:58:35 +0000 (13:58 -0400)
Those are counterparts to nla_put_in_addr and nla_put_in6_addr.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
21 files changed:
drivers/net/vxlan.c
include/net/netlink.h
net/ipv4/devinet.c
net/ipv4/fib_rules.c
net/ipv4/fib_semantics.c
net/ipv4/ip_gre.c
net/ipv4/ip_vti.c
net/ipv4/ipip.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/route.c
net/ipv4/tcp_metrics.c
net/ipv6/fib6_rules.c
net/ipv6/ip6_gre.c
net/ipv6/ip6_tunnel.c
net/ipv6/ip6_vti.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/route.c
net/ipv6/sit.c
net/l2tp/l2tp_netlink.c
net/openvswitch/flow_netlink.c
net/wireless/nl80211.c

index 86f085f9540819cd6012c54d6d5bcecb9df1909a..a8d345054d233da0949a7abd740a2bdca5a5214f 100644 (file)
@@ -171,11 +171,11 @@ static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa)
 static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
 {
        if (nla_len(nla) >= sizeof(struct in6_addr)) {
-               nla_memcpy(&ip->sin6.sin6_addr, nla, sizeof(struct in6_addr));
+               ip->sin6.sin6_addr = nla_get_in6_addr(nla);
                ip->sa.sa_family = AF_INET6;
                return 0;
        } else if (nla_len(nla) >= sizeof(__be32)) {
-               ip->sin.sin_addr.s_addr = nla_get_be32(nla);
+               ip->sin.sin_addr.s_addr = nla_get_in_addr(nla);
                ip->sa.sa_family = AF_INET;
                return 0;
        } else {
@@ -215,7 +215,7 @@ static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
        if (nla_len(nla) >= sizeof(struct in6_addr)) {
                return -EAFNOSUPPORT;
        } else if (nla_len(nla) >= sizeof(__be32)) {
-               ip->sin.sin_addr.s_addr = nla_get_be32(nla);
+               ip->sin.sin_addr.s_addr = nla_get_in_addr(nla);
                ip->sa.sa_family = AF_INET;
                return 0;
        } else {
@@ -2602,27 +2602,25 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
        /* Unless IPv6 is explicitly requested, assume IPv4 */
        dst->remote_ip.sa.sa_family = AF_INET;
        if (data[IFLA_VXLAN_GROUP]) {
-               dst->remote_ip.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_GROUP]);
+               dst->remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]);
        } else if (data[IFLA_VXLAN_GROUP6]) {
                if (!IS_ENABLED(CONFIG_IPV6))
                        return -EPFNOSUPPORT;
 
-               nla_memcpy(&dst->remote_ip.sin6.sin6_addr, data[IFLA_VXLAN_GROUP6],
-                          sizeof(struct in6_addr));
+               dst->remote_ip.sin6.sin6_addr = nla_get_in6_addr(data[IFLA_VXLAN_GROUP6]);
                dst->remote_ip.sa.sa_family = AF_INET6;
                use_ipv6 = true;
        }
 
        if (data[IFLA_VXLAN_LOCAL]) {
-               vxlan->saddr.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_LOCAL]);
+               vxlan->saddr.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_LOCAL]);
                vxlan->saddr.sa.sa_family = AF_INET;
        } else if (data[IFLA_VXLAN_LOCAL6]) {
                if (!IS_ENABLED(CONFIG_IPV6))
                        return -EPFNOSUPPORT;
 
                /* TODO: respect scope id */
-               nla_memcpy(&vxlan->saddr.sin6.sin6_addr, data[IFLA_VXLAN_LOCAL6],
-                          sizeof(struct in6_addr));
+               vxlan->saddr.sin6.sin6_addr = nla_get_in6_addr(data[IFLA_VXLAN_LOCAL6]);
                vxlan->saddr.sa.sa_family = AF_INET6;
                use_ipv6 = true;
        }
index 17fc76e5b05ec0e30e0d20a94a6d3ec3e5de7a4f..2a5dbcc90d1cafc950a4eafd3fd18b4d1e342d47 100644 (file)
@@ -1127,6 +1127,27 @@ static inline unsigned long nla_get_msecs(const struct nlattr *nla)
        return msecs_to_jiffies((unsigned long) msecs);
 }
 
+/**
+ * nla_get_in_addr - return payload of IPv4 address attribute
+ * @nla: IPv4 address netlink attribute
+ */
+static inline __be32 nla_get_in_addr(const struct nlattr *nla)
+{
+       return *(__be32 *) nla_data(nla);
+}
+
+/**
+ * nla_get_in6_addr - return payload of IPv6 address attribute
+ * @nla: IPv6 address netlink attribute
+ */
+static inline struct in6_addr nla_get_in6_addr(const struct nlattr *nla)
+{
+       struct in6_addr tmp;
+
+       nla_memcpy(&tmp, nla, sizeof(tmp));
+       return tmp;
+}
+
 /**
  * nla_nest_start - Start a new level of nested attributes
  * @skb: socket buffer to add attributes to
index 66cd8597305683867a39f6cb8e7054f61a6d9da6..c6473f365ad18ba3aff78ad8cc9806a526b1f179 100644 (file)
@@ -593,7 +593,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
        for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
             ifap = &ifa->ifa_next) {
                if (tb[IFA_LOCAL] &&
-                   ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL]))
+                   ifa->ifa_local != nla_get_in_addr(tb[IFA_LOCAL]))
                        continue;
 
                if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label))
@@ -601,7 +601,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
 
                if (tb[IFA_ADDRESS] &&
                    (ifm->ifa_prefixlen != ifa->ifa_prefixlen ||
-                   !inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa)))
+                   !inet_ifa_match(nla_get_in_addr(tb[IFA_ADDRESS]), ifa)))
                        continue;
 
                if (ipv4_is_multicast(ifa->ifa_address))
@@ -791,11 +791,11 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
        ifa->ifa_scope = ifm->ifa_scope;
        ifa->ifa_dev = in_dev;
 
-       ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]);
-       ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]);
+       ifa->ifa_local = nla_get_in_addr(tb[IFA_LOCAL]);
+       ifa->ifa_address = nla_get_in_addr(tb[IFA_ADDRESS]);
 
        if (tb[IFA_BROADCAST])
-               ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]);
+               ifa->ifa_broadcast = nla_get_in_addr(tb[IFA_BROADCAST]);
 
        if (tb[IFA_LABEL])
                nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
index edfea0deec43d2ffca7bb8e8af140699aa96e351..8162dd8e86d753bb5e932cd6094c233a5da9a962 100644 (file)
@@ -194,10 +194,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        }
 
        if (frh->src_len)
-               rule4->src = nla_get_be32(tb[FRA_SRC]);
+               rule4->src = nla_get_in_addr(tb[FRA_SRC]);
 
        if (frh->dst_len)
-               rule4->dst = nla_get_be32(tb[FRA_DST]);
+               rule4->dst = nla_get_in_addr(tb[FRA_DST]);
 
 #ifdef CONFIG_IP_ROUTE_CLASSID
        if (tb[FRA_FLOW]) {
@@ -260,10 +260,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
                return 0;
 #endif
 
-       if (frh->src_len && (rule4->src != nla_get_be32(tb[FRA_SRC])))
+       if (frh->src_len && (rule4->src != nla_get_in_addr(tb[FRA_SRC])))
                return 0;
 
-       if (frh->dst_len && (rule4->dst != nla_get_be32(tb[FRA_DST])))
+       if (frh->dst_len && (rule4->dst != nla_get_in_addr(tb[FRA_DST])))
                return 0;
 
        return 1;
index 453b24e5322cd0b28ba400e9c16a92a13d6864a6..eac5aec7772a08a7883ab5c669c14afb6f85e1d9 100644 (file)
@@ -468,7 +468,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
                        struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
 
                        nla = nla_find(attrs, attrlen, RTA_GATEWAY);
-                       nexthop_nh->nh_gw = nla ? nla_get_be32(nla) : 0;
+                       nexthop_nh->nh_gw = nla ? nla_get_in_addr(nla) : 0;
 #ifdef CONFIG_IP_ROUTE_CLASSID
                        nla = nla_find(attrs, attrlen, RTA_FLOW);
                        nexthop_nh->nh_tclassid = nla ? nla_get_u32(nla) : 0;
@@ -523,7 +523,7 @@ int fib_nh_match(struct fib_config *cfg, struct fib_info *fi)
                        struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
 
                        nla = nla_find(attrs, attrlen, RTA_GATEWAY);
-                       if (nla && nla_get_be32(nla) != nh->nh_gw)
+                       if (nla && nla_get_in_addr(nla) != nh->nh_gw)
                                return 1;
 #ifdef CONFIG_IP_ROUTE_CLASSID
                        nla = nla_find(attrs, attrlen, RTA_FLOW);
index 2e878df460755cca7bff8bf2d95d61f04f4d180a..0eb2a040a83012fb92dd9f4f0639e5a5ad2dc797 100644 (file)
@@ -621,10 +621,10 @@ static void ipgre_netlink_parms(struct nlattr *data[], struct nlattr *tb[],
                parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]);
 
        if (data[IFLA_GRE_LOCAL])
-               parms->iph.saddr = nla_get_be32(data[IFLA_GRE_LOCAL]);
+               parms->iph.saddr = nla_get_in_addr(data[IFLA_GRE_LOCAL]);
 
        if (data[IFLA_GRE_REMOTE])
-               parms->iph.daddr = nla_get_be32(data[IFLA_GRE_REMOTE]);
+               parms->iph.daddr = nla_get_in_addr(data[IFLA_GRE_REMOTE]);
 
        if (data[IFLA_GRE_TTL])
                parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]);
index f189f2a8aaa51d52b4658cc111639ba06c45e50a..5a6e27054f0a87e051cd995ab50952273d09c2b5 100644 (file)
@@ -456,10 +456,10 @@ static void vti_netlink_parms(struct nlattr *data[],
                parms->o_key = nla_get_be32(data[IFLA_VTI_OKEY]);
 
        if (data[IFLA_VTI_LOCAL])
-               parms->iph.saddr = nla_get_be32(data[IFLA_VTI_LOCAL]);
+               parms->iph.saddr = nla_get_in_addr(data[IFLA_VTI_LOCAL]);
 
        if (data[IFLA_VTI_REMOTE])
-               parms->iph.daddr = nla_get_be32(data[IFLA_VTI_REMOTE]);
+               parms->iph.daddr = nla_get_in_addr(data[IFLA_VTI_REMOTE]);
 
 }
 
index 17df8d38bbbdf4d9e791cf56873f63ffe32f32c6..bfbcc85c02ee7b0897826e5909ff551f62cc50b0 100644 (file)
@@ -325,10 +325,10 @@ static void ipip_netlink_parms(struct nlattr *data[],
                parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
 
        if (data[IFLA_IPTUN_LOCAL])
-               parms->iph.saddr = nla_get_be32(data[IFLA_IPTUN_LOCAL]);
+               parms->iph.saddr = nla_get_in_addr(data[IFLA_IPTUN_LOCAL]);
 
        if (data[IFLA_IPTUN_REMOTE])
-               parms->iph.daddr = nla_get_be32(data[IFLA_IPTUN_REMOTE]);
+               parms->iph.daddr = nla_get_in_addr(data[IFLA_IPTUN_REMOTE]);
 
        if (data[IFLA_IPTUN_TTL]) {
                parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]);
index b36ebfc6b812cd2560fb0de757a0bac9b667ea6e..8c8d6642cbb0211f2a14252d95158233b485c256 100644 (file)
@@ -342,8 +342,8 @@ static int ipv4_nlattr_to_tuple(struct nlattr *tb[],
        if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST])
                return -EINVAL;
 
-       t->src.u3.ip = nla_get_be32(tb[CTA_IP_V4_SRC]);
-       t->dst.u3.ip = nla_get_be32(tb[CTA_IP_V4_DST]);
+       t->src.u3.ip = nla_get_in_addr(tb[CTA_IP_V4_SRC]);
+       t->dst.u3.ip = nla_get_in_addr(tb[CTA_IP_V4_DST]);
 
        return 0;
 }
index 1f147204f1f3ba993c4653e41ba9ad3823f8551e..652b92ebd7badd3433282b96122da685d3f24eb1 100644 (file)
@@ -2436,8 +2436,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
        ip_hdr(skb)->protocol = IPPROTO_ICMP;
        skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
 
-       src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;
-       dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0;
+       src = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;
+       dst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;
        iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;
        mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;
 
index 32e36ea6bc0f65cb0c26d81a662462de8c228e61..71ec14c87579337a2cb9dc4752ebe37c189e1e20 100644 (file)
@@ -948,7 +948,7 @@ static int __parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
        a = info->attrs[v4];
        if (a) {
                addr->family = AF_INET;
-               addr->addr.a4 = nla_get_be32(a);
+               addr->addr.a4 = nla_get_in_addr(a);
                if (hash)
                        *hash = (__force unsigned int) addr->addr.a4;
                return 0;
@@ -958,7 +958,7 @@ static int __parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
                if (nla_len(a) != sizeof(struct in6_addr))
                        return -EINVAL;
                addr->family = AF_INET6;
-               memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6));
+               addr->addr.in6 = nla_get_in6_addr(a);
                if (hash)
                        *hash = ipv6_addr_hash(&addr->addr.in6);
                return 0;
index d313bfd88512c1dfcb572f5ff08da6f96d0ceb66..61fb184b818d80d3d614bc5ee7011f47b36895ab 100644 (file)
@@ -199,12 +199,10 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
        }
 
        if (frh->src_len)
-               nla_memcpy(&rule6->src.addr, tb[FRA_SRC],
-                          sizeof(struct in6_addr));
+               rule6->src.addr = nla_get_in6_addr(tb[FRA_SRC]);
 
        if (frh->dst_len)
-               nla_memcpy(&rule6->dst.addr, tb[FRA_DST],
-                          sizeof(struct in6_addr));
+               rule6->dst.addr = nla_get_in6_addr(tb[FRA_DST]);
 
        rule6->src.plen = frh->src_len;
        rule6->dst.plen = frh->dst_len;
index f61f7ad2d045d964e3f4bbbe9fc15900c0a638d4..0f4e73da14e49fba9ff122da8a3c6380f6937a85 100644 (file)
@@ -1412,7 +1412,7 @@ static int ip6gre_tap_validate(struct nlattr *tb[], struct nlattr *data[])
                goto out;
 
        if (data[IFLA_GRE_REMOTE]) {
-               nla_memcpy(&daddr, data[IFLA_GRE_REMOTE], sizeof(struct in6_addr));
+               daddr = nla_get_in6_addr(data[IFLA_GRE_REMOTE]);
                if (ipv6_addr_any(&daddr))
                        return -EINVAL;
        }
@@ -1446,10 +1446,10 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
                parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]);
 
        if (data[IFLA_GRE_LOCAL])
-               nla_memcpy(&parms->laddr, data[IFLA_GRE_LOCAL], sizeof(struct in6_addr));
+               parms->laddr = nla_get_in6_addr(data[IFLA_GRE_LOCAL]);
 
        if (data[IFLA_GRE_REMOTE])
-               nla_memcpy(&parms->raddr, data[IFLA_GRE_REMOTE], sizeof(struct in6_addr));
+               parms->raddr = nla_get_in6_addr(data[IFLA_GRE_REMOTE]);
 
        if (data[IFLA_GRE_TTL])
                parms->hop_limit = nla_get_u8(data[IFLA_GRE_TTL]);
index 80543d13ea7cf557f01ed5051087f24a2ba4cfaa..9bd85f0dff69b2b2a8bb9277bd9eaffac04b042c 100644 (file)
@@ -1640,12 +1640,10 @@ static void ip6_tnl_netlink_parms(struct nlattr *data[],
                parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
 
        if (data[IFLA_IPTUN_LOCAL])
-               nla_memcpy(&parms->laddr, data[IFLA_IPTUN_LOCAL],
-                          sizeof(struct in6_addr));
+               parms->laddr = nla_get_in6_addr(data[IFLA_IPTUN_LOCAL]);
 
        if (data[IFLA_IPTUN_REMOTE])
-               nla_memcpy(&parms->raddr, data[IFLA_IPTUN_REMOTE],
-                          sizeof(struct in6_addr));
+               parms->raddr = nla_get_in6_addr(data[IFLA_IPTUN_REMOTE]);
 
        if (data[IFLA_IPTUN_TTL])
                parms->hop_limit = nla_get_u8(data[IFLA_IPTUN_TTL]);
index 87a262b0f07bcacf975297449c091e64b9128787..53d90ed68905f1ab0935ba0735bea8487a03e921 100644 (file)
@@ -897,12 +897,10 @@ static void vti6_netlink_parms(struct nlattr *data[],
                parms->link = nla_get_u32(data[IFLA_VTI_LINK]);
 
        if (data[IFLA_VTI_LOCAL])
-               nla_memcpy(&parms->laddr, data[IFLA_VTI_LOCAL],
-                          sizeof(struct in6_addr));
+               parms->laddr = nla_get_in6_addr(data[IFLA_VTI_LOCAL]);
 
        if (data[IFLA_VTI_REMOTE])
-               nla_memcpy(&parms->raddr, data[IFLA_VTI_REMOTE],
-                          sizeof(struct in6_addr));
+               parms->raddr = nla_get_in6_addr(data[IFLA_VTI_REMOTE]);
 
        if (data[IFLA_VTI_IKEY])
                parms->i_key = nla_get_be32(data[IFLA_VTI_IKEY]);
index 78284a6974395b2d601d84fc15655b19e9c8e974..fba91c6fc7ca38f1a282da09b7323519ddf3b1aa 100644 (file)
@@ -310,10 +310,8 @@ static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
        if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST])
                return -EINVAL;
 
-       memcpy(&t->src.u3.ip6, nla_data(tb[CTA_IP_V6_SRC]),
-              sizeof(u_int32_t) * 4);
-       memcpy(&t->dst.u3.ip6, nla_data(tb[CTA_IP_V6_DST]),
-              sizeof(u_int32_t) * 4);
+       t->src.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_SRC]);
+       t->dst.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_DST]);
 
        return 0;
 }
index 385e9bd4f21815382b8045e8621291d33136cc81..5c48293ff06235e72f586007ff1e7bb568733b92 100644 (file)
@@ -2438,7 +2438,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
 
        if (tb[RTA_GATEWAY]) {
-               nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16);
+               cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
                cfg->fc_flags |= RTF_GATEWAY;
        }
 
@@ -2461,7 +2461,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
        }
 
        if (tb[RTA_PREFSRC])
-               nla_memcpy(&cfg->fc_prefsrc, tb[RTA_PREFSRC], 16);
+               cfg->fc_prefsrc = nla_get_in6_addr(tb[RTA_PREFSRC]);
 
        if (tb[RTA_OIF])
                cfg->fc_ifindex = nla_get_u32(tb[RTA_OIF]);
@@ -2519,7 +2519,7 @@ beginning:
 
                        nla = nla_find(attrs, attrlen, RTA_GATEWAY);
                        if (nla) {
-                               nla_memcpy(&r_cfg.fc_gateway, nla, 16);
+                               r_cfg.fc_gateway = nla_get_in6_addr(nla);
                                r_cfg.fc_flags |= RTF_GATEWAY;
                        }
                }
index 0e2bb538a55635d58af311e9a4ddfe117715d40d..e6b9f51b15e8f31abcf7dc62180f3b7afc8427a8 100644 (file)
@@ -1530,8 +1530,7 @@ static bool ipip6_netlink_6rd_parms(struct nlattr *data[],
 
        if (data[IFLA_IPTUN_6RD_PREFIX]) {
                ret = true;
-               nla_memcpy(&ip6rd->prefix, data[IFLA_IPTUN_6RD_PREFIX],
-                          sizeof(struct in6_addr));
+               ip6rd->prefix = nla_get_in6_addr(data[IFLA_IPTUN_6RD_PREFIX]);
        }
 
        if (data[IFLA_IPTUN_6RD_RELAY_PREFIX]) {
index a4f78d36bace4e8292de314f07bee4725f6448d5..9e13c2ff878970fbbe355990f756684d9e868988 100644 (file)
@@ -205,9 +205,9 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
 #endif
                if (info->attrs[L2TP_ATTR_IP_SADDR] &&
                    info->attrs[L2TP_ATTR_IP_DADDR]) {
-                       cfg.local_ip.s_addr = nla_get_be32(
+                       cfg.local_ip.s_addr = nla_get_in_addr(
                                info->attrs[L2TP_ATTR_IP_SADDR]);
-                       cfg.peer_ip.s_addr = nla_get_be32(
+                       cfg.peer_ip.s_addr = nla_get_in_addr(
                                info->attrs[L2TP_ATTR_IP_DADDR]);
                } else {
                        ret = -EINVAL;
index c0c5b5519f45272a34f5c903a826921029a763d0..c691b1a1eee0ae3aeedf389a3288272417e9bcbb 100644 (file)
@@ -535,11 +535,11 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
                        break;
                case OVS_TUNNEL_KEY_ATTR_IPV4_SRC:
                        SW_FLOW_KEY_PUT(match, tun_key.ipv4_src,
-                                       nla_get_be32(a), is_mask);
+                                       nla_get_in_addr(a), is_mask);
                        break;
                case OVS_TUNNEL_KEY_ATTR_IPV4_DST:
                        SW_FLOW_KEY_PUT(match, tun_key.ipv4_dst,
-                                       nla_get_be32(a), is_mask);
+                                       nla_get_in_addr(a), is_mask);
                        break;
                case OVS_TUNNEL_KEY_ATTR_TOS:
                        SW_FLOW_KEY_PUT(match, tun_key.ipv4_tos,
index 6a4a4d7db1fc780f6c69613f8a1b1a320476e8c5..2fb804bfa361022ba909fe8cac1f4ac11886dfdd 100644 (file)
@@ -8993,8 +8993,8 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
        cfg = kzalloc(size, GFP_KERNEL);
        if (!cfg)
                return -ENOMEM;
-       cfg->src = nla_get_be32(tb[NL80211_WOWLAN_TCP_SRC_IPV4]);
-       cfg->dst = nla_get_be32(tb[NL80211_WOWLAN_TCP_DST_IPV4]);
+       cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]);
+       cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]);
        memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]),
               ETH_ALEN);
        if (tb[NL80211_WOWLAN_TCP_SRC_PORT])