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
@@ -1127,6 +1127,27 @@ static inline unsigned long nla_get_msecs(const struct nlattr *nla)
|
||||
return msecs_to_jiffies((unsigned long) msecs);
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_get_in_addr - return payload of IPv4 address attribute
|
||||
* @nla: IPv4 address netlink attribute
|
||||
*/
|
||||
static inline __be32 nla_get_in_addr(const struct nlattr *nla)
|
||||
{
|
||||
return *(__be32 *) nla_data(nla);
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_get_in6_addr - return payload of IPv6 address attribute
|
||||
* @nla: IPv6 address netlink attribute
|
||||
*/
|
||||
static inline struct in6_addr nla_get_in6_addr(const struct nlattr *nla)
|
||||
{
|
||||
struct in6_addr tmp;
|
||||
|
||||
nla_memcpy(&tmp, nla, sizeof(tmp));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* nla_nest_start - Start a new level of nested attributes
|
||||
* @skb: socket buffer to add attributes to
|
||||
|
Reference in New Issue
Block a user