}
if (carrier == -1)
syslog(LOG_ERR, "%s: carrier_status: %m", ifname);
- else if (carrier == 0 || !(iface->flags & (IFF_UP || IFF_RUNNING))) {
+ else if (carrier == 0 || ~iface->flags & (IFF_UP | IFF_RUNNING)) {
if (iface->carrier != LINK_DOWN) {
iface->carrier = LINK_DOWN;
syslog(LOG_INFO, "%s: carrier lost", iface->name);
delete_timeouts(iface, start_expire, NULL);
drop_config(iface, "NOCARRIER");
}
- } else if (carrier == 1 && (iface->flags & (IFF_UP || IFF_RUNNING))) {
+ } else if (carrier == 1 && !(~iface->flags & (IFF_UP | IFF_RUNNING))) {
if (iface->carrier != LINK_UP) {
iface->carrier = LINK_UP;
syslog(LOG_INFO, "%s: carrier acquired", iface->name);
len = -1;
break;
default:
- len = ifm->ifm_flags &
- (IFF_UP || IFF_RUNNING) ? 1 : -1;
+ len = ~ifm->ifm_flags &
+ (IFF_UP | IFF_RUNNING) ? -1 : 1;
break;
}
handle_carrier(len, ifm->ifm_flags, ifname);