13 #include <linux/kernel.h>
14 #include <linux/slab.h>
23 static inline size_t br_nlmsg_size(
void)
48 br_debug(br,
"br_fill_info event %d port %s master %s\n",
49 event, dev->
name, br->
dev->name);
51 nlh = nlmsg_put(skb, pid, seq, event,
sizeof(*hdr), flags);
55 hdr = nlmsg_data(nlh);
74 return nlmsg_end(skb, nlh);
77 nlmsg_cancel(skb, nlh);
91 (
unsigned int)port->
port_no, port->
dev->name, event);
97 err = br_fill_ifinfo(skb, port, 0, 0, event, 0);
116 struct net *
net = sock_net(skb->
sk);
126 if (!port || idx < cb->args[0])
129 if (br_fill_ifinfo(skb, port,
149 struct net *net = sock_net(skb->
sk);
156 if (nlmsg_len(nlh) <
sizeof(*ifm))
159 ifm = nlmsg_data(nlh);
163 protinfo = nlmsg_find_attr(nlh,
sizeof(*ifm),
IFLA_PROTINFO);
164 if (!protinfo || nla_len(protinfo) <
sizeof(
u8))
167 new_state = nla_get_u8(protinfo);
175 p = br_port_get_rtnl(dev);
180 if (p->
br->stp_enabled == BR_KERNEL_STP)
183 if (!netif_running(dev) ||
190 spin_lock_bh(&p->
br->lock);
192 spin_unlock_bh(&p->
br->lock);
202 if (nla_len(tb[IFLA_ADDRESS]) !=
ETH_ALEN)
204 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
215 .validate = br_validate,
228 br_dump_ifinfo,
NULL);