gre6/tunnel: Do not submit garbage in flowinfo
We always send flowinfo to the kernel. If flowlabel/tclass was set first to non-inherit value and then reset to inherit we do not clear flowlabel/tclass part in flowinfo, send it to kernel and can get from the kernel back. Even if we check for IP6_TNL_F_USE_ORIG_TCLASS and IP6_TNL_F_USE_ORIG_FLOWLABEL when printing options sending invalid flowlabel/tclass to the kernel seems bad idea. Note that ip6tnl always clean corresponding flowinfo parts on inherit. Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
This commit is contained in:
parent
147ade01b0
commit
afdf9277eb
|
|
@ -251,12 +251,12 @@ get_failed:
|
||||||
__u8 uval;
|
__u8 uval;
|
||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
flowinfo &= ~IP6_FLOWINFO_TCLASS;
|
||||||
if (strcmp(*argv, "inherit") == 0)
|
if (strcmp(*argv, "inherit") == 0)
|
||||||
flags |= IP6_TNL_F_USE_ORIG_TCLASS;
|
flags |= IP6_TNL_F_USE_ORIG_TCLASS;
|
||||||
else {
|
else {
|
||||||
if (get_u8(&uval, *argv, 16))
|
if (get_u8(&uval, *argv, 16))
|
||||||
invarg("invalid TClass", *argv);
|
invarg("invalid TClass", *argv);
|
||||||
flowinfo &= ~IP6_FLOWINFO_TCLASS;
|
|
||||||
flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
|
flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
|
||||||
flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
|
flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
|
||||||
}
|
}
|
||||||
|
|
@ -265,6 +265,7 @@ get_failed:
|
||||||
__u32 uval;
|
__u32 uval;
|
||||||
|
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
|
flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
|
||||||
if (strcmp(*argv, "inherit") == 0)
|
if (strcmp(*argv, "inherit") == 0)
|
||||||
flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
|
flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
|
||||||
else {
|
else {
|
||||||
|
|
@ -272,7 +273,6 @@ get_failed:
|
||||||
invarg("invalid Flowlabel", *argv);
|
invarg("invalid Flowlabel", *argv);
|
||||||
if (uval > 0xFFFFF)
|
if (uval > 0xFFFFF)
|
||||||
invarg("invalid Flowlabel", *argv);
|
invarg("invalid Flowlabel", *argv);
|
||||||
flowinfo &= ~IP6_FLOWINFO_FLOWLABEL;
|
|
||||||
flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
|
flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
|
||||||
flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
|
flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue