rtnetlink.c (250fc3dfdbd3e8b5c751ce7b5a26176ec62ca0f8) rtnetlink.c (b1e66b9a67d67d0e73091b04b51e524581c8c887)
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>

--- 1348 unchanged lines hidden (view full) ---

1357 int ifindex = dev_get_iflink(dev);
1358
1359 if (dev->ifindex == ifindex)
1360 return 0;
1361
1362 return nla_put_u32(skb, IFLA_LINK, ifindex);
1363}
1364
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>

--- 1348 unchanged lines hidden (view full) ---

1357 int ifindex = dev_get_iflink(dev);
1358
1359 if (dev->ifindex == ifindex)
1360 return 0;
1361
1362 return nla_put_u32(skb, IFLA_LINK, ifindex);
1363}
1364
1365static int rtnl_fill_link_netnsid(struct sk_buff *skb,
1366 const struct net_device *dev)
1367{
1368 if (dev->rtnl_link_ops && dev->rtnl_link_ops->get_link_net) {
1369 struct net *link_net = dev->rtnl_link_ops->get_link_net(dev);
1370
1371 if (!net_eq(dev_net(dev), link_net)) {
1372 int id = peernet2id_alloc(dev_net(dev), link_net);
1373
1374 if (nla_put_s32(skb, IFLA_LINK_NETNSID, id))
1375 return -EMSGSIZE;
1376 }
1377 }
1378
1379 return 0;
1380}
1381
1365static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1366 int type, u32 pid, u32 seq, u32 change,
1367 unsigned int flags, u32 ext_filter_mask,
1368 u32 event)
1369{
1370 struct ifinfomsg *ifm;
1371 struct nlmsghdr *nlh;
1372 struct nlattr *af_spec;

--- 73 unchanged lines hidden (view full) ---

1446 if (rtnl_xdp_fill(skb, dev))
1447 goto nla_put_failure;
1448
1449 if (dev->rtnl_link_ops || rtnl_have_link_slave_info(dev)) {
1450 if (rtnl_link_fill(skb, dev) < 0)
1451 goto nla_put_failure;
1452 }
1453
1382static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
1383 int type, u32 pid, u32 seq, u32 change,
1384 unsigned int flags, u32 ext_filter_mask,
1385 u32 event)
1386{
1387 struct ifinfomsg *ifm;
1388 struct nlmsghdr *nlh;
1389 struct nlattr *af_spec;

--- 73 unchanged lines hidden (view full) ---

1463 if (rtnl_xdp_fill(skb, dev))
1464 goto nla_put_failure;
1465
1466 if (dev->rtnl_link_ops || rtnl_have_link_slave_info(dev)) {
1467 if (rtnl_link_fill(skb, dev) < 0)
1468 goto nla_put_failure;
1469 }
1470
1454 if (dev->rtnl_link_ops &&
1455 dev->rtnl_link_ops->get_link_net) {
1456 struct net *link_net = dev->rtnl_link_ops->get_link_net(dev);
1471 if (rtnl_fill_link_netnsid(skb, dev))
1472 goto nla_put_failure;
1457
1473
1458 if (!net_eq(dev_net(dev), link_net)) {
1459 int id = peernet2id_alloc(dev_net(dev), link_net);
1460
1461 if (nla_put_s32(skb, IFLA_LINK_NETNSID, id))
1462 goto nla_put_failure;
1463 }
1464 }
1465
1466 if (!(af_spec = nla_nest_start(skb, IFLA_AF_SPEC)))
1467 goto nla_put_failure;
1468
1469 list_for_each_entry(af_ops, &rtnl_af_ops, list) {
1470 if (af_ops->fill_link_af) {
1471 struct nlattr *af;
1472 int err;
1473

--- 2922 unchanged lines hidden ---
1474 if (!(af_spec = nla_nest_start(skb, IFLA_AF_SPEC)))
1475 goto nla_put_failure;
1476
1477 list_for_each_entry(af_ops, &rtnl_af_ops, list) {
1478 if (af_ops->fill_link_af) {
1479 struct nlattr *af;
1480 int err;
1481

--- 2922 unchanged lines hidden ---