diff options
author | Jiri Benc <jbenc@redhat.com> | 2015-03-29 10:59:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 13:58:35 -0400 |
commit | 67b61f6c130a05b2cd4c3dfded49a751ff42c534 (patch) | |
tree | 2a4deef870f2c01f36a27cfb7501e726d833880c /net/ipv6 | |
parent | 930345ea630405aa6e6f42efcb149c3f360a6b67 (diff) |
netlink: implement nla_get_in_addr and nla_get_in6_addr
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>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/fib6_rules.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_gre.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 6 | ||||
-rw-r--r-- | net/ipv6/ip6_vti.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 6 | ||||
-rw-r--r-- | net/ipv6/route.c | 6 | ||||
-rw-r--r-- | net/ipv6/sit.c | 3 |
7 files changed, 15 insertions, 24 deletions
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]) { |