mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 14:29:54 +02:00
Revert "cangen: use if_nametoindex() to avoid overflows"
This reverts commit 1f96d674c0.
Link: https://github.com/linux-can/can-utils/pull/396
Link: https://github.com/linux-can/can-utils/commit/1f96d674c0cb7b60ee315981f12a7feb94829697#commitcomment-97455025
This commit is contained in:
committed by
Oliver Hartkopp
parent
5aa72c5e9e
commit
77ec9b3c2d
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user