Commit 1c4f0197 authored by Daniel Lezcano's avatar Daniel Lezcano Committed by David S. Miller

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.
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@free.fr>
Reported-by: default avatarStephane Riviere <stephane.riviere@regis-dgac.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 31f634a6
...@@ -2169,8 +2169,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, ...@@ -2169,8 +2169,6 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd,
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
case SIOCSIFDSTADDR: case SIOCSIFDSTADDR:
case SIOCSIFFLAGS: case SIOCSIFFLAGS:
if (!net_eq(sock_net(sk), &init_net))
return -ENOIOCTLCMD;
return inet_dgram_ops.ioctl(sock, cmd, arg); return inet_dgram_ops.ioctl(sock, cmd, arg);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment