Re: [PATCH 2/2 libnftnl v2] tunnel: add support to geneve options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/28/25 12:55 PM, Florian Westphal wrote:
Fernando Fernandez Mancera <fmancera@xxxxxxx> wrote:
+	case NFTNL_OBJ_TUNNEL_GENEVE_OPTS:
+		geneve = malloc(sizeof(struct nftnl_obj_tunnel_geneve));
+		memcpy(geneve, data, data_len);
+
+		if (!(e->flags & (1ULL << NFTNL_OBJ_TUNNEL_GENEVE_OPTS)))
+			INIT_LIST_HEAD(&tun->u.tun_geneve);
+
+		list_add_tail(&geneve->list, &tun->u.tun_geneve);
+		break;

I missed this earlier. Do we have precedence for this?

AFAIK for all existing setters, if you do

nftnl_foo_set_data(obj, OPT_FOO, &d, len);
nftnl_foo_set_data(obj, OPT_FOO, &d2, len2);

Then d2 replaces d, it doesn't silently append/add to the
object.


Good catch. I thought yes, but no, there is no precedence for this. Other similar situations expose a dedicated function to append items to a list.

So we should do the same thing on this situation.




[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux