rtnetlink.c (d64f69b0373a7d0bcec8b5da7712977518a8f42b) | rtnetlink.c (d5566fd72ec1924958fcfd48b65c022c8f7eae64) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 1258 unchanged lines hidden (view full) --- 1267 list_for_each_entry(af_ops, &rtnl_af_ops, list) { 1268 if (af_ops->fill_link_af) { 1269 struct nlattr *af; 1270 int err; 1271 1272 if (!(af = nla_nest_start(skb, af_ops->family))) 1273 goto nla_put_failure; 1274 | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * Routing netlink socket interface: protocol independent part. 7 * 8 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> --- 1258 unchanged lines hidden (view full) --- 1267 list_for_each_entry(af_ops, &rtnl_af_ops, list) { 1268 if (af_ops->fill_link_af) { 1269 struct nlattr *af; 1270 int err; 1271 1272 if (!(af = nla_nest_start(skb, af_ops->family))) 1273 goto nla_put_failure; 1274 |
1275 err = af_ops->fill_link_af(skb, dev); | 1275 err = af_ops->fill_link_af(skb, dev, ext_filter_mask); |
1276 1277 /* 1278 * Caller may return ENODATA to indicate that there 1279 * was no data to be dumped. This is not an error, it 1280 * means we should trim the attribute header and 1281 * continue. 1282 */ 1283 if (err == -ENODATA) --- 1758 unchanged lines hidden (view full) --- 3042static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) 3043{ 3044 struct net *net = sock_net(skb->sk); 3045 struct net_device *dev; 3046 int idx = 0; 3047 u32 portid = NETLINK_CB(cb->skb).portid; 3048 u32 seq = cb->nlh->nlmsg_seq; 3049 u32 filter_mask = 0; | 1276 1277 /* 1278 * Caller may return ENODATA to indicate that there 1279 * was no data to be dumped. This is not an error, it 1280 * means we should trim the attribute header and 1281 * continue. 1282 */ 1283 if (err == -ENODATA) --- 1758 unchanged lines hidden (view full) --- 3042static int rtnl_bridge_getlink(struct sk_buff *skb, struct netlink_callback *cb) 3043{ 3044 struct net *net = sock_net(skb->sk); 3045 struct net_device *dev; 3046 int idx = 0; 3047 u32 portid = NETLINK_CB(cb->skb).portid; 3048 u32 seq = cb->nlh->nlmsg_seq; 3049 u32 filter_mask = 0; |
3050 int err; | |
3051 3052 if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { 3053 struct nlattr *extfilt; 3054 3055 extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 3056 IFLA_EXT_MASK); 3057 if (extfilt) { 3058 if (nla_len(extfilt) < sizeof(filter_mask)) --- 4 unchanged lines hidden (view full) --- 3063 } 3064 3065 rcu_read_lock(); 3066 for_each_netdev_rcu(net, dev) { 3067 const struct net_device_ops *ops = dev->netdev_ops; 3068 struct net_device *br_dev = netdev_master_upper_dev_get(dev); 3069 3070 if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { | 3050 3051 if (nlmsg_len(cb->nlh) > sizeof(struct ifinfomsg)) { 3052 struct nlattr *extfilt; 3053 3054 extfilt = nlmsg_find_attr(cb->nlh, sizeof(struct ifinfomsg), 3055 IFLA_EXT_MASK); 3056 if (extfilt) { 3057 if (nla_len(extfilt) < sizeof(filter_mask)) --- 4 unchanged lines hidden (view full) --- 3062 } 3063 3064 rcu_read_lock(); 3065 for_each_netdev_rcu(net, dev) { 3066 const struct net_device_ops *ops = dev->netdev_ops; 3067 struct net_device *br_dev = netdev_master_upper_dev_get(dev); 3068 3069 if (br_dev && br_dev->netdev_ops->ndo_bridge_getlink) { |
3071 if (idx >= cb->args[0]) { 3072 err = br_dev->netdev_ops->ndo_bridge_getlink( 3073 skb, portid, seq, dev, 3074 filter_mask, NLM_F_MULTI); 3075 if (err < 0 && err != -EOPNOTSUPP) 3076 break; 3077 } | 3070 if (idx >= cb->args[0] && 3071 br_dev->netdev_ops->ndo_bridge_getlink( 3072 skb, portid, seq, dev, filter_mask, 3073 NLM_F_MULTI) < 0) 3074 break; |
3078 idx++; 3079 } 3080 3081 if (ops->ndo_bridge_getlink) { | 3075 idx++; 3076 } 3077 3078 if (ops->ndo_bridge_getlink) { |
3082 if (idx >= cb->args[0]) { 3083 err = ops->ndo_bridge_getlink(skb, portid, 3084 seq, dev, 3085 filter_mask, 3086 NLM_F_MULTI); 3087 if (err < 0 && err != -EOPNOTSUPP) 3088 break; 3089 } | 3079 if (idx >= cb->args[0] && 3080 ops->ndo_bridge_getlink(skb, portid, seq, dev, 3081 filter_mask, 3082 NLM_F_MULTI) < 0) 3083 break; |
3090 idx++; 3091 } 3092 } 3093 rcu_read_unlock(); 3094 cb->args[0] = idx; 3095 3096 return skb->len; 3097} --- 349 unchanged lines hidden --- | 3084 idx++; 3085 } 3086 } 3087 rcu_read_unlock(); 3088 cb->args[0] = idx; 3089 3090 return skb->len; 3091} --- 349 unchanged lines hidden --- |