Revert "cangen: use if_nametoindex() to avoid overflows"
This reverts commitpull/397/head1f96d674c0. Link: https://github.com/linux-can/can-utils/pull/396 Link:1f96d674c0 (commitcomment-97455025)
parent
5aa72c5e9e
commit
7227580f7e
8
cangen.c
8
cangen.c
|
|
@ -608,11 +608,13 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
addr.can_family = AF_CAN;
|
addr.can_family = AF_CAN;
|
||||||
addr.can_ifindex = if_nametoindex(argv[optind]);
|
|
||||||
if (!addr.can_ifindex) {
|
strcpy(ifr.ifr_name, argv[optind]);
|
||||||
perror("if_nametoindex");
|
if (ioctl(s, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
|
perror("SIOCGIFINDEX");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
addr.can_ifindex = ifr.ifr_ifindex;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* disable default receive filter on this RAW socket
|
* disable default receive filter on this RAW socket
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue