Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34419
b: refs/heads/master
c: 47f6851
h: refs/heads/master
i:
  34417: d621dac
  34415: aae9675
v: v3
  • Loading branch information
Thomas Graf authored and David S. Miller committed Sep 22, 2006
1 parent 8b2f17a commit 754c332
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dfdd5fd4e93d98e06be9ac9db84e3b98c6c26706
refs/heads/master: 47f68512d2685431f1781830dfcbab31bda87644
42 changes: 23 additions & 19 deletions trunk/net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1112,32 +1112,37 @@ static int inet_fill_ifaddr(struct sk_buff *skb, struct in_ifaddr *ifa,
{
struct ifaddrmsg *ifm;
struct nlmsghdr *nlh;
unsigned char *b = skb->tail;

nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*ifm), flags);
ifm = NLMSG_DATA(nlh);
nlh = nlmsg_put(skb, pid, seq, event, sizeof(*ifm), flags);
if (nlh == NULL)
return -ENOBUFS;

ifm = nlmsg_data(nlh);
ifm->ifa_family = AF_INET;
ifm->ifa_prefixlen = ifa->ifa_prefixlen;
ifm->ifa_flags = ifa->ifa_flags|IFA_F_PERMANENT;
ifm->ifa_scope = ifa->ifa_scope;
ifm->ifa_index = ifa->ifa_dev->dev->ifindex;

if (ifa->ifa_address)
RTA_PUT(skb, IFA_ADDRESS, 4, &ifa->ifa_address);
NLA_PUT_U32(skb, IFA_ADDRESS, ifa->ifa_address);

if (ifa->ifa_local)
RTA_PUT(skb, IFA_LOCAL, 4, &ifa->ifa_local);
NLA_PUT_U32(skb, IFA_LOCAL, ifa->ifa_local);

if (ifa->ifa_broadcast)
RTA_PUT(skb, IFA_BROADCAST, 4, &ifa->ifa_broadcast);
NLA_PUT_U32(skb, IFA_BROADCAST, ifa->ifa_broadcast);

if (ifa->ifa_anycast)
RTA_PUT(skb, IFA_ANYCAST, 4, &ifa->ifa_anycast);
NLA_PUT_U32(skb, IFA_ANYCAST, ifa->ifa_anycast);

if (ifa->ifa_label[0])
RTA_PUT(skb, IFA_LABEL, IFNAMSIZ, &ifa->ifa_label);
nlh->nlmsg_len = skb->tail - b;
return skb->len;
NLA_PUT_STRING(skb, IFA_LABEL, ifa->ifa_label);

return nlmsg_end(skb, nlh);

nlmsg_failure:
rtattr_failure:
skb_trim(skb, b - skb->data);
return -1;
nla_put_failure:
return nlmsg_cancel(skb, nlh);
}

static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
Expand Down Expand Up @@ -1185,17 +1190,16 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)

static void rtmsg_ifa(int event, struct in_ifaddr* ifa)
{
int size = NLMSG_SPACE(sizeof(struct ifaddrmsg) + 128);
struct sk_buff *skb = alloc_skb(size, GFP_KERNEL);
struct sk_buff *skb;

if (!skb)
skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
if (skb == NULL)
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, ENOBUFS);
else if (inet_fill_ifaddr(skb, ifa, 0, 0, event, 0) < 0) {
kfree_skb(skb);
netlink_set_err(rtnl, 0, RTNLGRP_IPV4_IFADDR, EINVAL);
} else {
} else
netlink_broadcast(rtnl, skb, 0, RTNLGRP_IPV4_IFADDR, GFP_KERNEL);
}
}

static struct rtnetlink_link inet_rtnetlink_table[RTM_NR_MSGTYPES] = {
Expand Down

0 comments on commit 754c332

Please sign in to comment.