From nobody Tue Jul 28 20:30:26 2026 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4h8nCc3Hkfz6nFkV for ; Tue, 28 Jul 2026 20:30:36 +0000 (UTC) (envelope-from paigeadele@gmail.com) Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4h8nCc1BR5z3Gm6 for ; Tue, 28 Jul 2026 20:30:36 +0000 (UTC) (envelope-from paigeadele@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-39da69c5ba3so1707691fa.1 for ; Tue, 28 Jul 2026 13:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1785270629; cv=none; d=google.com; s=arc-20260327; b=ANoU5SzzRngdnBcJ7QDt3+Iec55bqKQDqSCp1y62lKM0HuUu/c+euizy+mOIB0jBDk Sh0uDIeDl0oVHatgf9V6T4afMNuLOYSalOQL2CYlC5pBTb+0X5BMK7V6XBUQjkmxA1Ue /6pTUhGaP6hGoDuikkZ7pvpLDDTGaGLVd0glYHr8+8t4SDheYs6e6/qNVBWLf0k2lVZe BeJ6xiofEpnArSVe4EZKVqiyiBFed7qnAv8T5DoyrO+hhXGEQOLlOFwD22ZLYM/yOhK7 YhqcZ1koa5QGAUJVzyzLPiHTszgR/mR160WAEAf0qv/Td/6Ai8a+R9qWR7HR4q84YGlx uhhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=b3Ml9n7VUrEAOqoDxXuCFphvxSVhDDx/XCB1g8ASy34=; fh=Z9w6+OTzAtN4IJESASvPCiYZZtJzCBiNPcyM6KoKuiM=; b=eAAciimaWZ3jPMFW4wfU3dfk+l8Mx7bNe5K6BMAJVpsQcnqoIpTw1oP7V1i5s32ndi cOqV4vnnb6bbDMhyvn2f02R4SsGZaCev4EI7LFyTuotTXrEnkjOwzc/toLYRtJDV9U57 MVBXm7u+sLZRvNTl+hFPenyVGaeGaNThiKw7k6zCwZ44wyRMcNOqg+nN2ljOhEC3yZ0h CUuv6fqZixj8IEVJpBQEd54rs/BD85Jt1H7OBE1oKKCxNO3qYlqlBHCq8IhoHk095XLW ibYtXVY8/ifBcKsFH+qHew51hOIh5Hi04SBnHw8kShfDHMtgx9N6coJKCiKpVZfHNNV+ lgpQ==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785270629; x=1785875429; darn=freebsd.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=b3Ml9n7VUrEAOqoDxXuCFphvxSVhDDx/XCB1g8ASy34=; b=EE7nz6waf00xvRH+p3IWbu/M0sRcs7w+f85dTnZDF5rBQLQr4mHvD0KPsjCas9ZwLO /eo9ixHrvDirBvNaJ4nEX18TMsSBv8ScTeNLk/I3Fjzu5qNobwbIoT05kf2Nj1bKauyS KP4ecg/Ata+TuPhAX6ZhKQvupw1FwHBfrCZQpzP9o0+p0dydIpf/DnEp3TqM4tTL17Co HjTIbh7vacimX/WCOgGUgjpihmSA2Ptkfr7VQ26nDZjh1UCoQCOsKC0dUxS/u+NHB0iW A2kBTm+bbPiM0TKrevwRRC3jUTBzscqKkhD9yVPn8vlc78fqmR0rH7wFRCzvJS5+JNDa c/9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785270629; x=1785875429; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=b3Ml9n7VUrEAOqoDxXuCFphvxSVhDDx/XCB1g8ASy34=; b=jJ0q8J0IyUdHVTPtj7esa7zn3KnOkJTRfAzfjEgZfEbDtBLS2Quaq5kMpUJWS4eNwC HWr2bpJIxamCbwS1mA/CUsB/tgH7NmdUtvmcxDBN+KpSe04dFxYT7aO+vmS/MF0W4f7T eltSqRQ9bTBcm1AXo5xdTG3rjWRjHx/qOlZ0E1cPIe6YkSofibrsB0YCg63tqaUQqM5U m2G52aBnql46EJcKKjbSn+C8eKuWjCBfS/ESFVBTegG1rg7hf6lUTfnKcnWuRQs8hnpC bq6iF8i2yVhldqsp8C2rCK0Ds15OJw2O35n4RA70/+rD2oJRquQUj+vYVKNKZkAnOW68 +tIQ== X-Gm-Message-State: AOJu0Yz3b8iicGm72XlByJM196MJQG3kEs+jd9f7qZ18t8txuke0ViBK XRL4S4yuF+IaJTiowMiX4qBjyYHyP6zBvjyQycQfnnzU1Ae4OzW12BqH35xGw0DxTkrXKLW7x6G lSbG0/rZtdRtPHaiTMqAQn14ESqDouzY= X-Gm-Gg: AR+sD13lJMZ8RV0K+3wtWkHrpIiMXb6BtLInnRvWj7EtvcRvvlPTpigm/Q7xfGQksuQ VEUR5hWWGfSmN+0Ro3lnN/dhs66Z4wQlQSK3Ap4S1Pz1oUTS3U7LEh02VdtJLSIYKq1tuffELVH +mgRTYZBw02r2m8S7N4GTmH1Xachzti8zrXI8b2izn33ec3Y5ZQy/4Z6GmiUUi6nj0Ts/RIPhmM 1wbrphuVFOqKWDrGhY5LdAotppU1MZxOXoSfqJKRgXgXYyZ/Xdp07xFbGwF1QvOanUbH0aIi9Ls 69qnv2BWFCjCl0n4U0rY8s7bV5rN9Iint64BDNhJ0kwy4zZINS+otFcr4gGY0h8Uzmm2wzGXmAk = X-Received: by 2002:a05:651c:1504:b0:39b:48c1:8cd4 with SMTP id 38308e7fff4ca-39f51cdc31fmr6775221fa.7.1785270628317; Tue, 28 Jul 2026 13:30:28 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 References: In-Reply-To: From: Paige Thompson Date: Tue, 28 Jul 2026 20:30:26 +0000 X-Gm-Features: AUfX_myVxM05G7VaJGa-gSbmwsYSc_majKLuhFqqpjCxJymGoedO7BpwjrXTqIU Message-ID: Subject: Re: ifconfig patch that introduces --libxo To: Adrian Chadd Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4h8nCc1BR5z3Gm6 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Spamd-Bar: ---- Hey Adrian, Absolutely I am fine with this taking as much time as it needs because I want it to succeed but also the value that it's adding long term I think is pretty substantial. For regression testing like I used: bash -c 'diff -y <(ifconfig) <(./ifconfig)' and I've most of them, I still need to see about fully configured tunnels and CARP interfaces, and possibly some others; I also just discovered that there is a perl script that you can use to lint the formatter strings: ../../contrib/libxo/xolint/xolint.pl: xolint [options] files ... -c invoke 'cpp' on input -C flags Pass flags to cpp -d Show debug output -D Extract xolint documentation -I Print xo_info_t data -p Print input data on errors -V Print vocabulary (list of tags) -X Print examples of invalid use [sq@msi /usr/src/sbin/ifconfig]$ perl ../../contrib/libxo/xolint/xolint.pl = *.c af_inet.c: 96: error: use hyphens, not underscores, for value field name af_inet.c: 96: error: value field name contains invalid character (inet_add= r) af_inet.c: 115: error: use hyphens, not underscores, for value field name which actually brings me to the next thing that I was going to ask about but it sounds like based on the linter I should probably use hyphens instead of underscores xD I'll can come up with some tests in /usr/src/sbin/ifconfig/tests, one that uses the linter tool provided and the regression in terms of how I'm doing it now would be pretty ineffective after the changes are in place (it assumes host's ifconfig hasn't yet been replaced by the one that uses libxo.) > If you're interested in pushing this up for review, I suggest thinking a= bout how to do it piecemeal. Definitely, I have an account on reviews.freebsd.org but I don't currently have permissions for anything so I'm not sure that I can do much with it except for viewing: https://reviews.freebsd.org/p/paige_paige.bio/ and I just verified an updated email for it so it should be good to go if that's the thing I need to use I just need permissions. Could you help me with that or to find the right place if not reviews? Thank you, -Paige On Tue, Jul 28, 2026 at 3:58=E2=80=AFPM Adrian Chadd w= rote: > > 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 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/5dd1b998d599ed7d147fd37a6aa9= 0b2e > > > > 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/d99e6bb0aab4ae2fa6a066217831= 840c > > 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. > >