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>
Esse commit está contido em:
@@ -1049,8 +1049,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
|
||||
|
||||
memcpy(ndmsg + 1, opt, opt->nd_opt_len << 3);
|
||||
|
||||
if (nla_put(skb, NDUSEROPT_SRCADDR, sizeof(struct in6_addr),
|
||||
&ipv6_hdr(ra)->saddr))
|
||||
if (nla_put_in6_addr(skb, NDUSEROPT_SRCADDR, &ipv6_hdr(ra)->saddr))
|
||||
goto nla_put_failure;
|
||||
nlmsg_end(skb, nlh);
|
||||
|
||||
|
Referência em uma nova issue
Block a user