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/openvswitch | |
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/openvswitch')
-rw-r--r-- | net/openvswitch/flow_netlink.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c index 22b18c145c92..c0c5b5519f45 100644 --- a/net/openvswitch/flow_netlink.c +++ b/net/openvswitch/flow_netlink.c | |||
@@ -648,10 +648,12 @@ static int __ipv4_tun_to_nlattr(struct sk_buff *skb, | |||
648 | nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id)) | 648 | nla_put_be64(skb, OVS_TUNNEL_KEY_ATTR_ID, output->tun_id)) |
649 | return -EMSGSIZE; | 649 | return -EMSGSIZE; |
650 | if (output->ipv4_src && | 650 | if (output->ipv4_src && |
651 | nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_SRC, output->ipv4_src)) | 651 | nla_put_in_addr(skb, OVS_TUNNEL_KEY_ATTR_IPV4_SRC, |
652 | output->ipv4_src)) | ||
652 | return -EMSGSIZE; | 653 | return -EMSGSIZE; |
653 | if (output->ipv4_dst && | 654 | if (output->ipv4_dst && |
654 | nla_put_be32(skb, OVS_TUNNEL_KEY_ATTR_IPV4_DST, output->ipv4_dst)) | 655 | nla_put_in_addr(skb, OVS_TUNNEL_KEY_ATTR_IPV4_DST, |
656 | output->ipv4_dst)) | ||
655 | return -EMSGSIZE; | 657 | return -EMSGSIZE; |
656 | if (output->ipv4_tos && | 658 | if (output->ipv4_tos && |
657 | nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos)) | 659 | nla_put_u8(skb, OVS_TUNNEL_KEY_ATTR_TOS, output->ipv4_tos)) |