Xavier de Gaye <xdeg...@gmail.com> added the comment:

On archlinux it is easy to know precisely what patches are applied to iproute2 
and how it is built (see 
https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/iproute2).

The attached two files, archlinux-ip_link.strace and 
archlinux-ip_link_list.strace, contain the output of strace run on the commands 
'ip link' and 'ip link list' on archlinux.
* For 'ip link', the sendto() syscall uses RTM_GETLINK to get information about 
a specific network interface.
* For 'ip link list', this sendto() syscall is preceded by another sendto() 
syscall using RTM_NEWLINK to *create* information about a specific network 
interface.

Conclusions:
1) Both commands are not equivalent, this seems to be a bug in iproute2 or its 
documentation (I did not read the whole iproute2 documentation).
2) By using RTM_NEWLINK, 'ip link list' requests a write-like operation that 
may be denied by SELinux if there is no policy that allows netlink_route_socket 
(nlmsg_write). I may be wrong but on Android API 26 it seems that only few 
processes get that permission: dhcp, clatd, logd, netd, rild, ...
3) From Python perspective it is more robust to call 'ip link' to handle 
platforms where SELinux is run in enforcing mode.

I will update the PR to do only that change: s/ip link list/ip link/

----------
versions: +Python 3.6
Added file: https://bugs.python.org/file47327/archlinux-ip_link_list.strace

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32199>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to