dissector: do not set invalid PPP protocol
authorBoris Sukholitko <boris.sukholitko@broadcom.com>
Wed, 29 Sep 2021 11:32:23 +0000 (14:32 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Sep 2021 12:09:28 +0000 (13:09 +0100)
The following flower filter fails to match non-PPP_IP{V6} packets
wrapped in PPP_SES protocol:

tc filter add dev eth0 ingress protocol ppp_ses flower \
        action simple sdata hi64

The reason is that proto local variable is being set even when
FLOW_DISSECT_RET_OUT_BAD status is returned.

The fix is to avoid setting proto variable if the PPP protocol is unknown.

Signed-off-by: Boris Sukholitko <boris.sukholitko@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/flow_dissector.c

index bac0184..7d0a9f8 100644 (file)
@@ -1196,9 +1196,8 @@ proto_again:
                        break;
                }
 
-               proto = hdr->proto;
                nhoff += PPPOE_SES_HLEN;
-               switch (proto) {
+               switch (hdr->proto) {
                case htons(PPP_IP):
                        proto = htons(ETH_P_IP);
                        fdret = FLOW_DISSECT_RET_PROTO_AGAIN;