diff options
author | Jiri Benc <jbenc@redhat.com> | 2015-03-29 10:59:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-31 13:58:35 -0400 |
commit | 930345ea630405aa6e6f42efcb149c3f360a6b67 (patch) | |
tree | c88d0858785c246038fddac3ca51571b371416b0 /net/ipv4/fib_semantics.c | |
parent | 15e318bdc6dfb82914c82fb7ad00badaa8387d8e (diff) |
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/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 66c1e4fbf884..453b24e5322c 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -1015,7 +1015,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1015 | rtm->rtm_protocol = fi->fib_protocol; | 1015 | rtm->rtm_protocol = fi->fib_protocol; |
1016 | 1016 | ||
1017 | if (rtm->rtm_dst_len && | 1017 | if (rtm->rtm_dst_len && |
1018 | nla_put_be32(skb, RTA_DST, dst)) | 1018 | nla_put_in_addr(skb, RTA_DST, dst)) |
1019 | goto nla_put_failure; | 1019 | goto nla_put_failure; |
1020 | if (fi->fib_priority && | 1020 | if (fi->fib_priority && |
1021 | nla_put_u32(skb, RTA_PRIORITY, fi->fib_priority)) | 1021 | nla_put_u32(skb, RTA_PRIORITY, fi->fib_priority)) |
@@ -1024,11 +1024,11 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1024 | goto nla_put_failure; | 1024 | goto nla_put_failure; |
1025 | 1025 | ||
1026 | if (fi->fib_prefsrc && | 1026 | if (fi->fib_prefsrc && |
1027 | nla_put_be32(skb, RTA_PREFSRC, fi->fib_prefsrc)) | 1027 | nla_put_in_addr(skb, RTA_PREFSRC, fi->fib_prefsrc)) |
1028 | goto nla_put_failure; | 1028 | goto nla_put_failure; |
1029 | if (fi->fib_nhs == 1) { | 1029 | if (fi->fib_nhs == 1) { |
1030 | if (fi->fib_nh->nh_gw && | 1030 | if (fi->fib_nh->nh_gw && |
1031 | nla_put_be32(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) | 1031 | nla_put_in_addr(skb, RTA_GATEWAY, fi->fib_nh->nh_gw)) |
1032 | goto nla_put_failure; | 1032 | goto nla_put_failure; |
1033 | if (fi->fib_nh->nh_oif && | 1033 | if (fi->fib_nh->nh_oif && |
1034 | nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) | 1034 | nla_put_u32(skb, RTA_OIF, fi->fib_nh->nh_oif)) |
@@ -1058,7 +1058,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event, | |||
1058 | rtnh->rtnh_ifindex = nh->nh_oif; | 1058 | rtnh->rtnh_ifindex = nh->nh_oif; |
1059 | 1059 | ||
1060 | if (nh->nh_gw && | 1060 | if (nh->nh_gw && |
1061 | nla_put_be32(skb, RTA_GATEWAY, nh->nh_gw)) | 1061 | nla_put_in_addr(skb, RTA_GATEWAY, nh->nh_gw)) |
1062 | goto nla_put_failure; | 1062 | goto nla_put_failure; |
1063 | #ifdef CONFIG_IP_ROUTE_CLASSID | 1063 | #ifdef CONFIG_IP_ROUTE_CLASSID |
1064 | if (nh->nh_tclassid && | 1064 | if (nh->nh_tclassid && |