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