|
|
8a9875 |
From 036e314bd93602f7388262cc37faf8b626980af1 Mon Sep 17 00:00:00 2001
|
|
|
8a9875 |
From: Gary Loughnane <gary.loughnane@intel.com>
|
|
|
8a9875 |
Date: Mon, 17 Aug 2015 21:19:24 +0000
|
|
|
8a9875 |
Subject: [PATCH] lldpad: system capability incorrect advertised as station
|
|
|
8a9875 |
only
|
|
|
8a9875 |
|
|
|
8a9875 |
Fix system capability TLV on switch. On our switches we have found
|
|
|
8a9875 |
that the system capability was being advertised as Station Only. This
|
|
|
8a9875 |
patch changes the capability to Bridge.
|
|
|
8a9875 |
|
|
|
8a9875 |
Signed-off-by: Gary Loughnane <gary.loughnane@intel.com>
|
|
|
8a9875 |
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
|
|
|
8a9875 |
---
|
|
|
8a9875 |
include/lldp_util.h | 1 +
|
|
|
8a9875 |
lldp_util.c | 22 +++++++++++++++++++++-
|
|
|
8a9875 |
2 files changed, 22 insertions(+), 1 deletion(-)
|
|
|
8a9875 |
|
|
|
8a9875 |
diff --git a/include/lldp_util.h b/include/lldp_util.h
|
|
|
8a9875 |
index 878426b..69b67b1 100644
|
|
|
8a9875 |
--- a/include/lldp_util.h
|
|
|
8a9875 |
+++ b/include/lldp_util.h
|
|
|
8a9875 |
@@ -125,6 +125,7 @@ int is_active(const char *ifname);
|
|
|
8a9875 |
int is_bond(const char *ifname);
|
|
|
8a9875 |
int is_san_mac(u8 *addr);
|
|
|
8a9875 |
int is_bridge(const char *ifname);
|
|
|
8a9875 |
+int is_bridge_port(const char *ifname);
|
|
|
8a9875 |
int is_vlan(const char *ifname);
|
|
|
8a9875 |
int is_vlan_capable(const char *ifname);
|
|
|
8a9875 |
int is_wlan(const char *ifname);
|
|
|
8a9875 |
diff --git a/lldp_util.c b/lldp_util.c
|
|
|
8a9875 |
index f1fb7b9..62f0af8 100644
|
|
|
8a9875 |
--- a/lldp_util.c
|
|
|
8a9875 |
+++ b/lldp_util.c
|
|
|
8a9875 |
@@ -580,6 +580,26 @@ int is_bridge(const char *ifname)
|
|
|
8a9875 |
return rc;
|
|
|
8a9875 |
}
|
|
|
8a9875 |
|
|
|
8a9875 |
+int is_bridge_port(const char *ifname)
|
|
|
8a9875 |
+{
|
|
|
8a9875 |
+ int rc = 0;
|
|
|
8a9875 |
+ char path[256];
|
|
|
8a9875 |
+ DIR *dirp;
|
|
|
8a9875 |
+
|
|
|
8a9875 |
+ if (!is_ether(ifname)) {
|
|
|
8a9875 |
+ return 0;
|
|
|
8a9875 |
+ }
|
|
|
8a9875 |
+ /* check if the given ifname is a bridge port in sysfs */
|
|
|
8a9875 |
+ snprintf(path, sizeof(path), "/sys/class/net/%s/brport/", ifname);
|
|
|
8a9875 |
+ dirp = opendir(path);
|
|
|
8a9875 |
+ if (dirp) {
|
|
|
8a9875 |
+ closedir(dirp);
|
|
|
8a9875 |
+ rc = 1;
|
|
|
8a9875 |
+ }
|
|
|
8a9875 |
+
|
|
|
8a9875 |
+ return rc;
|
|
|
8a9875 |
+}
|
|
|
8a9875 |
+
|
|
|
8a9875 |
int is_vlan(const char *ifname)
|
|
|
8a9875 |
{
|
|
|
8a9875 |
int fd;
|
|
|
8a9875 |
@@ -942,7 +962,7 @@ u16 get_caps(const char *ifname)
|
|
|
8a9875 |
if (is_vlan(ifname))
|
|
|
8a9875 |
caps |= SYSCAP_CVLAN;
|
|
|
8a9875 |
|
|
|
8a9875 |
- if (is_bridge(ifname))
|
|
|
8a9875 |
+ if (is_bridge_port(ifname))
|
|
|
8a9875 |
caps |= SYSCAP_BRIDGE;
|
|
|
8a9875 |
|
|
|
8a9875 |
if (is_router())
|
|
|
8a9875 |
--
|
|
|
8a9875 |
2.5.5
|
|
|
8a9875 |
|