diff --git a/src/utils/brcm_nl.c b/src/utils/brcm_nl.c index 1fc46cb3a3afbac7bd43e4227618cde845259494..90e89b23976809d248d7c59b1d9792da94b8d69b 100644 --- a/src/utils/brcm_nl.c +++ b/src/utils/brcm_nl.c @@ -70,6 +70,7 @@ static int func(struct nl_msg *msg, void *arg) struct nlmsghdr *nlh = nlmsg_hdr(msg); switch (nlh->nlmsg_type) { + case RTM_GETLINK: case RTM_NEWLINK: case RTM_DELLINK: { @@ -93,6 +94,10 @@ static int func(struct nl_msg *msg, void *arg) if (!strstr(ifname, "wds")) break; + if (if_isbridge_interface(ifname)) { + printf("Interface %s is already a part of a bridge\n", ifname); + break; + } printf("Adding interface %s to bridge %s!\n", ifname, bridge); @@ -132,6 +137,7 @@ int brcm_nl_loop(void *arg) nl_connect(sk, NETLINK_ROUTE); nl_socket_add_memberships(sk, RTNLGRP_LINK, 0); + nl_rtgen_request(sk, RTM_GETLINK, AF_UNSPEC, NLM_F_DUMP); for (;;) nl_recvmsgs_default(sk);