Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jul 2026 08:58:35 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        Paige Thompson <paigeadele@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ifconfig patch that introduces --libxo
Message-ID:  <CAJ-VmokGLQ4Eu72GFDZ43_0rWJ3ZRRcn4XjBkGkWLtNnJT98cQ@mail.gmail.com>
In-Reply-To: <CACF2tH97GaQ9T%2BoZ-ApzRe3py5GyBbDL%2BKJx3AUx_ixEp1bvDg@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

This is pretty neat, thanks!

I think the next step here (and it's bitten us before, heh) is some
way to validate the libxo output and
that we haven't regressed (too badly) the output of ifconfig.

It's also an interesting deep dive into ifconfig to see what stuff in
ifconfig should really be moved into
libraries that do work (like what we're slowly doing with 802.11 stuff
into its own library).

If you're interested in pushing this up for review, I suggest thinking
about how to do it
piecemeal. Eg, maybe add the basic libxo helper stuff first, add
whatever refactoring bits
you need, and then individual commits for each part of ifconfig
(bridge, wifi, vlan, ethernet,
etc) so they can be individually reviewed by a smaller set of people
who focus on those areas.



-adrian

On Sun, 26 Jul 2026 at 15:54, Paige Thompson <paigeadele@gmail.com> wrote:
>
> Hi,
>
> I have a patch for sbin/ifconfig in the works that I'd like to
> eventually submit at some point. The patch covers the full summary of
> interfaces and allows you to export interface data as JSON, XML or
> HTML. It uses a library that is already in-tree and used by netstat
> (you can export route tables in JSON / XML or HTML already. This patch
> does pretty much the same thing for ifconfig but it's obviously a
> little more complicated considering the number of options it had to
> cover:
>
> fconfig_libxo_support.patch:
> https://gist.github.com/paigeadelethompson/5dd1b998d599ed7d147fd37a6aa90b2e
>
> I've also done my best to ensure that it doesn't change how ifconfig
> normally displays summaries; it still uses libxo but defaults to
> --libxo text if you don't specify --libxo as an argument and I've
> maintained the same output format that it had with all of the printf
> statements.
>
> I've been testing it thoroughly, and all of the work I'm doing going
> forward I've been tracking on this gist, I've also updated the
> original patch file a couple of times. I've never submitted a patch to
> FreeBSD before, but I'm really okay with this taking as long as it
> needs to because I think it's particularly useful and I'd prefer to
> get it right the first time rather than have it ruin somebody's day.
> I'm also interested in submitting two other patches that I haven't
> started yet:
>
> - Another for ifconfig; specifically one that would allow you to
> configure networking interfaces from an XML file (it would use the
> expat / bsdxml.h parser to read in ifconfig data exported with
> `ifconfig --libxo xml` (example: https://termbin.com/efqhl )
>
> - a patch for route which can restore routing tables; I made a little
> proof of concept that kind of does this with netstat / jq awhile ago:
> https://gist.github.com/paigeadelethompson/d99e6bb0aab4ae2fa6a066217831840c
> but rather the way I have in mind would essentially be:
>
> netstat --libxo xml -nr -F 1 > 1.xml
> route --restore-from 1.xml
>
> and the patch to route would also use the in-tree expat (bsdxml.h)
> parser that's available.
>
> The problem that it solves from my perspective is that its a step
> towards eliminating the amount of complex networking configuration
> that I have to maintain in my rc.conf which for me and I'm sure for
> anybody who has tried to build segmented networks for jails, and
> virtual machines it has potential to get pretty ridiculous, especially
> routes: https://termbin.com/lrt80
>
> And even if I didn't have to use epairs and could use something like
> say... if_mpe if it existed, rc.conf would still be less than ideal
> for static protocol routing; BGP isn't even an option here yet that's
> something else I want to work towards.
>
> I have to run, I've been working on this all morning, and made lots of
> progress testing. I'll follow up this evening.
>


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokGLQ4Eu72GFDZ43_0rWJ3ZRRcn4XjBkGkWLtNnJT98cQ>