Subject: Re: [PATCH iproute2-next 04/11] m_vlan: fix formatting of push ethernet src mac

From: Guillaume Nault <[email-masked]>
Date: Sat, 8 Jan 2022 22:29:51 +0100

On Sat, Jan 08, 2022 at 12:46:43PM -0800, Stephen Hemminger wrote:
> This was reported as a clang warning:
>     CC       m_vlan.o
> m_vlan.c:282:32: warning: converting the enum constant to a boolean [-Wint-in-bool-context]
>                 if (tb[TCA_VLAN_PUSH_ETH_SRC &&
>                                              ^
> 
> But it is really a bug in the code for displaying the pushed
> source mac.
> 
> Fixes: d61167dd88b4 ("m_vlan: add pop_eth and push_eth actions")
> Cc: [email-masked]
> Signed-off-by: Stephen Hemminger <[email-masked]>
> ---
>  tc/m_vlan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tc/m_vlan.c b/tc/m_vlan.c
> index 221083dfc0da..1b2b1d51ed2d 100644
> --- a/tc/m_vlan.c
> +++ b/tc/m_vlan.c
> @@ -279,8 +279,8 @@ static int print_vlan(struct action_util *au, FILE *f, struct rtattr *arg)
>  				    ETH_ALEN, 0, b1, sizeof(b1));
>  			print_string(PRINT_ANY, "dst_mac", " dst_mac %s", b1);
>  		}
> -		if (tb[TCA_VLAN_PUSH_ETH_SRC &&
> -		       RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_SRC]) == ETH_ALEN]) {
> +		if (tb[TCA_VLAN_PUSH_ETH_SRC] &&
> +		       RTA_PAYLOAD(tb[TCA_VLAN_PUSH_ETH_SRC]) == ETH_ALEN) {
>  			ll_addr_n2a(RTA_DATA(tb[TCA_VLAN_PUSH_ETH_SRC]),
>  				    ETH_ALEN, 0, b1, sizeof(b1));
>  			print_string(PRINT_ANY, "src_mac", " src_mac %s", b1);

This is already fixed in iproute2 with commit 0e949725908b ("tc/m_vlan:
fix print_vlan() conditional on TCA_VLAN_ACT_PUSH_ETH").