Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41867
b: refs/heads/master
c: e94ef68
h: refs/heads/master
i:
  41865: bf4e76b
  41863: 4995579
v: v3
  • Loading branch information
Thomas Graf authored and David S. Miller committed Dec 3, 2006
1 parent 5f70bb5 commit bc77edd
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 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: cdbc6dae5cc90d7d9e109e7d0568979d5355b653
refs/heads/master: e94ef682053a6eeca91aefdaecf8efe7fd7e33a5
47 changes: 25 additions & 22 deletions trunk/net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,7 @@ static struct genl_family genl_ctrl = {
static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
u32 flags, struct sk_buff *skb, u8 cmd)
{
struct nlattr *nla_ops;
struct genl_ops *ops;
void *hdr;
int idx = 1;

hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd);
if (hdr == NULL)
Expand All @@ -409,33 +406,39 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
NLA_PUT_U32(skb, CTRL_ATTR_HDRSIZE, family->hdrsize);
NLA_PUT_U32(skb, CTRL_ATTR_MAXATTR, family->maxattr);

nla_ops = nla_nest_start(skb, CTRL_ATTR_OPS);
if (nla_ops == NULL)
goto nla_put_failure;

list_for_each_entry(ops, &family->ops_list, ops_list) {
struct nlattr *nest;
if (!list_empty(&family->ops_list)) {
struct nlattr *nla_ops;
struct genl_ops *ops;
int idx = 1;

nest = nla_nest_start(skb, idx++);
if (nest == NULL)
nla_ops = nla_nest_start(skb, CTRL_ATTR_OPS);
if (nla_ops == NULL)
goto nla_put_failure;

NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd);
NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags);
list_for_each_entry(ops, &family->ops_list, ops_list) {
struct nlattr *nest;

if (ops->policy)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_POLICY);
nest = nla_nest_start(skb, idx++);
if (nest == NULL)
goto nla_put_failure;

if (ops->doit)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DOIT);
NLA_PUT_U32(skb, CTRL_ATTR_OP_ID, ops->cmd);
NLA_PUT_U32(skb, CTRL_ATTR_OP_FLAGS, ops->flags);

if (ops->dumpit)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DUMPIT);
if (ops->policy)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_POLICY);

nla_nest_end(skb, nest);
}
if (ops->doit)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DOIT);

if (ops->dumpit)
NLA_PUT_FLAG(skb, CTRL_ATTR_OP_DUMPIT);

nla_nest_end(skb, nla_ops);
nla_nest_end(skb, nest);
}

nla_nest_end(skb, nla_ops);
}

return genlmsg_end(skb, hdr);

Expand Down

0 comments on commit bc77edd

Please sign in to comment.