+#ifdef NMRPFLASH_LINUX
+static int open_stp_state(const char *intf)
+{
+ char name[256];
+ snprintf(name, sizeof(name), "/sys/class/net/%s/bridge/stp_state", intf);
+ return open(name, O_RDWR, 0644);
+}
+
+static bool is_stp_enabled(const char *intf)
+{
+ char c;
+ int fd = open_stp_state(intf);
+ if (fd == -1) {
+ return false;
+ }
+
+ if (read(fd, &c, 1) != 1) {
+ c = '0';
+ }
+
+ close(fd);
+ return c == '1';
+}
+
+static bool set_stp_enabled(const char *intf, bool enabled)
+{
+ bool ret;
+ const char *s = enabled ? "1\n" : "0\n";
+ int fd = open_stp_state(intf);
+ if (fd == -1) {
+ return false;
+ }
+
+ ret = (write(fd, s, 2) == 2);
+ close(fd);
+
+ return ret;
+}
+#endif
+
+static bool get_intf_info(const char *intf, uint8_t *hwaddr, bool *bridge)