Skip to content

Commit

Permalink
dissector: do not set invalid PPP protocol
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Boris Sukholitko authored and David S. Miller committed Sep 30, 2021
1 parent 55b115c commit 2e861e5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/core/flow_dissector.c
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,8 @@ bool __skb_flow_dissect(const struct net *net,
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;
Expand Down

0 comments on commit 2e861e5

Please sign in to comment.