[New-bugs-announce] [issue28545] socket.bind to AF_PACKET should use passed interface name

Martin Turon report at bugs.python.org
Thu Oct 27 14:14:58 EDT 2016


New submission from Martin Turon:

When binding to AF_PACKET linux kernel sockets, the interface name is not passed in when given -- it is always "".  This causes problems, for example, receiving packets to a "monitor0" interface doesn't work.

diff -r a6548e230ed6 Modules/socketmodule.c
--- a/Modules/socketmodule.c    Thu Oct 27 19:33:22 2016 +0300
+++ b/Modules/socketmodule.c    Thu Oct 27 11:13:12 2016 -0700
@@ -1344,6 +1344,7 @@
     {
         struct sockaddr_ll *a = (struct sockaddr_ll *)addr;
         char *ifname = "";
+        // ^^ ifname should be set to interface name passed in via sockaddr.
         struct ifreq ifr;
         /* need to look up interface name give index */
         if (a->sll_ifindex) {

----------
messages: 279558
nosy: mturon
priority: normal
severity: normal
status: open
title: socket.bind to AF_PACKET should use passed interface name

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28545>
_______________________________________


More information about the New-bugs-announce mailing list