Commit ffc0bfcf authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Better error feedback for flush interface.

parent d093352f
......@@ -897,6 +897,8 @@ parse_config_line(int c, gnc_t gnc, void *closure,
if(c < -1 || !action_return)
goto fail;
*action_return = CONFIG_ACTION_NO;
if(message_return)
*message_return = "Permission denied";
} else if(strcmp(token, "in") == 0) {
struct filter *filter;
c = parse_filter(c, gnc, closure, &filter);
......@@ -946,13 +948,24 @@ parse_config_line(int c, gnc_t gnc, void *closure,
goto fail;
if(strcmp(token2, "interface") == 0) {
char *ifname;
int rc;
c = getword(c, &ifname, gnc, closure);
c = skip_eol(c, gnc, closure);
if(c < -1) {
free(token2);
goto fail;
}
flush_interface(ifname);
rc = flush_interface(ifname);
if(rc <= 0) {
if(action_return)
*action_return = CONFIG_ACTION_NO;
if(message_return) {
if(rc < 0)
*message_return = "Couldn't flush interface";
else
*message_return = "No such interface";
}
}
free(token2);
free(ifname);
} else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment