diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 03:06:47 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-10-08 03:14:52 +0200 |
commit | 54569b7999252c223dd387117383bb3e727cb8aa (patch) | |
tree | 71dd9172044107062666643415dca083f8f6c49a /src | |
parent | crypto: clean up remaining .h->.c (diff) | |
download | wireguard-tools-54569b7999252c223dd387117383bb3e727cb8aa.tar.xz wireguard-tools-54569b7999252c223dd387117383bb3e727cb8aa.zip |
netlink: do not stuff index into nla type
It's not used for anything, and LKML doesn't like the type being used as
an index value.
Suggested-by: Eugene Syromiatnikov <esyr@redhat.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/ipc.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -547,7 +547,6 @@ cleanup: static int kernel_set_device(struct wgdevice *dev) { int ret = 0; - size_t i, j; struct wgpeer *peer = NULL; struct wgallowedip *allowedip = NULL; struct nlattr *peers_nest, *peer_nest, *allowedips_nest, *allowedip_nest; @@ -580,10 +579,10 @@ again: goto send; peers_nest = peer_nest = allowedips_nest = allowedip_nest = NULL; peers_nest = mnl_attr_nest_start(nlh, WGDEVICE_A_PEERS); - for (i = 0, peer = peer ? peer : dev->first_peer; peer; peer = peer->next_peer) { + for (peer = peer ? peer : dev->first_peer; peer; peer = peer->next_peer) { uint32_t flags = 0; - peer_nest = mnl_attr_nest_start_check(nlh, SOCKET_BUFFER_SIZE, i++); + peer_nest = mnl_attr_nest_start_check(nlh, SOCKET_BUFFER_SIZE, 0); if (!peer_nest) goto toobig_peers; if (!mnl_attr_put_check(nlh, SOCKET_BUFFER_SIZE, WGPEER_A_PUBLIC_KEY, sizeof(peer->public_key), peer->public_key)) @@ -619,8 +618,8 @@ again: allowedips_nest = mnl_attr_nest_start_check(nlh, SOCKET_BUFFER_SIZE, WGPEER_A_ALLOWEDIPS); if (!allowedips_nest) goto toobig_allowedips; - for (j = 0; allowedip; allowedip = allowedip->next_allowedip) { - allowedip_nest = mnl_attr_nest_start_check(nlh, SOCKET_BUFFER_SIZE, j++); + for (; allowedip; allowedip = allowedip->next_allowedip) { + allowedip_nest = mnl_attr_nest_start_check(nlh, SOCKET_BUFFER_SIZE, 0); if (!allowedip_nest) goto toobig_allowedips; if (!mnl_attr_put_u16_check(nlh, SOCKET_BUFFER_SIZE, WGALLOWEDIP_A_FAMILY, allowedip->family)) |