Re: Netstat -i 5-character interface name length?
- In reply to: Mike Karels: "Re: Netstat -i 5-character interface name length?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 03 Jul 2022 20:21:30 UTC
On 2 Jul 2022, at 10:11, Mike Karels wrote: > On 1 Jul 2022, at 4:11, Ronald Klop wrote: > >> Van: George Michaelson <ggm@algebras.org> >> Datum: vrijdag, 1 juli 2022 00:50 >> Aan: "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net> >> CC: mike tancsa <mike@sentex.net>, Chris Ross >> <cross+freebsd@distal.com>, freebsd-net@freebsd.org >> Onderwerp: Re: Netstat -i 5-character interface name length? >>> >>> Is there a reason (avoid bikeshedding) the field width can't be >>> increased to allow the bgeXhexIsVeryLong0 names to work? >> >> >> I agree. I hope POLA is more leaning towards "why does netstat not >> print the interface name correctly?" than "my 15 year old script >> parsing the output of netstat doesn't understand strings longer than >> 5 chars". >> $ netstat -i | grep Link >> Name Mtu Network Address Ipkts Ierrs Idrop >> Opkts Oerrs Coll >> genet 1500 <Link#1> dc:a6:32:da:f4:3b 62095311 0 0 >> 105591894 0 0 >> lo0 16384 <Link#2> lo0 1 0 0 >> 1 0 0 >> bridg 1500 <Link#3> 58:9c:fc:00:3e:aa 18616989 0 0 >> 18652615 8 0 >> vlan3 1500 <Link#4> dc:a6:32:da:f4:3b 9673278 0 0 >> 5695824 8 0 >> epair 1500 <Link#5> 02:c8:49:24:bd:0a 3041667 0 0 >> 4467006 17 0 >> epair 1500 <Link#7> 02:d5:f0:fe:9e:0a 1529717 0 0 >> 1932170 17 0 >> epair 1500 <Link#9> 02:96:17:58:ce:0a 2384154 0 0 >> 4740683 17 0 >> epair 1500 <Link#11> 02:b2:7f:d6:da:0a 8746 0 0 >> 22125 22 0 >> epair 1500 <Link#17> 02:81:38:75:d1:0a 87264 0 0 >> 178535 21 0 >> epair 1500 <Link#19> 02:ad:f2:49:60:0a 78055 0 0 >> 160252 21 0 >> epair 1500 <Link#21> 02:0d:07:81:b2:0a 1814108 0 0 >> 1455889 16 0 >> >> So all "default" interface names do not fit. I don't like the >> solution of "rename all your interfaces" as I think the >> out-of-the-box experience can be made better. >> I'll vote for enabling -W by default and add an option for backwards >> compatibility. > > -W makes the address field unnecessarily wide for most users, at least > if IPv6 is enabled. However, netstat already has code to figure out > the required field width to avoid truncating names, which it uses only > for -W. I’d suggest that this should be done unconditionally, as > the > output makes no sense if names are ambiguous. This is a trivial > change > (I just tested it). Any comments or objections? I’ll put it in > review. It’s https://reviews.freebsd.org/D35703. Mike > >> Regards, >> Ronald. >> >> >> >> > >>> I'm not saying "you can alias around this" is bad, but I sense we're >>> walking into a world which is where Linux is, with every physical >>> device called eth0/1/2 and then "which" device is eth0 becomes a >>> question.. >>> >>> On Fri, Jul 1, 2022 at 1:17 AM Rodney W. Grimes >>> <freebsd-rwg@gndrsh.dnsmgr.net> wrote: >>> > >>> > [ Charset UTF-8 unsupported, converting... ] >>> > > On 6/29/2022 10:56 AM, Chris Ross wrote: >>> > > > Hello folks. ?I just noticed something that I?m sure has been >>> true >>> > > > forever, but I checked and it?s still true on my 12.3-STABLE >>> system. >>> > > > >>> > > One of the first local mods I do is alias netstat to netstat -W >>> for this >>> > > reason. e.g. >>> > > alias netstat?? netstat -W >>> > > >>> > > in /etc/csh.cshrc >>> > >>> > That only fixes it for your interactive csh processes, the >>> > original poster had specifically mentioned output from >>> > periodic scrips, aka daily iirc. >>> > >>> > One thing that can be done to mitigate the long vlan >>> > dev name (imho the vlan driver should of just named >>> > itself much short, like "vl", as most network devices >>> > are 2 litter names anyway) is to use the "name" option >>> > of ifconfig to give them a better name than the default. >>> > >>> > ifconfig vlan2 create vlandev em0 vlan 2 name v2 >>> > >>> > -- >>> > Rod Grimes >>> rgrimes@freebsd.org >>> > >>>