Skip to content

[Libnl] Always report LINK_ATTR_IFINDEX when available #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/libnl3/0001-libnl-always-report-link-interface-name.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 72fc79b2695004ce172583ac670df7b5c7dfec23 Mon Sep 17 00:00:00 2001
From: Ying Xie <[email protected]>
Date: Tue, 26 Mar 2019 16:23:43 +0000
Subject: [PATCH] [libnl] always report link interface name

Signed-off-by: Ying Xie <[email protected]>
---
lib/route/link.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/lib/route/link.c b/lib/route/link.c
index 5c32550..05fe04f 100644
--- a/lib/route/link.c
+++ b/lib/route/link.c
@@ -1486,12 +1486,21 @@ int rtnl_link_build_change_request(struct rtnl_link *orig,
return -NLE_IMMUTABLE;
}

+#if 0 // Disable optimization
+ /* Justifications: some client (libteamd) experienced issue, if they
+ * didn't get interface name from libnl upon receiving the
+ * first notification after LINK_ATTR_IFNAME is set, with the
+ * following code in place, these client wouldn't be able to query
+ * interface name later because libnl won't return interface name
+ * after LINK_ATTR_IFNAME flag is removed.
+ */
/* Avoid unnecessary name change requests */
if (orig->ce_mask & LINK_ATTR_IFINDEX &&
orig->ce_mask & LINK_ATTR_IFNAME &&
changes->ce_mask & LINK_ATTR_IFNAME &&
!strcmp(orig->l_name, changes->l_name))
changes->ce_mask &= ~LINK_ATTR_IFNAME;
+#endif

if ((err = build_link_msg(RTM_NEWLINK, &ifi, changes, flags, result)) < 0)
goto errout;
--
2.7.4

8 changes: 8 additions & 0 deletions src/libnl3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
dpkg-source -x libnl3_$(LIBNL3_VERSION).dsc

pushd ./libnl3-$(LIBNL3_VERSION_BASE)
git init
git add -f *
git commit -qm "check in all loose files and diffs"

stg init
stg import -s ../series

dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)

popd

mv $(DERIVED_TARGETS) $* $(DEST)/
Expand Down
1 change: 1 addition & 0 deletions src/libnl3/series
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0001-libnl-always-report-link-interface-name.patch