From 1fea2128f426f567638c8b618ce35e26bfe81fcd Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 27 Nov 2008 20:02:53 +0100 Subject: [PATCH] Remove unneeded iface_is_bridged function --- src/features.c | 57 -------------------------------------------------- src/lldpd.h | 1 - 2 files changed, 58 deletions(-) diff --git a/src/features.c b/src/features.c index bc269bbe..acc766d8 100644 --- a/src/features.c +++ b/src/features.c @@ -79,63 +79,6 @@ iface_is_bridge(struct lldpd *cfg, const char *name) return 1; } -int -old_iface_is_bridged(struct lldpd *cfg, const char *name) -{ - int i, j, num; - int ifindex = if_nametoindex(name); - int ifptindices[MAX_PORTS], ifbrindices[MAX_BRIDGES]; - unsigned long args1[3] = { BRCTL_GET_BRIDGES, - (unsigned long)ifbrindices, MAX_BRIDGES }; - unsigned long args2[4] = { BRCTL_GET_PORT_LIST, - (unsigned long)ifptindices, MAX_PORTS, 0 }; - struct ifreq ifr; - - if ((num = ioctl(cfg->g_sock, SIOCGIFBR, args1)) < 0) { - LLOG_WARN("unable to get available bridges"); - return 0; - } - for (i = 0; i < num; i++) { - if (if_indextoname(ifbrindices[i], ifr.ifr_name) == NULL) { - LLOG_WARN("unable to get name of interface %d", - ifbrindices[i]); - continue; - } - memset(ifptindices, 0, sizeof(ifptindices)); - ifr.ifr_data = (char *)&args2; - - if (ioctl(cfg->g_sock, SIOCDEVPRIVATE, &ifr) < 0) { - LLOG_WARN("unable to get bridge members for %s", - ifr.ifr_name); - continue; - } - - for (j = 0; j < MAX_PORTS; i++) { - if (ifptindices[i] == ifindex) - return 1; - } - } - - return 0; -} - -int -iface_is_bridged(struct lldpd *cfg, const char *name) -{ - char path[SYSFS_PATH_MAX]; - int f; - - if ((snprintf(path, SYSFS_PATH_MAX, - SYSFS_CLASS_NET "%s/" SYSFS_BRIDGE_PORT_ATTR, - name)) >= SYSFS_PATH_MAX) - LLOG_WARNX("path truncated"); - if ((f = priv_open(path)) < 0) { - return old_iface_is_bridged(cfg, name); - } - close(f); - return 1; -} - int iface_is_vlan(struct lldpd *cfg, const char *name) { diff --git a/src/lldpd.h b/src/lldpd.h index cde10789..b91c0117 100644 --- a/src/lldpd.h +++ b/src/lldpd.h @@ -327,7 +327,6 @@ int ctl_msg_unpack_structure(char *, void *, unsigned int, struct hmsg *, void /* features.c */ int iface_is_bridge(struct lldpd *, const char *); -int iface_is_bridged(struct lldpd *, const char *); int iface_is_wireless(struct lldpd *, const char *); int iface_is_vlan(struct lldpd *, const char *); int iface_is_bond(struct lldpd *, const char *); -- 2.39.5