babled: set wired/wireless internal only when wired/wireless status changes

As stated in doc, interface's attributes such noninterfering/interfering are reset when the wired/wireless status of an interface is changed. If wired/wireless status is not changed, such as wired->wired, we should not reset internal attributes.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
This commit is contained in:
Shbinging 2025-03-18 10:35:16 +08:00
parent c288e5fbaf
commit 6af2af83be

View file

@ -310,7 +310,8 @@ DEFPY (babel_set_wired,
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
babel_set_wired_internal(babel_ifp, no ? 0 : 1);
if ((CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? 1 : 0) != (no ? 0 : 1))
babel_set_wired_internal(babel_ifp, no ? 0 : 1);
return CMD_SUCCESS;
}
@ -328,7 +329,8 @@ DEFPY (babel_set_wireless,
babel_ifp = babel_get_if_nfo(ifp);
assert (babel_ifp != NULL);
babel_set_wired_internal(babel_ifp, no ? 1 : 0);
if ((CHECK_FLAG(babel_ifp->flags, BABEL_IF_WIRED) ? 1 : 0) != (no ? 1 : 0))
babel_set_wired_internal(babel_ifp, no ? 1 : 0);
return CMD_SUCCESS;
}