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.