mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
gre: fix a regression in ioctl
[ Upstream commit6c734fb859] When testing GRE tunnel, I got: # ip tunnel show get tunnel gre0 failed: Invalid argument get tunnel gre1 failed: Invalid argument This is a regression introduced by commitc544193214("GRE: Refactor GRE tunneling code.") because previously we only check the parameters for SIOCADDTUNNEL and SIOCCHGTUNNEL, after that commit, the check is moved for all commands. So, just check for SIOCADDTUNNEL and SIOCCHGTUNNEL. After this patch I got: # ip tunnel show gre0: gre/ip remote any local any ttl inherit nopmtudisc gre1: gre/ip remote 192.168.122.101 local 192.168.122.45 ttl inherit Signed-off-by: Cong Wang <amwang@redhat.com> Cc: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
51778da544
commit
3d3fa8bca3
@@ -503,10 +503,11 @@ static int ipgre_tunnel_ioctl(struct net_device *dev,
|
||||
|
||||
if (copy_from_user(&p, ifr->ifr_ifru.ifru_data, sizeof(p)))
|
||||
return -EFAULT;
|
||||
if (p.iph.version != 4 || p.iph.protocol != IPPROTO_GRE ||
|
||||
p.iph.ihl != 5 || (p.iph.frag_off&htons(~IP_DF)) ||
|
||||
((p.i_flags|p.o_flags)&(GRE_VERSION|GRE_ROUTING))) {
|
||||
return -EINVAL;
|
||||
if (cmd == SIOCADDTUNNEL || cmd == SIOCCHGTUNNEL) {
|
||||
if (p.iph.version != 4 || p.iph.protocol != IPPROTO_GRE ||
|
||||
p.iph.ihl != 5 || (p.iph.frag_off&htons(~IP_DF)) ||
|
||||
((p.i_flags|p.o_flags)&(GRE_VERSION|GRE_ROUTING)))
|
||||
return -EINVAL;
|
||||
}
|
||||
p.i_flags = gre_flags_to_tnl_flags(p.i_flags);
|
||||
p.o_flags = gre_flags_to_tnl_flags(p.o_flags);
|
||||
|
||||
Reference in New Issue
Block a user