aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tools
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-08 03:06:47 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-08 03:14:52 +0200
commit205dd46aae8dd53f2c196d6a5af2fdbafd6b2b19 (patch)
treef2e36e45a597c47718279de8d78461ef4b5f748f /src/tools
parentqemu: kill after 20 minutes (diff)
downloadwireguard-monolithic-historical-205dd46aae8dd53f2c196d6a5af2fdbafd6b2b19.tar.xz
wireguard-monolithic-historical-205dd46aae8dd53f2c196d6a5af2fdbafd6b2b19.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>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/ipc.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/tools/ipc.c b/src/tools/ipc.c
index bc89f02..c64e332 100644
--- a/src/tools/ipc.c
+++ b/src/tools/ipc.c
@@ -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))