ioctl(SIOCGIFINDEX) does not require clearing of entire ifr
function old new delta INET6_setroute 492 472 -20 do_iplink 1357 1330 -27 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-47) Total: -47 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
98592db323
commit
46ba2468a3
@ -161,7 +161,7 @@ static int get_address(char *dev, int *htype)
|
|||||||
|
|
||||||
s = xsocket(PF_PACKET, SOCK_DGRAM, 0);
|
s = xsocket(PF_PACKET, SOCK_DGRAM, 0);
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
/*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
|
||||||
strncpy_IFNAMSIZ(ifr.ifr_name, dev);
|
strncpy_IFNAMSIZ(ifr.ifr_name, dev);
|
||||||
xioctl(s, SIOCGIFINDEX, &ifr);
|
xioctl(s, SIOCGIFINDEX, &ifr);
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ static NOINLINE void INET6_setroute(int action, char **args)
|
|||||||
|
|
||||||
if (devname) {
|
if (devname) {
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
/*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
|
||||||
strncpy_IFNAMSIZ(ifr.ifr_name, devname);
|
strncpy_IFNAMSIZ(ifr.ifr_name, devname);
|
||||||
xioctl(skfd, SIOCGIFINDEX, &ifr);
|
xioctl(skfd, SIOCGIFINDEX, &ifr);
|
||||||
rt.rtmsg_ifindex = ifr.ifr_ifindex;
|
rt.rtmsg_ifindex = ifr.ifr_ifindex;
|
||||||
|
@ -63,7 +63,7 @@ int FAST_FUNC d6_read_interface(const char *interface, int *ifindex, struct in6_
|
|||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
/*memset(&ifr, 0, sizeof(ifr)); - SIOCGIFINDEX does not need to clear all */
|
||||||
strncpy_IFNAMSIZ(ifr.ifr_name, interface);
|
strncpy_IFNAMSIZ(ifr.ifr_name, interface);
|
||||||
fd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
|
fd = xsocket(AF_INET6, SOCK_RAW, IPPROTO_RAW);
|
||||||
if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) {
|
if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user