Commit Graph

3 Commits

Author SHA1 Message Date
roy 8b0aa988ec ifconfig: go back to using direct ioctls rather than data from getifaddrs
AF_LINK may not be the first address returned for the interface.
Technically, it *might* not even exist on the interface even though
other families do.
This is likely a driver bug if this really is the case though.

As such it's just easier to use direct ioctls rather than thump around
getifaddrs results. As it stands, the code makes a lot of getifaddrs
calls anyway, so an extra ioctl or two won't break the bank.
2020-10-14 13:37:14 +00:00
roy bfeafc760c ifconfig: Report link state even if media is not supported
For AF_LINK addrs from getifaddrs(2), ifa_data is struct if_data.
This in turn holds ifi_link_state which we can use to report
link status if the interface does not support media where it's normally
reported.

Based on OpenBSD.
2020-09-22 14:14:17 +00:00
dyoung d75414adf5 Let us add/remove features from ifconfig, such as support for
various address families (inet, inet6, iso, atalk) and protocols
(802.11, 802.3ad, CARP), simply by trimming the list of sources in
the Makefile.  This helps one customize ifconfig for an embedded
device or for install media, and it eliminates a lot of grotty
#ifdef'age.  Now, the ifconfig syntax and semantics are finalized
at run-time using the constructor routines in each address-family/protocol
module.

(In principle, ifconfig could load virtually all of its syntax from
shared objects.)

Extract a lot of common code into subroutines, in order to shrink
the ifconfig binary a bit.  Make all of the address families share
code for address addition/replacement/removal, and delete "legacy"
code for manipulating addresses.  That may have broken atalk and
iso, despite my best efforts.

Extract an include file, Makefile.inc, containing the make-fu that
both ifconfig and x_ifconfig share.

Sprinkle static.  Change some int's to bool's.  Constify.

Add RCS Ids to carp.c and env.c.  Move media code to a new file,
media.c.  Delete several unneeded header files.

Set, reset, and display the IEEE 802.11 attribute, 'dot11RTSThreshold'.

Bug fix: do not require both a interface address and a destination
address for point-to-point interfaces, but accept a interface
address by itself.
2008-07-02 07:44:13 +00:00