diff mbox series

[net-next] net: flow_dissector: do not set invalid PPP protocol

Message ID 20211003071345.1661-1-boris.sukholitko@broadcom.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: flow_dissector: do not set invalid PPP protocol | expand

Checks

Context Check Description
netdev/apply fail Patch does not apply to net-next
netdev/tree_selection success Clearly marked for net-next

Commit Message

Boris Sukholitko Oct. 3, 2021, 7:13 a.m. UTC
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>
---
 net/core/flow_dissector.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Boris Sukholitko Oct. 3, 2021, 7:38 a.m. UTC | #1
Hi,

Please disregard, I see that the patch has been applied already.

My feeble defense is that the previous patch has "Not Applicable" state
on patchwork for some reason:

https://patchwork.kernel.org/project/netdevbpf/patch/20210929113223.22108-1-boris.sukholitko@broadcom.com/

Thanks,
Boris.

On Sun, Oct 03, 2021 at 10:13:45AM +0300, Boris Sukholitko wrote:
> 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>
> ---
>  net/core/flow_dissector.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index bac0184cf3de..7d0a9f84aaf7 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -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;
> -- 
> 2.29.2
>
diff mbox series

Patch

diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index bac0184cf3de..7d0a9f84aaf7 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -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;