packet : remove init_net restriction
Subsystems (3)
PATCH 1/1 packet : remove init_net restriction
The af_packet protocol is used by Perl to do ioctls as reported by Stephane Riviere:
"Net::RawIP relies on SIOCGIFADDR et SIOCGIFHWADDR to get the IP and MAC addresses of the network interface."
But in a new network namespace these ioctl fail because it is disabled for a namespace different from the init_net_ns.
These two lines should not be there as af_inet and af_packet are namespace aware since a long time now. I suppose we forget to remove these lines because we sent the af_packet first, before af_inet was supported.
--- net/packet/af_packet.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
net/packet/af_packet.c +0 -2
@@ -2169,8 +2169,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,case SIOCGIFDSTADDR :case SIOCSIFDSTADDR :case SIOCSIFFLAGS : -if (!net_eq (sock_net (sk), &init_net)) -return -ENOIOCTLCMD ;return inet_dgram_ops.ioctl (sock, cmd, arg);#endif
Signature · 1 line
1.6.3.3
Quoted 25 lines · Daniel Lezcano
The
af_packetprotocol is used by Perl to do ioctls as reported by Stephane Riviere:"
Net::RawIPrelies on SIOCGIFADDR et SIOCGIFHWADDR to get the IP and MAC addresses of the network interface."But in a new network namespace these ioctl fail because it is disabled for a namespace different from the
init_net_ns.These two lines should not be there as
af_inetandaf_packetare namespace aware since a long time now. I suppose we forget to remove these lines because we sent theaf_packetfirst, beforeaf_inetwas supported.Signed-off-by Daniel Lezcano <[email protected]>Reported-by Stephane Riviere <[email protected]>--- net/packet/af_packet.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)net/packet/af_packet.c +0
-0
net/packet/af_packet.c static int packet_ioctl(struct socket *sock, unsigned int cmd, · line 2174
Quoted 8 lines
net/packet/af_packet.c +0
-2@@ -2169,8 +2169,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,case SIOCGIFDSTADDR :case SIOCSIFDSTADDR :case SIOCSIFFLAGS : -if (!net_eq (sock_net (sk), &init_net)) -return -ENOIOCTLCMD ;return inet_dgram_ops.ioctl (sock, cmd, arg);#endif
Shall I send it against net-next-2.6 ?
Thanks
-- Daniel
David Miller
maintainerFrom: Daniel Lezcano <[email protected]>
Date: Fri, 16 Apr 2010 17:04:28 +0200
Quoted 1 line
Shall I send it against net-next-2.6 ?
No, I'll likely add it to net-2.6, I just haven't gotten around to it yet.
Thanks.
From: Daniel Lezcano <[email protected]>
Date: Thu, 15 Apr 2010 11:11:14 +0200
Quoted 9 lines
The
af_packetprotocol is used by Perl to do ioctls as reported by Stephane Riviere:"
Net::RawIPrelies on SIOCGIFADDR et SIOCGIFHWADDR to get the IP and MAC addresses of the network interface."But in a new network namespace these ioctl fail because it is disabled for a namespace different from the
init_net_ns.
Quoted 6 lines
These two lines should not be there as
af_inetandaf_packetare namespace aware since a long time now. I suppose we forget to remove these lines because we sent theaf_packetfirst, beforeaf_inetwas supported.Signed-off-by Daniel Lezcano <[email protected]>Reported-by Stephane Riviere <[email protected]>
Applied, thanks!