aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/vxlan.c16
-rw-r--r--include/net/netlink.h21
-rw-r--r--net/ipv4/devinet.c10
-rw-r--r--net/ipv4/fib_rules.c8
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/ip_gre.c4
-rw-r--r--net/ipv4/ip_vti.c4
-rw-r--r--net/ipv4/ipip.c4
-rw-r--r--net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c4
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp_metrics.c4
-rw-r--r--net/ipv6/fib6_rules.c6
-rw-r--r--net/ipv6/ip6_gre.c6
-rw-r--r--net/ipv6/ip6_tunnel.c6
-rw-r--r--net/ipv6/ip6_vti.c6
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c6
-rw-r--r--net/ipv6/route.c6
-rw-r--r--net/ipv6/sit.c3
-rw-r--r--net/l2tp/l2tp_netlink.c4
-rw-r--r--net/openvswitch/flow_netlink.c4
-rw-r--r--net/wireless/nl80211.c4
21 files changed, 72 insertions, 62 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 86f085f95408..a8d345054d23 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -171,11 +171,11 @@ static inline bool vxlan_addr_multicast(const union vxlan_addr *ipa)
171static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla) 171static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
172{ 172{
173 if (nla_len(nla) >= sizeof(struct in6_addr)) { 173 if (nla_len(nla) >= sizeof(struct in6_addr)) {
174 nla_memcpy(&ip->sin6.sin6_addr, nla, sizeof(struct in6_addr)); 174 ip->sin6.sin6_addr = nla_get_in6_addr(nla);
175 ip->sa.sa_family = AF_INET6; 175 ip->sa.sa_family = AF_INET6;
176 return 0; 176 return 0;
177 } else if (nla_len(nla) >= sizeof(__be32)) { 177 } else if (nla_len(nla) >= sizeof(__be32)) {
178 ip->sin.sin_addr.s_addr = nla_get_be32(nla); 178 ip->sin.sin_addr.s_addr = nla_get_in_addr(nla);
179 ip->sa.sa_family = AF_INET; 179 ip->sa.sa_family = AF_INET;
180 return 0; 180 return 0;
181 } else { 181 } else {
@@ -215,7 +215,7 @@ static int vxlan_nla_get_addr(union vxlan_addr *ip, struct nlattr *nla)
215 if (nla_len(nla) >= sizeof(struct in6_addr)) { 215 if (nla_len(nla) >= sizeof(struct in6_addr)) {
216 return -EAFNOSUPPORT; 216 return -EAFNOSUPPORT;
217 } else if (nla_len(nla) >= sizeof(__be32)) { 217 } else if (nla_len(nla) >= sizeof(__be32)) {
218 ip->sin.sin_addr.s_addr = nla_get_be32(nla); 218 ip->sin.sin_addr.s_addr = nla_get_in_addr(nla);
219 ip->sa.sa_family = AF_INET; 219 ip->sa.sa_family = AF_INET;
220 return 0; 220 return 0;
221 } else { 221 } else {
@@ -2602,27 +2602,25 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
2602 /* Unless IPv6 is explicitly requested, assume IPv4 */ 2602 /* Unless IPv6 is explicitly requested, assume IPv4 */
2603 dst->remote_ip.sa.sa_family = AF_INET; 2603 dst->remote_ip.sa.sa_family = AF_INET;
2604 if (data[IFLA_VXLAN_GROUP]) { 2604 if (data[IFLA_VXLAN_GROUP]) {
2605 dst->remote_ip.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_GROUP]); 2605 dst->remote_ip.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_GROUP]);
2606 } else if (data[IFLA_VXLAN_GROUP6]) { 2606 } else if (data[IFLA_VXLAN_GROUP6]) {
2607 if (!IS_ENABLED(CONFIG_IPV6)) 2607 if (!IS_ENABLED(CONFIG_IPV6))
2608 return -EPFNOSUPPORT; 2608 return -EPFNOSUPPORT;
2609 2609
2610 nla_memcpy(&dst->remote_ip.sin6.sin6_addr, data[IFLA_VXLAN_GROUP6], 2610 dst->remote_ip.sin6.sin6_addr = nla_get_in6_addr(data[IFLA_VXLAN_GROUP6]);
2611 sizeof(struct in6_addr));
2612 dst->remote_ip.sa.sa_family = AF_INET6; 2611 dst->remote_ip.sa.sa_family = AF_INET6;
2613 use_ipv6 = true; 2612 use_ipv6 = true;
2614 } 2613 }
2615 2614
2616 if (data[IFLA_VXLAN_LOCAL]) { 2615 if (data[IFLA_VXLAN_LOCAL]) {
2617 vxlan->saddr.sin.sin_addr.s_addr = nla_get_be32(data[IFLA_VXLAN_LOCAL]); 2616 vxlan->saddr.sin.sin_addr.s_addr = nla_get_in_addr(data[IFLA_VXLAN_LOCAL]);
2618 vxlan->saddr.sa.sa_family = AF_INET; 2617 vxlan->saddr.sa.sa_family = AF_INET;
2619 } else if (data[IFLA_VXLAN_LOCAL6]) { 2618 } else if (data[IFLA_VXLAN_LOCAL6]) {
2620 if (!IS_ENABLED(CONFIG_IPV6)) 2619 if (!IS_ENABLED(CONFIG_IPV6))
2621 return -EPFNOSUPPORT; 2620 return -EPFNOSUPPORT;
2622 2621
2623 /* TODO: respect scope id */ 2622 /* TODO: respect scope id */
2624 nla_memcpy(&vxlan->saddr.sin6.sin6_addr, data[IFLA_VXLAN_LOCAL6], 2623 vxlan->saddr.sin6.sin6_addr = nla_get_in6_addr(data[IFLA_VXLAN_LOCAL6]);
2625 sizeof(struct in6_addr));
2626 vxlan->saddr.sa.sa_family = AF_INET6; 2624 vxlan->saddr.sa.sa_family = AF_INET6;
2627 use_ipv6 = true; 2625 use_ipv6 = true;
2628 } 2626 }
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 17fc76e5b05e..2a5dbcc90d1c 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -1128,6 +1128,27 @@ static inline unsigned long nla_get_msecs(const struct nlattr *nla)
1128} 1128}
1129 1129
1130/** 1130/**
1131 * nla_get_in_addr - return payload of IPv4 address attribute
1132 * @nla: IPv4 address netlink attribute
1133 */
1134static inline __be32 nla_get_in_addr(const struct nlattr *nla)
1135{
1136 return *(__be32 *) nla_data(nla);
1137}
1138
1139/**
1140 * nla_get_in6_addr - return payload of IPv6 address attribute
1141 * @nla: IPv6 address netlink attribute
1142 */
1143static inline struct in6_addr nla_get_in6_addr(const struct nlattr *nla)
1144{
1145 struct in6_addr tmp;
1146
1147 nla_memcpy(&tmp, nla, sizeof(tmp));
1148 return tmp;
1149}
1150
1151/**
1131 * nla_nest_start - Start a new level of nested attributes 1152 * nla_nest_start - Start a new level of nested attributes
1132 * @skb: socket buffer to add attributes to 1153 * @skb: socket buffer to add attributes to
1133 * @attrtype: attribute type of container 1154 * @attrtype: attribute type of container
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 66cd85973056..c6473f365ad1 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -593,7 +593,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
593 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL; 593 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
594 ifap = &ifa->ifa_next) { 594 ifap = &ifa->ifa_next) {
595 if (tb[IFA_LOCAL] && 595 if (tb[IFA_LOCAL] &&
596 ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL])) 596 ifa->ifa_local != nla_get_in_addr(tb[IFA_LOCAL]))
597 continue; 597 continue;
598 598
599 if (tb[IFA_LABEL] && nla_strcmp(tb[IFA_LABEL], ifa->ifa_label)) 599 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)
601 601
602 if (tb[IFA_ADDRESS] && 602 if (tb[IFA_ADDRESS] &&
603 (ifm->ifa_prefixlen != ifa->ifa_prefixlen || 603 (ifm->ifa_prefixlen != ifa->ifa_prefixlen ||
604 !inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa))) 604 !inet_ifa_match(nla_get_in_addr(tb[IFA_ADDRESS]), ifa)))
605 continue; 605 continue;
606 606
607 if (ipv4_is_multicast(ifa->ifa_address)) 607 if (ipv4_is_multicast(ifa->ifa_address))
@@ -791,11 +791,11 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
791 ifa->ifa_scope = ifm->ifa_scope; 791 ifa->ifa_scope = ifm->ifa_scope;
792 ifa->ifa_dev = in_dev; 792 ifa->ifa_dev = in_dev;
793 793
794 ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]); 794 ifa->ifa_local = nla_get_in_addr(tb[IFA_LOCAL]);
795 ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]); 795 ifa->ifa_address = nla_get_in_addr(tb[IFA_ADDRESS]);
796 796
797 if (tb[IFA_BROADCAST]) 797 if (tb[IFA_BROADCAST])
798 ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]); 798 ifa->ifa_broadcast = nla_get_in_addr(tb[IFA_BROADCAST]);
799 799
800 if (tb[IFA_LABEL]) 800 if (tb[IFA_LABEL])
801 nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ); 801 nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index edfea0deec43..8162dd8e86d7 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -194,10 +194,10 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
194 } 194 }
195 195
196 if (frh->src_len) 196 if (frh->src_len)
197 rule4->src = nla_get_be32(tb[FRA_SRC]); 197 rule4->src = nla_get_in_addr(tb[FRA_SRC]);
198 198
199 if (frh->dst_len) 199 if (frh->dst_len)
200 rule4->dst = nla_get_be32(tb[FRA_DST]); 200 rule4->dst = nla_get_in_addr(tb[FRA_DST]);
201 201
202#ifdef CONFIG_IP_ROUTE_CLASSID 202#ifdef CONFIG_IP_ROUTE_CLASSID
203 if (tb[FRA_FLOW]) { 203 if (tb[FRA_FLOW]) {
@@ -260,10 +260,10 @@ static int fib4_rule_compare(struct fib_rule *rule, struct fib_rule_hdr *frh,
260 return 0; 260 return 0;
261#endif 261#endif
262 262
263 if (frh->src_len && (rule4->src != nla_get_be32(tb[FRA_SRC]))) 263 if (frh->src_len && (rule4->src != nla_get_in_addr(tb[FRA_SRC])))
264 return 0; 264 return 0;
265 265
266 if (frh->dst_len && (rule4->dst != nla_get_be32(tb[FRA_DST]))) 266 if (frh->dst_len && (rule4->dst != nla_get_in_addr(tb[FRA_DST])))
267 return 0; 267 return 0;
268 268
269 return 1; 269 return 1;
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 453b24e5322c..eac5aec7772a 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -468,7 +468,7 @@ static int fib_get_nhs(struct fib_info *fi, struct rtnexthop *rtnh,
468 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); 468 struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
469 469
470 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 470 nla = nla_find(attrs, attrlen, RTA_GATEWAY);
471 nexthop_nh->nh_gw = nla ? nla_get_be32(nla) : 0; 471 nexthop_nh->nh_gw = nla ? nla_get_in_addr(nla) : 0;
472#ifdef CONFIG_IP_ROUTE_CLASSID 472#ifdef CONFIG_IP_ROUTE_CLASSID
473 nla = nla_find(attrs, attrlen, RTA_FLOW); 473 nla = nla_find(attrs, attrlen, RTA_FLOW);
474 nexthop_nh->nh_tclassid = nla ? nla_get_u32(nla) : 0; 474 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)
523 struct nlattr *nla, *attrs = rtnh_attrs(rtnh); 523 struct nlattr *nla, *attrs = rtnh_attrs(rtnh);
524 524
525 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 525 nla = nla_find(attrs, attrlen, RTA_GATEWAY);
526 if (nla && nla_get_be32(nla) != nh->nh_gw) 526 if (nla && nla_get_in_addr(nla) != nh->nh_gw)
527 return 1; 527 return 1;
528#ifdef CONFIG_IP_ROUTE_CLASSID 528#ifdef CONFIG_IP_ROUTE_CLASSID
529 nla = nla_find(attrs, attrlen, RTA_FLOW); 529 nla = nla_find(attrs, attrlen, RTA_FLOW);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 2e878df46075..0eb2a040a830 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -621,10 +621,10 @@ static void ipgre_netlink_parms(struct nlattr *data[], struct nlattr *tb[],
621 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]); 621 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]);
622 622
623 if (data[IFLA_GRE_LOCAL]) 623 if (data[IFLA_GRE_LOCAL])
624 parms->iph.saddr = nla_get_be32(data[IFLA_GRE_LOCAL]); 624 parms->iph.saddr = nla_get_in_addr(data[IFLA_GRE_LOCAL]);
625 625
626 if (data[IFLA_GRE_REMOTE]) 626 if (data[IFLA_GRE_REMOTE])
627 parms->iph.daddr = nla_get_be32(data[IFLA_GRE_REMOTE]); 627 parms->iph.daddr = nla_get_in_addr(data[IFLA_GRE_REMOTE]);
628 628
629 if (data[IFLA_GRE_TTL]) 629 if (data[IFLA_GRE_TTL])
630 parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]); 630 parms->iph.ttl = nla_get_u8(data[IFLA_GRE_TTL]);
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index f189f2a8aaa5..5a6e27054f0a 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -456,10 +456,10 @@ static void vti_netlink_parms(struct nlattr *data[],
456 parms->o_key = nla_get_be32(data[IFLA_VTI_OKEY]); 456 parms->o_key = nla_get_be32(data[IFLA_VTI_OKEY]);
457 457
458 if (data[IFLA_VTI_LOCAL]) 458 if (data[IFLA_VTI_LOCAL])
459 parms->iph.saddr = nla_get_be32(data[IFLA_VTI_LOCAL]); 459 parms->iph.saddr = nla_get_in_addr(data[IFLA_VTI_LOCAL]);
460 460
461 if (data[IFLA_VTI_REMOTE]) 461 if (data[IFLA_VTI_REMOTE])
462 parms->iph.daddr = nla_get_be32(data[IFLA_VTI_REMOTE]); 462 parms->iph.daddr = nla_get_in_addr(data[IFLA_VTI_REMOTE]);
463 463
464} 464}
465 465
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 17df8d38bbbd..bfbcc85c02ee 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -325,10 +325,10 @@ static void ipip_netlink_parms(struct nlattr *data[],
325 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]); 325 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
326 326
327 if (data[IFLA_IPTUN_LOCAL]) 327 if (data[IFLA_IPTUN_LOCAL])
328 parms->iph.saddr = nla_get_be32(data[IFLA_IPTUN_LOCAL]); 328 parms->iph.saddr = nla_get_in_addr(data[IFLA_IPTUN_LOCAL]);
329 329
330 if (data[IFLA_IPTUN_REMOTE]) 330 if (data[IFLA_IPTUN_REMOTE])
331 parms->iph.daddr = nla_get_be32(data[IFLA_IPTUN_REMOTE]); 331 parms->iph.daddr = nla_get_in_addr(data[IFLA_IPTUN_REMOTE]);
332 332
333 if (data[IFLA_IPTUN_TTL]) { 333 if (data[IFLA_IPTUN_TTL]) {
334 parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]); 334 parms->iph.ttl = nla_get_u8(data[IFLA_IPTUN_TTL]);
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
index b36ebfc6b812..8c8d6642cbb0 100644
--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
@@ -342,8 +342,8 @@ static int ipv4_nlattr_to_tuple(struct nlattr *tb[],
342 if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST]) 342 if (!tb[CTA_IP_V4_SRC] || !tb[CTA_IP_V4_DST])
343 return -EINVAL; 343 return -EINVAL;
344 344
345 t->src.u3.ip = nla_get_be32(tb[CTA_IP_V4_SRC]); 345 t->src.u3.ip = nla_get_in_addr(tb[CTA_IP_V4_SRC]);
346 t->dst.u3.ip = nla_get_be32(tb[CTA_IP_V4_DST]); 346 t->dst.u3.ip = nla_get_in_addr(tb[CTA_IP_V4_DST]);
347 347
348 return 0; 348 return 0;
349} 349}
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1f147204f1f3..652b92ebd7ba 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2436,8 +2436,8 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
2436 ip_hdr(skb)->protocol = IPPROTO_ICMP; 2436 ip_hdr(skb)->protocol = IPPROTO_ICMP;
2437 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr)); 2437 skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
2438 2438
2439 src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0; 2439 src = tb[RTA_SRC] ? nla_get_in_addr(tb[RTA_SRC]) : 0;
2440 dst = tb[RTA_DST] ? nla_get_be32(tb[RTA_DST]) : 0; 2440 dst = tb[RTA_DST] ? nla_get_in_addr(tb[RTA_DST]) : 0;
2441 iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0; 2441 iif = tb[RTA_IIF] ? nla_get_u32(tb[RTA_IIF]) : 0;
2442 mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0; 2442 mark = tb[RTA_MARK] ? nla_get_u32(tb[RTA_MARK]) : 0;
2443 2443
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 32e36ea6bc0f..71ec14c87579 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -948,7 +948,7 @@ static int __parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
948 a = info->attrs[v4]; 948 a = info->attrs[v4];
949 if (a) { 949 if (a) {
950 addr->family = AF_INET; 950 addr->family = AF_INET;
951 addr->addr.a4 = nla_get_be32(a); 951 addr->addr.a4 = nla_get_in_addr(a);
952 if (hash) 952 if (hash)
953 *hash = (__force unsigned int) addr->addr.a4; 953 *hash = (__force unsigned int) addr->addr.a4;
954 return 0; 954 return 0;
@@ -958,7 +958,7 @@ static int __parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr,
958 if (nla_len(a) != sizeof(struct in6_addr)) 958 if (nla_len(a) != sizeof(struct in6_addr))
959 return -EINVAL; 959 return -EINVAL;
960 addr->family = AF_INET6; 960 addr->family = AF_INET6;
961 memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); 961 addr->addr.in6 = nla_get_in6_addr(a);
962 if (hash) 962 if (hash)
963 *hash = ipv6_addr_hash(&addr->addr.in6); 963 *hash = ipv6_addr_hash(&addr->addr.in6);
964 return 0; 964 return 0;
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index d313bfd88512..61fb184b818d 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -199,12 +199,10 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,
199 } 199 }
200 200
201 if (frh->src_len) 201 if (frh->src_len)
202 nla_memcpy(&rule6->src.addr, tb[FRA_SRC], 202 rule6->src.addr = nla_get_in6_addr(tb[FRA_SRC]);
203 sizeof(struct in6_addr));
204 203
205 if (frh->dst_len) 204 if (frh->dst_len)
206 nla_memcpy(&rule6->dst.addr, tb[FRA_DST], 205 rule6->dst.addr = nla_get_in6_addr(tb[FRA_DST]);
207 sizeof(struct in6_addr));
208 206
209 rule6->src.plen = frh->src_len; 207 rule6->src.plen = frh->src_len;
210 rule6->dst.plen = frh->dst_len; 208 rule6->dst.plen = frh->dst_len;
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
index f61f7ad2d045..0f4e73da14e4 100644
--- a/net/ipv6/ip6_gre.c
+++ b/net/ipv6/ip6_gre.c
@@ -1412,7 +1412,7 @@ static int ip6gre_tap_validate(struct nlattr *tb[], struct nlattr *data[])
1412 goto out; 1412 goto out;
1413 1413
1414 if (data[IFLA_GRE_REMOTE]) { 1414 if (data[IFLA_GRE_REMOTE]) {
1415 nla_memcpy(&daddr, data[IFLA_GRE_REMOTE], sizeof(struct in6_addr)); 1415 daddr = nla_get_in6_addr(data[IFLA_GRE_REMOTE]);
1416 if (ipv6_addr_any(&daddr)) 1416 if (ipv6_addr_any(&daddr))
1417 return -EINVAL; 1417 return -EINVAL;
1418 } 1418 }
@@ -1446,10 +1446,10 @@ static void ip6gre_netlink_parms(struct nlattr *data[],
1446 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]); 1446 parms->o_key = nla_get_be32(data[IFLA_GRE_OKEY]);
1447 1447
1448 if (data[IFLA_GRE_LOCAL]) 1448 if (data[IFLA_GRE_LOCAL])
1449 nla_memcpy(&parms->laddr, data[IFLA_GRE_LOCAL], sizeof(struct in6_addr)); 1449 parms->laddr = nla_get_in6_addr(data[IFLA_GRE_LOCAL]);
1450 1450
1451 if (data[IFLA_GRE_REMOTE]) 1451 if (data[IFLA_GRE_REMOTE])
1452 nla_memcpy(&parms->raddr, data[IFLA_GRE_REMOTE], sizeof(struct in6_addr)); 1452 parms->raddr = nla_get_in6_addr(data[IFLA_GRE_REMOTE]);
1453 1453
1454 if (data[IFLA_GRE_TTL]) 1454 if (data[IFLA_GRE_TTL])
1455 parms->hop_limit = nla_get_u8(data[IFLA_GRE_TTL]); 1455 parms->hop_limit = nla_get_u8(data[IFLA_GRE_TTL]);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 80543d13ea7c..9bd85f0dff69 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -1640,12 +1640,10 @@ static void ip6_tnl_netlink_parms(struct nlattr *data[],
1640 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]); 1640 parms->link = nla_get_u32(data[IFLA_IPTUN_LINK]);
1641 1641
1642 if (data[IFLA_IPTUN_LOCAL]) 1642 if (data[IFLA_IPTUN_LOCAL])
1643 nla_memcpy(&parms->laddr, data[IFLA_IPTUN_LOCAL], 1643 parms->laddr = nla_get_in6_addr(data[IFLA_IPTUN_LOCAL]);
1644 sizeof(struct in6_addr));
1645 1644
1646 if (data[IFLA_IPTUN_REMOTE]) 1645 if (data[IFLA_IPTUN_REMOTE])
1647 nla_memcpy(&parms->raddr, data[IFLA_IPTUN_REMOTE], 1646 parms->raddr = nla_get_in6_addr(data[IFLA_IPTUN_REMOTE]);
1648 sizeof(struct in6_addr));
1649 1647
1650 if (data[IFLA_IPTUN_TTL]) 1648 if (data[IFLA_IPTUN_TTL])
1651 parms->hop_limit = nla_get_u8(data[IFLA_IPTUN_TTL]); 1649 parms->hop_limit = nla_get_u8(data[IFLA_IPTUN_TTL]);
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index 87a262b0f07b..53d90ed68905 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -897,12 +897,10 @@ static void vti6_netlink_parms(struct nlattr *data[],
897 parms->link = nla_get_u32(data[IFLA_VTI_LINK]); 897 parms->link = nla_get_u32(data[IFLA_VTI_LINK]);
898 898
899 if (data[IFLA_VTI_LOCAL]) 899 if (data[IFLA_VTI_LOCAL])
900 nla_memcpy(&parms->laddr, data[IFLA_VTI_LOCAL], 900 parms->laddr = nla_get_in6_addr(data[IFLA_VTI_LOCAL]);
901 sizeof(struct in6_addr));
902 901
903 if (data[IFLA_VTI_REMOTE]) 902 if (data[IFLA_VTI_REMOTE])
904 nla_memcpy(&parms->raddr, data[IFLA_VTI_REMOTE], 903 parms->raddr = nla_get_in6_addr(data[IFLA_VTI_REMOTE]);
905 sizeof(struct in6_addr));
906 904
907 if (data[IFLA_VTI_IKEY]) 905 if (data[IFLA_VTI_IKEY])
908 parms->i_key = nla_get_be32(data[IFLA_VTI_IKEY]); 906 parms->i_key = nla_get_be32(data[IFLA_VTI_IKEY]);
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index 78284a697439..fba91c6fc7ca 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -310,10 +310,8 @@ static int ipv6_nlattr_to_tuple(struct nlattr *tb[],
310 if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST]) 310 if (!tb[CTA_IP_V6_SRC] || !tb[CTA_IP_V6_DST])
311 return -EINVAL; 311 return -EINVAL;
312 312
313 memcpy(&t->src.u3.ip6, nla_data(tb[CTA_IP_V6_SRC]), 313 t->src.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_SRC]);
314 sizeof(u_int32_t) * 4); 314 t->dst.u3.in6 = nla_get_in6_addr(tb[CTA_IP_V6_DST]);
315 memcpy(&t->dst.u3.ip6, nla_data(tb[CTA_IP_V6_DST]),
316 sizeof(u_int32_t) * 4);
317 315
318 return 0; 316 return 0;
319} 317}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 385e9bd4f218..5c48293ff062 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2438,7 +2438,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
2438 cfg->fc_nlinfo.nl_net = sock_net(skb->sk); 2438 cfg->fc_nlinfo.nl_net = sock_net(skb->sk);
2439 2439
2440 if (tb[RTA_GATEWAY]) { 2440 if (tb[RTA_GATEWAY]) {
2441 nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16); 2441 cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
2442 cfg->fc_flags |= RTF_GATEWAY; 2442 cfg->fc_flags |= RTF_GATEWAY;
2443 } 2443 }
2444 2444
@@ -2461,7 +2461,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
2461 } 2461 }
2462 2462
2463 if (tb[RTA_PREFSRC]) 2463 if (tb[RTA_PREFSRC])
2464 nla_memcpy(&cfg->fc_prefsrc, tb[RTA_PREFSRC], 16); 2464 cfg->fc_prefsrc = nla_get_in6_addr(tb[RTA_PREFSRC]);
2465 2465
2466 if (tb[RTA_OIF]) 2466 if (tb[RTA_OIF])
2467 cfg->fc_ifindex = nla_get_u32(tb[RTA_OIF]); 2467 cfg->fc_ifindex = nla_get_u32(tb[RTA_OIF]);
@@ -2519,7 +2519,7 @@ beginning:
2519 2519
2520 nla = nla_find(attrs, attrlen, RTA_GATEWAY); 2520 nla = nla_find(attrs, attrlen, RTA_GATEWAY);
2521 if (nla) { 2521 if (nla) {
2522 nla_memcpy(&r_cfg.fc_gateway, nla, 16); 2522 r_cfg.fc_gateway = nla_get_in6_addr(nla);
2523 r_cfg.fc_flags |= RTF_GATEWAY; 2523 r_cfg.fc_flags |= RTF_GATEWAY;
2524 } 2524 }
2525 } 2525 }
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 0e2bb538a556..e6b9f51b15e8 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1530,8 +1530,7 @@ static bool ipip6_netlink_6rd_parms(struct nlattr *data[],
1530 1530
1531 if (data[IFLA_IPTUN_6RD_PREFIX]) { 1531 if (data[IFLA_IPTUN_6RD_PREFIX]) {
1532 ret = true; 1532 ret = true;
1533 nla_memcpy(&ip6rd->prefix, data[IFLA_IPTUN_6RD_PREFIX], 1533 ip6rd->prefix = nla_get_in6_addr(data[IFLA_IPTUN_6RD_PREFIX]);
1534 sizeof(struct in6_addr));
1535 } 1534 }
1536 1535
1537 if (data[IFLA_IPTUN_6RD_RELAY_PREFIX]) { 1536 if (data[IFLA_IPTUN_6RD_RELAY_PREFIX]) {
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index a4f78d36bace..9e13c2ff8789 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -205,9 +205,9 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
205#endif 205#endif
206 if (info->attrs[L2TP_ATTR_IP_SADDR] && 206 if (info->attrs[L2TP_ATTR_IP_SADDR] &&
207 info->attrs[L2TP_ATTR_IP_DADDR]) { 207 info->attrs[L2TP_ATTR_IP_DADDR]) {
208 cfg.local_ip.s_addr = nla_get_be32( 208 cfg.local_ip.s_addr = nla_get_in_addr(
209 info->attrs[L2TP_ATTR_IP_SADDR]); 209 info->attrs[L2TP_ATTR_IP_SADDR]);
210 cfg.peer_ip.s_addr = nla_get_be32( 210 cfg.peer_ip.s_addr = nla_get_in_addr(
211 info->attrs[L2TP_ATTR_IP_DADDR]); 211 info->attrs[L2TP_ATTR_IP_DADDR]);
212 } else { 212 } else {
213 ret = -EINVAL; 213 ret = -EINVAL;
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index c0c5b5519f45..c691b1a1eee0 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -535,11 +535,11 @@ static int ipv4_tun_from_nlattr(const struct nlattr *attr,
535 break; 535 break;
536 case OVS_TUNNEL_KEY_ATTR_IPV4_SRC: 536 case OVS_TUNNEL_KEY_ATTR_IPV4_SRC:
537 SW_FLOW_KEY_PUT(match, tun_key.ipv4_src, 537 SW_FLOW_KEY_PUT(match, tun_key.ipv4_src,
538 nla_get_be32(a), is_mask); 538 nla_get_in_addr(a), is_mask);
539 break; 539 break;
540 case OVS_TUNNEL_KEY_ATTR_IPV4_DST: 540 case OVS_TUNNEL_KEY_ATTR_IPV4_DST:
541 SW_FLOW_KEY_PUT(match, tun_key.ipv4_dst, 541 SW_FLOW_KEY_PUT(match, tun_key.ipv4_dst,
542 nla_get_be32(a), is_mask); 542 nla_get_in_addr(a), is_mask);
543 break; 543 break;
544 case OVS_TUNNEL_KEY_ATTR_TOS: 544 case OVS_TUNNEL_KEY_ATTR_TOS:
545 SW_FLOW_KEY_PUT(match, tun_key.ipv4_tos, 545 SW_FLOW_KEY_PUT(match, tun_key.ipv4_tos,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 6a4a4d7db1fc..2fb804bfa361 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8993,8 +8993,8 @@ static int nl80211_parse_wowlan_tcp(struct cfg80211_registered_device *rdev,
8993 cfg = kzalloc(size, GFP_KERNEL); 8993 cfg = kzalloc(size, GFP_KERNEL);
8994 if (!cfg) 8994 if (!cfg)
8995 return -ENOMEM; 8995 return -ENOMEM;
8996 cfg->src = nla_get_be32(tb[NL80211_WOWLAN_TCP_SRC_IPV4]); 8996 cfg->src = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_SRC_IPV4]);
8997 cfg->dst = nla_get_be32(tb[NL80211_WOWLAN_TCP_DST_IPV4]); 8997 cfg->dst = nla_get_in_addr(tb[NL80211_WOWLAN_TCP_DST_IPV4]);
8998 memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]), 8998 memcpy(cfg->dst_mac, nla_data(tb[NL80211_WOWLAN_TCP_DST_MAC]),
8999 ETH_ALEN); 8999 ETH_ALEN);
9000 if (tb[NL80211_WOWLAN_TCP_SRC_PORT]) 9000 if (tb[NL80211_WOWLAN_TCP_SRC_PORT])