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)
Feb 21 2024, 4:48 AM
Unknown Object (File)
Jan 29 2024, 11:14 AM
Unknown Object (File)
Dec 21 2023, 2:27 AM
Unknown Object (File)
Dec 20 2023, 6:54 AM
Unknown Object (File)
Dec 14 2023, 8:22 PM
Unknown Object (File)
Nov 8 2023, 1:19 AM
Unknown Object (File)
Oct 7 2023, 12:13 AM
Unknown Object (File)
Sep 18 2023, 7:53 PM
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