Netifrc/Brctl Migration
These days sys-apps/iproute2 utility can manage bridges, it is superior than using the old specific utilities, among others is the net-misc/bridge-utils's brctl. Modern Linux expose bridge setting via sysfs, as result there is no need for iproute2 to support complex configuration as brctl utility, same sysfs configuration can be used for brctl based configurations as well.
brctl to iproute2 migration
The migration of brctl to iproute can be done in two phases:
- Migrate bridge configuration to sysfs, this can be done in stable net-misc/netifrc.
- Migrate bridge management into iproute2 and drop brctl usage, this requires net-misc/netifrc >= 0.4.0.
Once sysfs migration is completed, migration to iproute2 will be done as soon as netifrc supports iproute2, at this time net-misc/bridge-utils can be safely removed from system.
brctl syntax
<syntaxhighlight lang="bash">brctl_\${NAME}="brctl-option value brctl-option value brctl-option port value ..."</syntaxhighlight>
sysfs syntax
<syntaxhighlight lang="bash">bridge_\${sysfs_option}_\${NAME}=value brport_\${sysfs_option}_\${NAME}=value</syntaxhighlight>
Migration
Old sysfs keys
In the past, bridge and brport settings were specified as variables without a prefix, now one should specify bridge_ or brport_ prefix, for example:
<syntaxhighlight lang="bash">stp_state_br0=0</syntaxhighlight>
Should be specified as:
<syntaxhighlight lang="bash">bridge_stp_state_br0=0</syntaxhighlight>
brctl settings
Bridge master interface
These are setting of the bridge master device, the name of interface is the bridge name.
brctl option | sysfs option | notes |
---|---|---|
setageing | bridge_ageing_time | brctl is in seconds, sysfs is in 1/100 second, multiple by 100 |
setgcint | N/A | unsupported |
stp | bridge_stp_state | 'on', 'yes', '1' are translated to 1 otherwise 0 |
setbridgeprio | bridge_priority | |
setfd | bridge_forward_delay | brctl is in seconds, sysfs is in 1/100 second, multiple by 100 |
sethello | bridge_hello_time | brctl is in seconds, sysfs is in 1/100 second, multiple by 100 |
setmaxage | bridge_max_age | brctl is in seconds, sysfs is in 1/100 second, multiple by 100 |
Bridge slave (port)
These are setting of the bridge slave device (port), the name of interface is the slave name.
brctl option | sysfs option | notes |
---|---|---|
setpathcost | brport_path_cost | |
setportprio | brport_priority | |
hairpin | brport_hairpin_mode | '1' or '0' |
Examples
stp
/etc/conf.d/net
<syntaxhighlight lang="bash">brctl_br0="setfd 15 sethello 2 stp on"</syntaxhighlight>
Becomes:
/etc/conf.d/net
<syntaxhighlight lang="bash">bridge_forward_delay_br0=1500 bridge_hello_time_br0=200 bridge_stp_state_br0=1</syntaxhighlight>
port
/etc/conf.d/net
<syntaxhighlight lang="bash">brctl_br0="setbridgeprio 50 setportprio eth0 60"</syntaxhighlight>
Becomes:
/etc/conf.d/net
<syntaxhighlight lang="bash">bridge_priority_br0=50 brport_priority_eth0=60</syntaxhighlight>