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:
Jason A. Donenfeld 2017-10-02 02:51:57 +02:00
parent 83caaa7a96
commit 53e5b4fa89
2 changed files with 0 additions and 26 deletions

View File

@ -63,7 +63,6 @@ enum {
struct wgdevice {
char name[IFNAMSIZ];
uint32_t ifindex;
uint32_t flags;

View File

@ -85,19 +85,6 @@ static int add_next_to_inflatable_buffer(struct inflatable_buffer *buffer)
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)
{
struct stat sbuf;
@ -428,8 +415,6 @@ static int userspace_get_device(struct wgdevice **out, const char *interface)
peer->tx_bytes = NUM(0xffffffffffffffffULL);
else if (!strcmp(key, "errno"))
ret = -NUM(0x7fffffffU);
else
warn_unrecognized("daemon");
}
ret = -EPROTO;
err:
@ -701,8 +686,6 @@ static int parse_allowedip(const struct nlattr *attr, void *data)
if (!mnl_attr_validate(attr, MNL_TYPE_U8))
ctx->allowedip->cidr = mnl_attr_get_u8(attr);
break;
default:
warn_unrecognized("kernel");
}
return MNL_CB_OK;
@ -772,8 +755,6 @@ static int parse_peer(const struct nlattr *attr, void *data)
break;
case WGPEER_A_ALLOWEDIPS:
return mnl_attr_parse_nested(attr, parse_allowedips, ctx);
default:
warn_unrecognized("kernel");
}
return MNL_CB_OK;
@ -807,10 +788,6 @@ static int parse_device(const struct nlattr *attr, void *data)
struct get_device_ctx *ctx = data;
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:
if (!mnl_attr_validate(attr, MNL_TYPE_STRING))
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;
case WGDEVICE_A_PEERS:
return mnl_attr_parse_nested(attr, parse_peers, ctx);
default:
warn_unrecognized("kernel");
}
return MNL_CB_OK;