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>
This commit is contained in:

committed by
David S. Miller

parent
930345ea63
commit
67b61f6c13
@@ -593,7 +593,7 @@ static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
|
||||
ifap = &ifa->ifa_next) {
|
||||
if (tb[IFA_LOCAL] &&
|
||||
ifa->ifa_local != nla_get_be32(tb[IFA_LOCAL]))
|
||||
ifa->ifa_local != nla_get_in_addr(tb[IFA_LOCAL]))
|
||||
continue;
|
||||
|
||||
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)
|
||||
|
||||
if (tb[IFA_ADDRESS] &&
|
||||
(ifm->ifa_prefixlen != ifa->ifa_prefixlen ||
|
||||
!inet_ifa_match(nla_get_be32(tb[IFA_ADDRESS]), ifa)))
|
||||
!inet_ifa_match(nla_get_in_addr(tb[IFA_ADDRESS]), ifa)))
|
||||
continue;
|
||||
|
||||
if (ipv4_is_multicast(ifa->ifa_address))
|
||||
@@ -791,11 +791,11 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh,
|
||||
ifa->ifa_scope = ifm->ifa_scope;
|
||||
ifa->ifa_dev = in_dev;
|
||||
|
||||
ifa->ifa_local = nla_get_be32(tb[IFA_LOCAL]);
|
||||
ifa->ifa_address = nla_get_be32(tb[IFA_ADDRESS]);
|
||||
ifa->ifa_local = nla_get_in_addr(tb[IFA_LOCAL]);
|
||||
ifa->ifa_address = nla_get_in_addr(tb[IFA_ADDRESS]);
|
||||
|
||||
if (tb[IFA_BROADCAST])
|
||||
ifa->ifa_broadcast = nla_get_be32(tb[IFA_BROADCAST]);
|
||||
ifa->ifa_broadcast = nla_get_in_addr(tb[IFA_BROADCAST]);
|
||||
|
||||
if (tb[IFA_LABEL])
|
||||
nla_strlcpy(ifa->ifa_label, tb[IFA_LABEL], IFNAMSIZ);
|
||||
|
Reference in New Issue
Block a user