Commit 08fbcd56 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix error handling of if_nametoindex.

parent 6e7c289b
...@@ -273,8 +273,8 @@ main(int argc, char **argv) ...@@ -273,8 +273,8 @@ main(int argc, char **argv)
int mtu; int mtu;
ifindex = if_nametoindex(*arg); ifindex = if_nametoindex(*arg);
if(ifindex < 0) { if(ifindex <= 0) {
perror("if_nametoindex"); fprintf(stderr, "Unknown interface %s.\n", *arg);
goto fail; goto fail;
} }
......
...@@ -212,7 +212,7 @@ kernel_route(int add, const unsigned char *dest, unsigned short plen, ...@@ -212,7 +212,7 @@ kernel_route(int add, const unsigned char *dest, unsigned short plen,
if(ifindex_lo < 0) { if(ifindex_lo < 0) {
ifindex_lo = if_nametoindex("lo"); ifindex_lo = if_nametoindex("lo");
if(ifindex_lo < 0) if(ifindex_lo <= 0)
return -1; return -1;
} }
......
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