Tcl Library Source Code

View Ticket
Ticket UUID: 9a21637273b81d3b245d8e3cc38759b1062ac738
Title: nettool cannot parse the ifconfig output
Type: Bug Version: 1.18
Submitter: anonymous Created on: 2018-01-23 04:49:19
Subsystem: nettool Assigned To: hypnotoad
Priority: 5 Medium Severity: Severe
Status: Open Last Modified: 2018-01-23 20:06:42
Resolution: None Closed By: nobody
    Closed on:
Appears that the ifconfig output has been changed (a while ago) and nettool::dump cannot parse it anymore.

An example of an old version:
lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:11582962 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11582962 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:208725263600 (194.3 GiB)  TX bytes:208725263600 (194.3 GiB)

And a new one:
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 11577619  bytes 208724261162 (194.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11577619  bytes 208724261162 (194.3 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Also, it should be mentioned that (at least for Debian) there's an idea to drop
net-tools (from which ifconfig and arp are) eventually.

So I would suggest to replace ifconfig by 'ip address show' and arp by simply parsing /proc/net/arp. I don't know what happens on Macosx, so I came with a patch for Linux only.