getif.c (13573) | getif.c (13582) |
---|---|
1/* 2 * getif.c : get an interface structure 3 */ 4 5#include <sys/types.h> 6#include <sys/socket.h> 7#include <sys/ioctl.h> 8 --- 77 unchanged lines hidden (view full) --- 86 while (len > 0) { 87 ifrq = (struct ifreq *) p; 88 sip = (struct sockaddr_in *) &ifrq->ifr_addr; 89 m = nmatch(addrp, &(sip->sin_addr)); 90 if (m > maxmatch) { 91 maxmatch = m; 92 ifrmax = ifrq; 93 } | 1/* 2 * getif.c : get an interface structure 3 */ 4 5#include <sys/types.h> 6#include <sys/socket.h> 7#include <sys/ioctl.h> 8 --- 77 unchanged lines hidden (view full) --- 86 while (len > 0) { 87 ifrq = (struct ifreq *) p; 88 sip = (struct sockaddr_in *) &ifrq->ifr_addr; 89 m = nmatch(addrp, &(sip->sin_addr)); 90 if (m > maxmatch) { 91 maxmatch = m; 92 ifrmax = ifrq; 93 } |
94 /* XXX - Could this be just #ifndef IFNAMSIZ instead? -gwr */ 95#if (BSD - 0) < 43 | 94#ifndef IFNAMSIZ |
96 /* BSD not defined or earlier than 4.3 */ 97 incr = sizeof(*ifrq); | 95 /* BSD not defined or earlier than 4.3 */ 96 incr = sizeof(*ifrq); |
98#else /* NetBSD */ | 97#else |
99 incr = ifrq->ifr_addr.sa_len + IFNAMSIZ; | 98 incr = ifrq->ifr_addr.sa_len + IFNAMSIZ; |
100#endif /* NetBSD */ | 99#endif |
101 102 p += incr; 103 len -= incr; 104 } 105 106 return ifrmax; 107} 108 --- 40 unchanged lines hidden --- | 100 101 p += incr; 102 len -= incr; 103 } 104 105 return ifrmax; 106} 107 --- 40 unchanged lines hidden --- |