This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients David.Edelsohn, Michael.Felt, pitrou, serhiy.storchaka, vstinner
Date 2018-10-28.17:55:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1540749327.92.0.788709270274.issue28009@psf.upfronthosting.co.za>
In-reply-to
Content
re; the current status of PR8672 - which I shall probably close as it no longer merges.

@taleinat re: the need for lambda

As _find_mac_netstat() is only called once the need for the last two arguments may be unnecessary. My reason for including them was to keep _find_mac_netstat comparable to _find_mac.

1) I am reluctant to make changes to historical code, however, in this case it was needed as _find_mac has, imho, a requirement for input that differs from AIX netstat.

* On linux (debian, centos) I do not find a MAC address for netstat
* On linux, where, e.g., ifconfig does return a value - the lambda i: i±1 is vital as the value follows the keyword on the same line.
For AIX lambda I: i is needed because only the first line (header) has keywords, the remaining lines give the values.

Linux: ifconfig (keyword "ether")

root@x074:~# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.129.74  netmask 255.255.255.0  broadcast 192.168.129.255
        inet6 fe80::f8d1:81ff:fe12:b104  prefixlen 64  scopeid 0x20<link>
        inet6 2001:981:56fd:1:f8d1:81ff:fe12:b104  prefixlen 64  scopeid 0x0<global>
        ether fa:d1:81:12:b1:04  txqueuelen 1000  (Ethernet)
        RX packets 1605776  bytes 177990366 (169.7 MiB)
        RX errors 0  dropped 1027921  overruns 0  frame 0
        TX packets 25045  bytes 1567902 (1.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20


So, when the keyword is found, as each word on the line is examined "i+1" gives the value

For AIX (in anycase), the keyword is Address - the output is:
michael@x071:[/data/prj/python/git/python3-3.8]netstat -ia
Name  Mtu   Network     Address           Ipkts Ierrs    Opkts Oerrs  Coll
en0   1500  link#2      fa.d1.8c.f7.62.4 2348009992     0 946551098     0     0
                        01:00:5e:00:00:01
en0   1500  192.168.129 x071             2348009992     0 946551098     0     0
                        224.0.0.1
en0   1500  192.168.90  x071             2348009992     0 946551098     0     0
                        224.0.0.1
en1   1500  link#3      fa.d1.8c.f7.62.5 64346336     0 89935059     0     0
                        01:00:5e:00:00:01
en1   1500  192.168.2   mail.aixtools.xx 64346336     0 89935059     0     0
                        224.0.0.1

Note - the value with colons - as many (all?) other systems - this seems to be a constant, and a value on a line all by itself - so the old code could never ever find it, even if it could have parsed it. The actual MAC address is on a line with several entries - matching the values given by the "header" line - so lambda i: i is needed to examine the later lines to find a suitably formatted value.

So, should I write _find_mac_netstat for AIX only (and maybe set "skipIf" Linux). There are many assumptions in this code. I do not feel qualified to change things I cannot test - so, as much as possible I follow the tried and true.

I hope this clarifies my intent well enough that you can make a decision.
History
Date User Action Args
2018-10-28 17:55:28Michael.Feltsetrecipients: + Michael.Felt, pitrou, vstinner, serhiy.storchaka, David.Edelsohn
2018-10-28 17:55:27Michael.Feltsetmessageid: <1540749327.92.0.788709270274.issue28009@psf.upfronthosting.co.za>
2018-10-28 17:55:27Michael.Feltlinkissue28009 messages
2018-10-28 17:55:27Michael.Feltcreate