Skip to contentSkip to conversation

ipvlan: Fix return value of ipvlan_queue_xmit()

PATCH In review Cambda Zhu 2 participants 3 messages Jun 16, 2023

Subsystems (2)
lore
Share & tools
lore

Cambda Zhu

author
#0 lore raw

PATCH 1/1 ipvlan: Fix return value of ipvlan_queue_xmit()

The ipvlan_queue_xmit() should return NET_XMIT_XXX,
but ipvlan_xmit_mode_l2/l3() returns rx_handler_result_t or NET_RX_XXX in some cases. The skb to forward could be treated as xmitted successfully.

---
 drivers/net/ipvlan/ipvlan_core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ipvlan/ipvlan_core.c +6 -3
index ab5133eb1d51..e45817caaee8 100644
@@ -585,7 +585,8 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, struct net_device *dev)
 				consume_skb(skb);
 				return NET_XMIT_DROP;
 			}
-			return ipvlan_rcv_frame(addr, &skb, true);
+			ipvlan_rcv_frame(addr, &skb, true);
+			return NET_XMIT_SUCCESS;
 		}
 	}
 out:
@@ -611,7 +612,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
 					consume_skb(skb);
 					return NET_XMIT_DROP;
 				}
-				return ipvlan_rcv_frame(addr, &skb, true);
+				ipvlan_rcv_frame(addr, &skb, true);
+				return NET_XMIT_SUCCESS;
 			}
 		}
 		skb = skb_share_check(skb, GFP_ATOMIC);
@@ -623,7 +625,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
 		 * the skb for the main-dev. At the RX side we just return
 		 * RX_PASS for it to be processed further on the stack.
 		 */
-		return dev_forward_skb(ipvlan->phy_dev, skb);
+		dev_forward_skb(ipvlan->phy_dev, skb);
+		return NET_XMIT_SUCCESS;
 
 	} else if (is_multicast_ether_addr(eth->h_dest)) {
 		skb_reset_mac_header(skb);
Signature · 1 line
2.16.6
#1 lore raw
Quoted 7 lines · Cambda Zhu

The ipvlan_queue_xmit() should return NET_XMIT_XXX,
but ipvlan_xmit_mode_l2/l3() returns rx_handler_result_t or NET_RX_XXX in some cases. The skb to forward could be treated as xmitted successfully.

Please make sure to CC ipvlan author ?

CC Mahesh

Quoted 41 lines
---
 drivers/net/ipvlan/ipvlan_core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ipvlan/ipvlan_core.c +6 -4
index ab5133eb1d51..e45817caaee8 100644
@@ -585,7 +585,8 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, struct net_device *dev)
                                consume_skb(skb);
                                return NET_XMIT_DROP;
                        }
-                       return ipvlan_rcv_frame(addr, &skb, true);
+                       ipvlan_rcv_frame(addr, &skb, true);
+                       return NET_XMIT_SUCCESS;
                }
        }
 out:
@@ -611,7 +612,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
                                        consume_skb(skb);
                                        return NET_XMIT_DROP;
                                }
-                               return ipvlan_rcv_frame(addr, &skb, true);
+                               ipvlan_rcv_frame(addr, &skb, true);
+                               return NET_XMIT_SUCCESS;
                        }
                }
                skb = skb_share_check(skb, GFP_ATOMIC);
@@ -623,7 +625,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
                 * the skb for the main-dev. At the RX side we just return
                 * RX_PASS for it to be processed further on the stack.
                 */
-               return dev_forward_skb(ipvlan->phy_dev, skb);
+               dev_forward_skb(ipvlan->phy_dev, skb);
+               return NET_XMIT_SUCCESS;
 
        } else if (is_multicast_ether_addr(eth->h_dest)) {
                skb_reset_mac_header(skb);
--

2.16.6

author
#2 lore raw
Quoted 52 lines · Eric Dumazet
Quoted 7 lines · Cambda Zhu

The ipvlan_queue_xmit() should return NET_XMIT_XXX,
but ipvlan_xmit_mode_l2/l3() returns rx_handler_result_t or NET_RX_XXX in some cases. The skb to forward could be treated as xmitted successfully.

Please make sure to CC ipvlan author ?

CC Mahesh

Quoted 36 lines

---
drivers/net/ipvlan/ipvlan_core.c | 9 ++++++---

1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ipvlan/ipvlan_core.c +2 -1
index ab5133eb1d51..e45817caaee8 100644
@@ -585,7 +585,8 @@ static int ipvlan_xmit_mode_l3(struct sk_buff *skb, struct net_device *dev)
                               consume_skb(skb);
                               return NET_XMIT_DROP;
                       }
-                       return ipvlan_rcv_frame(addr, &skb, true);
+                       ipvlan_rcv_frame(addr, &skb, true);
+                       return NET_XMIT_SUCCESS;
               }
       }

out:

drivers/net/ipvlan/ipvlan_core.c +4 -2
@@ -611,7 +612,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
                                       consume_skb(skb);
                                       return NET_XMIT_DROP;
                               }
-                               return ipvlan_rcv_frame(addr, &skb, true);
+                               ipvlan_rcv_frame(addr, &skb, true);
+                               return NET_XMIT_SUCCESS;
                       }
               }
               skb = skb_share_check(skb, GFP_ATOMIC);
@@ -623,7 +625,8 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
                * the skb for the main-dev. At the RX side we just return
                * RX_PASS for it to be processed further on the stack.
                */
-               return dev_forward_skb(ipvlan->phy_dev, skb);
+               dev_forward_skb(ipvlan->phy_dev, skb);
+               return NET_XMIT_SUCCESS;
 
Quoted 4 lines
Quoted 4 lines
drivers/net/ipvlan/ipvlan_core.c +0 -1
       } else if (is_multicast_ether_addr(eth->h_dest)) {
               skb_reset_mac_header(skb);
--

2.16.6

I have resubmitted v1 patch with Fixes tag and CC Mahesh via reply.

Thanks!
Cambda