Page MenuHomeFreeBSD

sbin/ifconfig: Use libifconfig to get bridge status
ClosedPublic

Authored by freqlabs on Feb 26 2021, 11:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 22, 6:52 PM
Unknown Object (File)
Sun, Dec 15, 6:27 AM
Unknown Object (File)
Mon, Dec 9, 2:03 AM
Unknown Object (File)
Wed, Nov 27, 12:46 AM
Unknown Object (File)
Oct 10 2024, 7:40 AM
Unknown Object (File)
Oct 10 2024, 7:24 AM
Unknown Object (File)
Oct 10 2024, 7:24 AM
Unknown Object (File)
Oct 10 2024, 7:24 AM
Subscribers
None

Details

Summary

We're already using libifconfig in ifconfig, so this is a fairly simple change.

Test Plan
# ifconfig bridge0 | tee /tmp/a
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 58:9c:fc:10:d9:02
	inet 192.168.1.74 netmask 0xffffff00 broadcast 192.168.1.255
	id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
	maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
	root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
	member: lagg0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
	        ifmaxaddr 0 port 8 priority 128 path cost 2000000
	groups: bridge
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
# git stash pop && make -C sbin/ifconfig && make -C sbin/ifconfig install
<snip>
# ifconfig bridge0 | tee /tmp/b
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	ether 58:9c:fc:10:d9:02
	inet 192.168.1.74 netmask 0xffffff00 broadcast 192.168.1.255
	id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
	maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
	root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
	member: lagg0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
	        ifmaxaddr 0 port 8 priority 128 path cost 2000000
	groups: bridge
	nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
# cmp /tmp/a /tmp/b && echo nailed it
nailed it

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

freqlabs created this revision.
sbin/ifconfig/ifbridge.c
166–167

At what point to we switch to a single global lifh variable throughout ifconfig?

175–227

I think style(9) still wants us to put those at the top of the block.

202

bridge->members[i]?

freqlabs added inline comments.
sbin/ifconfig/ifbridge.c
166–167

My thinking is that eventually it will be possible to replace the socket parameter s with a lifh parameter for the handle for all these command handlers. A global handle could work in the meantime.

kp added inline comments.
sbin/ifconfig/ifbridge.c
166–167

Yeah, that works too.

ifconfig is mostly old, and in desperate need of some more cleanup. Hopefully moving things in libifconfig will make that easier.

This revision is now accepted and ready to land.Feb 28 2021, 4:01 PM