diff options
| author | Roy Marples <roy@marples.name> | 2020-09-28 17:09:38 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2020-09-28 17:09:38 +0100 |
| commit | 96702451aea98a8d682ebac5a46e14802e05f624 (patch) | |
| tree | 9b0c7f51d54fbc2ff00de0cfc3dc6b1f0bf87edf /src/if.h | |
| parent | 91df57a59de1ac2f7d9db9f30eccd25513f1a61e (diff) | |
| download | dhcpcd-96702451aea98a8d682ebac5a46e14802e05f624.tar.xz | |
BSD: struct if_data->ifi_link_state is the single source of truth
Vastly improve and simplify link detection on BSD.
dhcpcd either examines the whole system via getifaddrs(3) or
reacts to events via route(4).
In both cases we have struct if_data which has ifi_link_state.
Armed with this knowledge, we no longer need SIOCGIFDATA or
SIOCGIFMEDIA.
To solve the issue of newly attached interfaces having
LINK_STATE_UNKNOWN or some interfaces not even changing it,
we only change the local knowledge of interface flags when
reports them by getifaddrs(3) or route(4) when we change them.
For example, if we set IFF_UP and it succeeds we don't set this
internally until reported by the kernel as above.
This keeps flags and link state in sync with each other.
The hope is that the kernel can set the real link state before
it reports IFF_UP.
As such, we no longer require the poll option or need to enter a
tight loop for old interfaces.
Diffstat (limited to 'src/if.h')
| -rw-r--r-- | src/if.h | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -159,9 +159,7 @@ void if_free(struct interface *); int if_domtu(const struct interface *, short int); #define if_getmtu(ifp) if_domtu((ifp), 0) #define if_setmtu(ifp, mtu) if_domtu((ifp), (mtu)) -int if_carrier(struct interface *); -int if_carrier_ifadata(struct interface *, void *); -int if_pollinit(struct interface *ifp); +int if_carrier(struct interface *, const void *); #ifdef ALIAS_ADDR int if_makealias(char *, size_t, const char *, int); |
