wg: do not warn on unrecognized items
Upstream advice is to simply be silent. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
83caaa7a96
commit
53e5b4fa89
2 changed files with 0 additions and 26 deletions
|
@ -63,7 +63,6 @@ enum {
|
||||||
|
|
||||||
struct wgdevice {
|
struct wgdevice {
|
||||||
char name[IFNAMSIZ];
|
char name[IFNAMSIZ];
|
||||||
uint32_t ifindex;
|
|
||||||
|
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
|
|
25
src/ipc.c
25
src/ipc.c
|
@ -85,19 +85,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: this program received from your %s one or more\n"
|
|
||||||
"attributes that it did not recognize. It is possible that\n"
|
|
||||||
"this version of wg(8) is older than your %s. You may\n"
|
|
||||||
"want to update this program.\n", which, which);
|
|
||||||
}
|
|
||||||
|
|
||||||
static FILE *userspace_interface_file(const char *interface)
|
static FILE *userspace_interface_file(const char *interface)
|
||||||
{
|
{
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
|
@ -428,8 +415,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:
|
||||||
|
@ -701,8 +686,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))
|
||||||
ctx->allowedip->cidr = mnl_attr_get_u8(attr);
|
ctx->allowedip->cidr = mnl_attr_get_u8(attr);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
warn_unrecognized("kernel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
@ -772,8 +755,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, ctx);
|
return mnl_attr_parse_nested(attr, parse_allowedips, ctx);
|
||||||
default:
|
|
||||||
warn_unrecognized("kernel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
@ -807,10 +788,6 @@ static int parse_device(const struct nlattr *attr, void *data)
|
||||||
struct get_device_ctx *ctx = data;
|
struct get_device_ctx *ctx = data;
|
||||||
|
|
||||||
switch (mnl_attr_get_type(attr)) {
|
switch (mnl_attr_get_type(attr)) {
|
||||||
case WGDEVICE_A_IFINDEX:
|
|
||||||
if (!mnl_attr_validate(attr, MNL_TYPE_U32))
|
|
||||||
ctx->device->ifindex = mnl_attr_get_u32(attr);
|
|
||||||
break;
|
|
||||||
case WGDEVICE_A_IFNAME:
|
case WGDEVICE_A_IFNAME:
|
||||||
if (!mnl_attr_validate(attr, MNL_TYPE_STRING))
|
if (!mnl_attr_validate(attr, MNL_TYPE_STRING))
|
||||||
strncpy(ctx->device->name, mnl_attr_get_str(attr), sizeof(ctx->device->name) - 1);
|
strncpy(ctx->device->name, mnl_attr_get_str(attr), sizeof(ctx->device->name) - 1);
|
||||||
|
@ -833,8 +810,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, ctx);
|
return mnl_attr_parse_nested(attr, parse_peers, ctx);
|
||||||
default:
|
|
||||||
warn_unrecognized("kernel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MNL_CB_OK;
|
return MNL_CB_OK;
|
||||||
|
|
Loading…
Reference in a new issue