From nobody Tue Jul 28 15:58:35 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 4h8gB12S1dz6mwXF for ; Tue, 28 Jul 2026 15:58:49 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (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 4h8gB03S31z3T6Q for ; Tue, 28 Jul 2026 15:58:48 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none); arc=pass ("google.com:s=arc-20260327:i=1"); spf=pass (mx1.freebsd.org: domain of adrian.chadd@gmail.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=adrian.chadd@gmail.com Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-92e7632b193so1890785a.2 for ; Tue, 28 Jul 2026 08:58:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1785254327; cv=none; d=google.com; s=arc-20260327; b=FGm+It+6d3Ve8EpMzYJIQWHp3+NmztXEZr5nmalYTDJMEyHnVZmn0rEd91NhIyuY/8 EASH50aZ4XKBUm9brCQFIKt03uZVrnlgXH2C5/+96RPJOmiCo23HkV1LqepCapwuj6yk VvcA+LINQ5G84+If8fxwKxm5Qaap6Vglu8BZxsPVLOjdgr4HrXmjRVZYDBxzHOxxC+fP Htb0EyzdsSIJ5aXJe2GZCodT3sS43MhdOShwdKzozsof0/mrLDS8vpvEPOkYLDEY/B5L 34DeyipwzTVBfv5cj6fk+BpQiGxq4wRLTgm6MBkzlvCdtvUOCo8daX0YrdMU3qK2iFxh AVuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version; bh=G0lyF3lpZuJ8ljjlYjRQXNGlTRz6nA94k4eFKKAgOMI=; fh=K/rW1OKQLxYHS2Q6B3ypbAZF4mlthxbdY4lGupD/2n0=; b=YZShAzq1E033cLUJnctJB6rAereBP0tllFM2BpADy6BLYk8Dmncm6kV6wV+zzx6Ti6 rw0GuDy/ZR67LNaP8pyNKVis+J1K481HU8MXzdQ+VW+JRCN9s44eCcpughyHN9vqgTQK CtEY39iYGD/vPIpHBEhZdjxZhRcGH4zExUHwaFCUBVTTACw7YBFs80xlRpNoWIugL/aV SAf07JKj4CIabL7G2/v78OrsEtm9JluXK9QwVGfrMSxyiI7g5SEZbOL6HPdcTaIR6qEq texAYyZKWTb1KQRrIP2ajh+uB4S9VBFPCZklAZvdwiz038jITdtnHjYJMJoGoA1Hr6Js OGsA==; darn=freebsd.org ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785254327; x=1785859127; h=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=G0lyF3lpZuJ8ljjlYjRQXNGlTRz6nA94k4eFKKAgOMI=; b=Rx8U1wEPjGA7qUCcV1tnm0xAL6M8LE95iJPinKcVGzax5Z9kjEt4dEjrW2DqGC3jR/ 08qu5luiyHtlcvKIGcgbFbprlgjcptDjSbt8/5TqEuLDvnzQJ+0i0BNbqDjhNxH0IIMa bXbJj7NY8Uepdzchdgw/b5JRUyNPsCG/GM3qsh+tw+GIdJ7TBBlcJbvAxuXtQxLOjFh8 OdcZ0DUqHIFLhVkD6CZivutH7jvMnii6yBJka8JTc6m+IwsxG7V6b3PmmDMPPcJGPKyP T3aVMWruIRnfhk7KWJgltkuiGMDwRDO3ol+C04ASmXfLIpW98uqujccvu6GmndZZV3ax yCIA== X-Gm-Message-State: AOJu0YzcQgKp5fb2405IvbZ7ZxuSZUbvsDm/OL7xY8T5H1xMaegf8Yhw 3bus7df0+l/tn0Q8qrcGqiRM8/2/rE6KLYq7v23gYrs/HCbbGNDf5d9NJ46u+RK5A4xjzmdH71j CFz/UbYYag7rYySPsoOYTiGtZq9rP3j7N/w== X-Gm-Gg: AR+sD13hgNWLFtsGYBGbyBGS78IQbmvyzhciMvOCdqIbwVjx8z5AjHzB/NxzWzcQXs+ oWpfzM8ZG8SNjD2ab5JS00nnxrxDesL74sUXP6Fo6fDO/WsullyCfvoCEHhg/hC4QWHGGDOyCVH rsx8j0BDIedMiUMJT+VMxl+MVeJbTI87Q/k3fOAzXl6axYJ5LoaIFrJ8bzvK55vWxdx0CpNfoA4 2KijbaDAMTEpsENAWDBin7XJU2a9gGGQI8qtxEoYEkz/2vNbM/mUar0gdC1lYG/nU2oPSy/XxaR 3/8zkVwLs9WhOrVJ9vgxBX6Ye7vKLmEbK7lCyjqWTqZPHKjrFd1C4m5x/NSFkbOURAW5Q6MI5iD 83MNnEWvCXpNoOEXNHq30GQHUhHtuPMttWfAw X-Received: by 2002:a05:620a:2947:b0:92e:c118:18c2 with SMTP id af79cd13be357-933027d74ccmr284091685a.77.1785254327332; Tue, 28 Jul 2026 08:58:47 -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: Adrian Chadd Date: Tue, 28 Jul 2026 08:58:35 -0700 X-Gm-Features: AUfX_mySFZRj7_CIE-W_LlnwQ0RavbT-dZbYkTx0nB-UuOSVMPNuwp-oCaFgaB0 Message-ID: Subject: Re: ifconfig patch that introduces --libxo To: Paige Thompson Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Spamd-Result: default: False [-3.04 / 15.00]; ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1]; NEURAL_HAM_SHORT(-1.00)[-0.999]; NEURAL_HAM_MEDIUM(-0.72)[-0.720]; NEURAL_HAM_LONG(-0.42)[-0.421]; FORGED_SENDER(0.30)[adrian@freebsd.org,adrianchadd@gmail.com]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none]; RCVD_TLS_LAST(0.00)[]; TAGGED_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; MISSING_XM_UA(0.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[adrian@freebsd.org,adrianchadd@gmail.com]; RCVD_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.222.177:from]; RCVD_IN_DNSWL_NONE(0.00)[209.85.222.177:from] X-Rspamd-Queue-Id: 4h8gB03S31z3T6Q X-Spamd-Bar: --- 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/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. >