Thread (5 messages) flat view 5 messages, 2 authors, 2021-06-22

Re: [PATCH iproute2-next 1/2] iplink: add support for parent device

From: Loic Poulain <hidden>
Date: 2021-06-22 06:46:19

Hi Sergey,

On Tue, 22 Jun 2021 at 02:32, Sergey Ryazanov [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add support for specifying a parent device (struct device) by its name
during the link creation and printing parent name in the links list.
This option will be used to create WWAN links and possibly by other
device classes that do not have a "natural parent netdev".

Add the parent device bus name printing for links list info
completeness. But do not add a corresponding command line argument, as
we do not have a use case for this attribute.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
---
 ip/ipaddress.c | 14 ++++++++++++++
 ip/iplink.c    |  6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 06ca7273..7dc38ff1 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1242,6 +1242,20 @@ int print_linkinfo(struct nlmsghdr *n, void *arg)
                                                   RTA_PAYLOAD(tb[IFLA_PHYS_SWITCH_ID]),
                                                   b1, sizeof(b1)));
                }
+
+               if (tb[IFLA_PARENT_DEV_BUS_NAME]) {
+                       print_string(PRINT_ANY,
+                                    "parentdevbus",
Parav suggested previously to simply name it 'parentbus'.
+                                    "parentdevbus %s ",
+                                    rta_getattr_str(tb[IFLA_PARENT_DEV_BUS_NAME]));
+               }
+
+               if (tb[IFLA_PARENT_DEV_NAME]) {
+                       print_string(PRINT_ANY,
+                                    "parentdev",
+                                    "parentdev %s ",
+                                    rta_getattr_str(tb[IFLA_PARENT_DEV_NAME]));
+               }
        }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help