When non IP packets are sent on TUN interface, the logic put Ipv6 as
protocol field in header. With the current patch, the check is modified
for ipv4, ipv6 and non ip.

Fixes: 5a3efcfffd06 ("net/tap: add tun support")
Cc: [email protected]

Suggested-by: Ophir Munk <[email protected]>
Signed-off-by: Vipin Varghese <[email protected]>
---
 drivers/net/tap/rte_eth_tap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 915d937..66e026f 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -526,8 +526,8 @@ enum ioctl_mode {
                 */
                char *buff_data = rte_pktmbuf_mtod(seg, void *);
                j = (*buff_data & 0xf0);
-               if (j & (0x40 | 0x60))
-                       pi.proto = (j == 0x40) ? 0x0008 : 0xdd86;
+               pi.proto = (j == 0x40) ? 0x0008 :
+                               (j == 0x60) ? 0xdd86 : 0x00;
 
                iovecs[0].iov_base = &pi;
                iovecs[0].iov_len = sizeof(pi);
-- 
1.9.1

Reply via email to