aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorJiri Benc <jbenc@redhat.com>2015-03-29 16:59:25 +0200
committerDavid S. Miller <davem@davemloft.net>2015-03-31 13:58:35 -0400
commit930345ea630405aa6e6f42efcb149c3f360a6b67 (patch)
treec88d0858785c246038fddac3ca51571b371416b0 /net/ipv6/route.c
parentxfrm: simplify xfrm_address_t use (diff)
downloadlinux-dev-930345ea630405aa6e6f42efcb149c3f360a6b67.tar.xz
linux-dev-930345ea630405aa6e6f42efcb149c3f360a6b67.zip
netlink: implement nla_put_in_addr and nla_put_in6_addr
IP addresses are often stored in netlink attributes. Add generic functions to do that. For nla_put_in_addr, it would be nicer to pass struct in_addr but this is not used universally throughout the kernel, in way too many places __be32 is used to store IPv4 address. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fe742fa0f7ff..385e9bd4f218 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2669,19 +2669,19 @@ static int rt6_fill_node(struct net *net,
rtm->rtm_flags |= RTM_F_CLONED;
if (dst) {
- if (nla_put(skb, RTA_DST, 16, dst))
+ if (nla_put_in6_addr(skb, RTA_DST, dst))
goto nla_put_failure;
rtm->rtm_dst_len = 128;
} else if (rtm->rtm_dst_len)
- if (nla_put(skb, RTA_DST, 16, &rt->rt6i_dst.addr))
+ if (nla_put_in6_addr(skb, RTA_DST, &rt->rt6i_dst.addr))
goto nla_put_failure;
#ifdef CONFIG_IPV6_SUBTREES
if (src) {
- if (nla_put(skb, RTA_SRC, 16, src))
+ if (nla_put_in6_addr(skb, RTA_SRC, src))
goto nla_put_failure;
rtm->rtm_src_len = 128;
} else if (rtm->rtm_src_len &&
- nla_put(skb, RTA_SRC, 16, &rt->rt6i_src.addr))
+ nla_put_in6_addr(skb, RTA_SRC, &rt->rt6i_src.addr))
goto nla_put_failure;
#endif
if (iif) {
@@ -2705,14 +2705,14 @@ static int rt6_fill_node(struct net *net,
} else if (dst) {
struct in6_addr saddr_buf;
if (ip6_route_get_saddr(net, rt, dst, 0, &saddr_buf) == 0 &&
- nla_put(skb, RTA_PREFSRC, 16, &saddr_buf))
+ nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
goto nla_put_failure;
}
if (rt->rt6i_prefsrc.plen) {
struct in6_addr saddr_buf;
saddr_buf = rt->rt6i_prefsrc.addr;
- if (nla_put(skb, RTA_PREFSRC, 16, &saddr_buf))
+ if (nla_put_in6_addr(skb, RTA_PREFSRC, &saddr_buf))
goto nla_put_failure;
}
@@ -2720,7 +2720,7 @@ static int rt6_fill_node(struct net *net,
goto nla_put_failure;
if (rt->rt6i_flags & RTF_GATEWAY) {
- if (nla_put(skb, RTA_GATEWAY, 16, &rt->rt6i_gateway) < 0)
+ if (nla_put_in6_addr(skb, RTA_GATEWAY, &rt->rt6i_gateway) < 0)
goto nla_put_failure;
}