int speed = -1;
int duplex = -1;
bool changed = false;
+ bool bpdu_filter;
if(check_mac_address(prt->sysdeps.name, prt->sysdeps.macaddr))
{
prt->sysdeps.up = true;
changed = true;
}
+
+ bpdu_filter = get_bpdu_filter(prt->sysdeps.name);
+ if (bpdu_filter != prt->bpduFilterPort) {
+ CIST_PortConfig cfg = {
+ .bpdu_filter_port = bpdu_filter,
+ .set_bpdu_filter_port = true
+ };
+
+ MSTP_IN_set_cist_port_config(prt, &cfg);
+ }
}
if(changed)
MSTP_IN_set_port_enable(prt, prt->sysdeps.up, prt->sysdeps.speed,
return (0 == access(path, R_OK));
}
-int get_bridge_portno(char *if_name)
+static int get_port_file(const char *if_name, const char *file)
{
char path[32 + IFNAMSIZ];
- sprintf(path, SYSFS_CLASS_NET "/%s/brport/port_no", if_name);
+ sprintf(path, SYSFS_CLASS_NET "/%s/brport/%s", if_name, file);
char buf[128];
int fd;
long res = -1;
TSTM((l = read(fd, buf, sizeof(buf) - 1)) >= 0, -1, "%m");
if(0 == l)
{
- ERROR("Empty port index file");
+ ERROR("Empty %s file", file);
goto out;
}
else if((sizeof(buf) - 1) == l)
{
- ERROR("port_index file too long");
+ ERROR("%s file too long", file);
goto out;
}
buf[l] = 0;
res = strtoul(buf, &end, 0);
if(0 != *end || INT_MAX < res)
{
- ERROR("Invalid port index %s", buf);
+ ERROR("Invalid %s %s", file, buf);
res = -1;
}
out:
close(fd);
return res;
}
+
+int get_bpdu_filter(char *if_name)
+{
+ return get_port_file(if_name, "bpdu_filter");
+}
+
+int get_bridge_portno(char *if_name)
+{
+ return get_port_file(if_name, "port_no");
+}