aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 46cd941d296f..052f99eaf2ac 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3518,16 +3518,18 @@ static inline size_t inet6_prefix_nlmsg_size(void)
3518} 3518}
3519 3519
3520static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev, 3520static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3521 struct prefix_info *pinfo, u32 pid, u32 seq, 3521 struct prefix_info *pinfo, u32 pid, u32 seq,
3522 int event, unsigned int flags) 3522 int event, unsigned int flags)
3523{ 3523{
3524 struct prefixmsg *pmsg; 3524 struct prefixmsg *pmsg;
3525 struct nlmsghdr *nlh; 3525 struct nlmsghdr *nlh;
3526 unsigned char *b = skb->tail;
3527 struct prefix_cacheinfo ci; 3526 struct prefix_cacheinfo ci;
3528 3527
3529 nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*pmsg), flags); 3528 nlh = nlmsg_put(skb, pid, seq, event, sizeof(*pmsg), flags);
3530 pmsg = NLMSG_DATA(nlh); 3529 if (nlh == NULL)
3530 return -ENOBUFS;
3531
3532 pmsg = nlmsg_data(nlh);
3531 pmsg->prefix_family = AF_INET6; 3533 pmsg->prefix_family = AF_INET6;
3532 pmsg->prefix_pad1 = 0; 3534 pmsg->prefix_pad1 = 0;
3533 pmsg->prefix_pad2 = 0; 3535 pmsg->prefix_pad2 = 0;
@@ -3535,26 +3537,22 @@ static int inet6_fill_prefix(struct sk_buff *skb, struct inet6_dev *idev,
3535 pmsg->prefix_len = pinfo->prefix_len; 3537 pmsg->prefix_len = pinfo->prefix_len;
3536 pmsg->prefix_type = pinfo->type; 3538 pmsg->prefix_type = pinfo->type;
3537 pmsg->prefix_pad3 = 0; 3539 pmsg->prefix_pad3 = 0;
3538
3539 pmsg->prefix_flags = 0; 3540 pmsg->prefix_flags = 0;
3540 if (pinfo->onlink) 3541 if (pinfo->onlink)
3541 pmsg->prefix_flags |= IF_PREFIX_ONLINK; 3542 pmsg->prefix_flags |= IF_PREFIX_ONLINK;
3542 if (pinfo->autoconf) 3543 if (pinfo->autoconf)
3543 pmsg->prefix_flags |= IF_PREFIX_AUTOCONF; 3544 pmsg->prefix_flags |= IF_PREFIX_AUTOCONF;
3544 3545
3545 RTA_PUT(skb, PREFIX_ADDRESS, sizeof(pinfo->prefix), &pinfo->prefix); 3546 NLA_PUT(skb, PREFIX_ADDRESS, sizeof(pinfo->prefix), &pinfo->prefix);
3546 3547
3547 ci.preferred_time = ntohl(pinfo->prefered); 3548 ci.preferred_time = ntohl(pinfo->prefered);
3548 ci.valid_time = ntohl(pinfo->valid); 3549 ci.valid_time = ntohl(pinfo->valid);
3549 RTA_PUT(skb, PREFIX_CACHEINFO, sizeof(ci), &ci); 3550 NLA_PUT(skb, PREFIX_CACHEINFO, sizeof(ci), &ci);
3550 3551
3551 nlh->nlmsg_len = skb->tail - b; 3552 return nlmsg_end(skb, nlh);
3552 return skb->len;
3553 3553
3554nlmsg_failure: 3554nla_put_failure:
3555rtattr_failure: 3555 return nlmsg_cancel(skb, nlh);
3556 skb_trim(skb, b - skb->data);
3557 return -1;
3558} 3556}
3559 3557
3560static void inet6_prefix_notify(int event, struct inet6_dev *idev, 3558static void inet6_prefix_notify(int event, struct inet6_dev *idev,