wireguard: flags value via enum when adding a peer

I used to set the peer flags to 2 when adding a peer but merely because I
observed that value in my reference Linux. I now found that the flag 1<<1 means
'WGPEER_F_REPLACE_ALLOWEDIPS' and is ignored whenever the peer is new. Anyway,
I keep setting the flag but with the clearer enum name because the wg tool is
doing it as well when adding new peers and we want to stay close to how the
original code interacts.

Ref #4520
This commit is contained in:
Martin Stein 2022-05-24 11:55:48 +02:00 committed by Christian Helmuth
parent 871ee04ed6
commit 560a166613

View File

@ -317,7 +317,7 @@ _genode_wg_config_add_peer(genode_wg_u16_t listen_port,
peer->flags.header.nla_type = WGPEER_A_FLAGS;
peer->flags.header.nla_len = sizeof(peer->flags);
peer->flags.data = 2; /* I don't know what this value means */
peer->flags.data = WGPEER_F_REPLACE_ALLOWEDIPS;
peer->allowedips.header.nla_len = sizeof(peer->allowedips);
peer->allowedips.header.nla_type = WGPEER_A_ALLOWEDIPS | NLA_F_NESTED;