wg: ipc: do not warn on unrecognized netlink attributes
It makes extending things more difficult. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
66054f3638
commit
407b0cb311
17
src/ipc.c
17
src/ipc.c
|
@ -95,15 +95,6 @@ static int add_next_to_inflatable_buffer(struct inflatable_buffer *buffer)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void warn_unrecognized(const char *which)
|
|
||||||
{
|
|
||||||
static bool once = false;
|
|
||||||
if (once)
|
|
||||||
return;
|
|
||||||
once = true;
|
|
||||||
fprintf(stderr, "Warning: one or more unrecognized %s attributes\n", which);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FILE *userspace_interface_file(const char *interface)
|
static FILE *userspace_interface_file(const char *interface)
|
||||||
{
|
{
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
|
@ -438,8 +429,6 @@ static int userspace_get_device(struct wgdevice **out, const char *interface)
|
||||||
peer->tx_bytes = NUM(0xffffffffffffffffULL);
|
peer->tx_bytes = NUM(0xffffffffffffffffULL);
|
||||||
else if (!strcmp(key, "errno"))
|
else if (!strcmp(key, "errno"))
|
||||||
ret = -NUM(0x7fffffffU);
|
ret = -NUM(0x7fffffffU);
|
||||||
else
|
|
||||||
warn_unrecognized("daemon");
|
|
||||||
}
|
}
|
||||||
ret = -EPROTO;
|
ret = -EPROTO;
|
||||||
err:
|
err:
|
||||||
|
@ -711,8 +700,6 @@ static int parse_allowedip(const struct nlattr *attr, void *data)
|
||||||
if (!mnl_attr_validate(attr, MNL_TYPE_U8))
|
if (!mnl_attr_validate(attr, MNL_TYPE_U8))
|
||||||
allowedip->cidr = mnl_attr_get_u8(attr);
|
allowedip->cidr = mnl_attr_get_u8(attr);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
warn_unrecognized("netlink");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
@ -792,8 +779,6 @@ static int parse_peer(const struct nlattr *attr, void *data)
|
||||||
break;
|
break;
|
||||||
case WGPEER_A_ALLOWEDIPS:
|
case WGPEER_A_ALLOWEDIPS:
|
||||||
return mnl_attr_parse_nested(attr, parse_allowedips, peer);
|
return mnl_attr_parse_nested(attr, parse_allowedips, peer);
|
||||||
default:
|
|
||||||
warn_unrecognized("netlink");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
@ -862,8 +847,6 @@ static int parse_device(const struct nlattr *attr, void *data)
|
||||||
break;
|
break;
|
||||||
case WGDEVICE_A_PEERS:
|
case WGDEVICE_A_PEERS:
|
||||||
return mnl_attr_parse_nested(attr, parse_peers, device);
|
return mnl_attr_parse_nested(attr, parse_peers, device);
|
||||||
default:
|
|
||||||
warn_unrecognized("netlink");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
|
Loading…
Reference in New Issue