diff options
author | Mathias Kresin <dev@kresin.me> | 2021-10-23 21:14:04 +0200 |
---|---|---|
committer | Mathias Kresin <dev@kresin.me> | 2021-11-02 22:36:41 +0100 |
commit | f7f12495bc9725e221b595680c47c4240d437abb (patch) | |
tree | 20d48567502eee6745f2a0c5e61273cebb99f3e8 /target/linux | |
parent | 1470009bf88ddde3c5e22ecb8e0f38d20757d6bd (diff) | |
download | upstream-f7f12495bc9725e221b595680c47c4240d437abb.tar.gz upstream-f7f12495bc9725e221b595680c47c4240d437abb.tar.bz2 upstream-f7f12495bc9725e221b595680c47c4240d437abb.zip |
kernel: 5.10: simplify logic in packet mangling patch
I had quite a hard time to understand what the change to net/core/dev.c
is supposed to do.
Simplify the change by returning NETDEV_TX_OK in case a eth_mangle_tx
callback was set but returned NULL instead of setting the return value
in the else branch.
Signed-off-by: Mathias Kresin <dev@kresin.me>
Diffstat (limited to 'target/linux')
-rw-r--r-- | target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch index f656472ef9..26ed829363 100644 --- a/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch +++ b/target/linux/generic/hack-5.10/721-net-add-packet-mangeling.patch @@ -105,33 +105,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name> help --- a/net/core/dev.c +++ b/net/core/dev.c -@@ -3638,11 +3638,21 @@ static int xmit_one(struct sk_buff *skb, +@@ -3638,6 +3638,11 @@ static int xmit_one(struct sk_buff *skb, if (dev_nit_active(dev)) dev_queue_xmit_nit(skb, dev); -- len = skb->len; -- PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies); -- trace_net_dev_start_xmit(skb, dev); -- rc = netdev_start_xmit(skb, dev, txq, more); -- trace_net_dev_xmit(skb, rc, dev, len); +#ifdef CONFIG_ETHERNET_PACKET_MANGLE -+ if (!dev->eth_mangle_tx || -+ (skb = dev->eth_mangle_tx(dev, skb)) != NULL) -+#else -+ if (1) ++ if (dev->eth_mangle_tx && !(skb = dev->eth_mangle_tx(dev, skb))) ++ return NETDEV_TX_OK; +#endif -+ { -+ len = skb->len; -+ PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies); -+ trace_net_dev_start_xmit(skb, dev); -+ rc = netdev_start_xmit(skb, dev, txq, more); -+ trace_net_dev_xmit(skb, rc, dev, len); -+ } else { -+ rc = NETDEV_TX_OK; -+ } - - return rc; - } ++ + len = skb->len; + PRANDOM_ADD_NOISE(skb, dev, txq, len + jiffies); + trace_net_dev_start_xmit(skb, dev); --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -60,6 +60,7 @@ |