mirror of
https://git.proxmox.com/git/mirror_iproute2
synced 2025-11-03 20:47:11 +00:00
do not exit silently when link is not found
When we create a tunnel on top of a link and the link specified in cmdline doesn't exist, an error message should be shown. Cc: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
This commit is contained in:
parent
eb6028b263
commit
0cb6bb51b4
@ -99,8 +99,11 @@ static int vxlan_parse_opt(struct link_util *lu, int argc, char **argv,
|
||||
} else if (!matches(*argv, "dev")) {
|
||||
NEXT_ARG();
|
||||
link = if_nametoindex(*argv);
|
||||
if (link == 0)
|
||||
if (link == 0) {
|
||||
fprintf(stderr, "Cannot find device \"%s\"\n",
|
||||
*argv);
|
||||
exit(-1);
|
||||
}
|
||||
} else if (!matches(*argv, "ttl") ||
|
||||
!matches(*argv, "hoplimit")) {
|
||||
unsigned uval;
|
||||
|
||||
@ -250,8 +250,11 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
|
||||
|
||||
if (medium[0]) {
|
||||
p->link = if_nametoindex(medium);
|
||||
if (p->link == 0)
|
||||
if (p->link == 0) {
|
||||
fprintf(stderr, "Cannot find device \"%s\"\n",
|
||||
medium);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->i_key == 0 && IN_MULTICAST(ntohl(p->iph.daddr))) {
|
||||
|
||||
@ -207,8 +207,11 @@ get_failed:
|
||||
} else if (!matches(*argv, "dev")) {
|
||||
NEXT_ARG();
|
||||
link = if_nametoindex(*argv);
|
||||
if (link == 0)
|
||||
if (link == 0) {
|
||||
fprintf(stderr, "Cannot find device \"%s\"\n",
|
||||
*argv);
|
||||
exit(-1);
|
||||
}
|
||||
} else if (!matches(*argv, "ttl") ||
|
||||
!matches(*argv, "hoplimit")) {
|
||||
unsigned uval;
|
||||
|
||||
@ -225,8 +225,11 @@ get_failed:
|
||||
} else if (!matches(*argv, "dev")) {
|
||||
NEXT_ARG();
|
||||
link = if_nametoindex(*argv);
|
||||
if (link == 0)
|
||||
if (link == 0) {
|
||||
fprintf(stderr, "Cannot find device \"%s\"\n",
|
||||
*argv);
|
||||
exit(-1);
|
||||
}
|
||||
} else if (!matches(*argv, "ttl") ||
|
||||
!matches(*argv, "hoplimit")) {
|
||||
__u8 uval;
|
||||
|
||||
@ -171,8 +171,11 @@ get_failed:
|
||||
} else if (!matches(*argv, "dev")) {
|
||||
NEXT_ARG();
|
||||
link = if_nametoindex(*argv);
|
||||
if (link == 0)
|
||||
if (link == 0) {
|
||||
fprintf(stderr, "Cannot find device \"%s\"\n",
|
||||
*argv);
|
||||
exit(-1);
|
||||
}
|
||||
} else
|
||||
usage();
|
||||
argc--; argv++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user