sysctl-controlled key-value store ?
Luigi Rizzo
rizzo at iet.unipi.it
Sun Oct 7 10:23:18 UTC 2012
On Sun, Oct 07, 2012 at 12:57:42PM +1300, Andrew Thompson wrote:
> On 7 October 2012 06:28, Luigi Rizzo <rizzo at iet.unipi.it> wrote:
> > Hi,
> > in order to control some netmap feature (namely, which interfaces
> > are attached to VALE switches), i would considering the use of
> > a sysctl interface triggering a sysctl-proc, something of the form
> >
> > dev.netmap.switch.xyz=em0 ix1
> > dev.netmap.switch.foo=ix2 re0
>
> Is it possible to use ifconfig? If a VALE switch was a pseudo
> interface and you added real interfaces to it then it would be
> consistent with the current networking fu.
Good point, thanks for mentioning this:
<rant>
Could be done, but I consider the ifconfig one of the ugliest
configuration mechanisms we have in FreeBSD so I'd rather not
contribute to that.
src/sbin/ifconfig/ has over 11K of C source, most of it just in
charge of filling some obscure ioctl argument with limited error
checking.
For instance, ifbridge.c has 700 lines of code defines 38 commands
or variants. All the code does is convert command line into one of
the structs below defining the user-kernel interface.
Most of them are used 1-2 times in total in the entire userland
code (in ifconfig and bsnmpd/modules/snmp_bridge)
struct ifdrv
struct ifbifconf
struct ifbreq
struct ifbaconf
struct ifbareq
struct ifbropreq
struct ifbrparam
All the processing is done in the kernel. Performance is not a
concern given the low frequency of these actions.
What is the point of this complication ? One could just do things like
sysctl dev.bridge.br3.priorit=16384
sysctl dev.bridge.br3.addm=re0
...
(and the like) with no complications on the kernel side and
huge simplifications on the userland side and kernel-user ABI.
Replace sysctl with sysfs or other mechanism of choice.
ifieee80211 is even worse -- over 5000 lines of code,
153 between commands and arguments, and 31 different parameters:
struct ieee80211_ath_ie
struct ieee80211_channel
struct ieee80211_chanswitch_req
struct ieee80211_clone_params
struct ieee80211_country_ie
struct ieee80211_devcaps_req
struct ieee80211_ie_htcap
struct ieee80211_ie_htinfo
struct ieee80211_meshconf_ie
struct ieee80211_mimo_info
struct ieee80211_regdomain
struct ieee80211_regdomain_req
struct ieee80211_roamparam
struct ieee80211_roamparams_req
struct ieee80211_scan_req
struct ieee80211_tdma_param
struct ieee80211_txparam
struct ieee80211_txparams_req
struct ieee80211_wme_acparams
struct ieee80211_wme_info
struct ieee80211_wme_param
struct ieee80211req
struct ieee80211req_chaninfo
struct ieee80211req_chanlist
struct ieee80211req_key
struct ieee80211req_maclist
struct ieee80211req_mesh_route
struct ieee80211req_mlme
struct ieee80211req_scan_result
struct ieee80211req_sta_info
struct ieee80211req_sta_req
cheers
luigi
> Andrew
> _______________________________________________
> freebsd-current at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at freebsd.org"
More information about the freebsd-current
mailing list