[PATCH v3 03/10] net/tap: clarify TUN/TAP flag assignment

Stephen Hemminger
2026-02-20T05:04:39Z

Add parentheses in the ternary expression that relied on operator
precedence between '?:' and '|'. No functional change.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/tap/rte_eth_tap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index aa236cf967..e06e1ca079 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -155,7 +155,8 @@ tun_alloc(struct pmd_internals *pmd, int is_keepalive, int persistent)
* to check if a received packet has been truncated.
*/
ifr.ifr_flags = (pmd->type == ETH_TUNTAP_TYPE_TAP) ?
- IFF_TAP : IFF_TUN | IFF_POINTOPOINT;
+ IFF_TAP : (IFF_TUN | IFF_POINTOPOINT);
+
strlcpy(ifr.ifr_name, pmd->name, IFNAMSIZ);

fd = open(TUN_TAP_DEV_PATH, O_RDWR);
--
2.51.0