Classful nifconfig(8) design document / pseudocode -------------------------------------------------- Brief: nifconfig(8) identifies device drivers via the IFT_TYPE and ifmedia mechanisms, and determines which parser(s) for command words to invoke accordingly. IFT types by kernel subtree --------------------------- defines lots. We only use a few. dev/em/if_em.c IFT_ETHER (has native IFT_L2VLAN support) dev/iicbus/if_ic.c IFT_PARA dev/ppbus/if_plip.c IFT_PARA dev/sn/if_sn.c IFT_ETHER netatm/atm_if.c IFT_IPOVERATM net/if_vlan.c IFT_L2VLAN net/if_arcsubr.c IFT_ARCNET net/if_disc.c IFT_LOOP net/if_ef.c IFT_XETHER net/if_faith.c IFT_FAITH net/if_fddisubr.c IFT_FDDI net/if_gif.c IFT_GIF net/if_gre.c IFT_GRE net/if_loop.c IFT_LOOP net/if_ppp.c IFT_PPP net/if_sl.c IFT_SLIP net/if_spppsubr.c IFT_PPP net/if_stf.c IFT_STF net/if_tun.c IFT_PPP XXX Change if_gre.c to use IFT_GRE. IFT_OTHER too ambiguous. [diff] Interface Classes by IFT_TYPE ----------------------------- regular cloners { { IFT_LOOP } => loop { IFT_PARA, IFT_PPP, IFT_SLIP, IFT_TUN } => ptp { IFT_GRE, IFT_GIF } => tunnel { IFT_FAITH } => faith { IFT_L2VLAN } => vlan } XXX have regular cloner semantics, subclasses may have particular semantics special cloners { { IFT_STF } => stf { IFT_XETHER } => ethfr } XXX do not have regular cloner semantics link { { IFT_ATM } => atm { IFT_FDDI } => fddi { IFT_ISO88025 } => tr { IFT_ARCNET } => arc { IFT_ETHER } => eth } -> all link-layer interfaces grok the ifmedia interface now IFT_ETHER special cases: grab ift_media list; if IFM_IEEE80211 mask matched -> treat as new class 'wlan' Loadable Address Families ------------------------- inet [DEFAULT] inet6 ipx atalk link ether token nsap - Specifying an address family name assigns an address. - alias keyword *adds* an address to an interface. - delete keyword *removes* an address from an interface. - inet is the default address family; it is implied if no interface word is present. Command line structure ---------------------- [GENERAL CASE] ifconfig -> if can be found, error -> if cannot be found... -> attempt to load a module if_.ko from kernel boot path -> if this fails, error -> if this succeeds... fallthrough DEFAULT ACTION IS list; list word may be omitted. ifconfig -> on its own, implies -a. ifconfig -a -> display all interfaces in system -d all downed interfaces -u all upped interfaces -L display IPv6 address lifetime (special case..) ifconfig -C -> list current cloners available (modules loaded into kernel) ifconfig -m -> list supported media for XXX -L display IPv6 address lifetime -- this is silly for -m, depracate. ifconfig -l -> list current interfaces by name on one line -d all downed interfaces -u all upped interfaces ifconfig -> list AND ONLY ifconfig
-> if address-family is omitted, ALWAYS assume inet ifconfig create -> if is a cloner, create -> if is not a cloner, error ifconfig destroy -> if cannot be found, error -> if exists -> if is not a cloner, error -> if is a cloner, destroy Per-class command words ----------------------- [TO FOLLOW]