"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/net/os/macosx/Link.inc" between
monit-5.27.2.tar.gz and monit-5.28.0.tar.gz

About: Monit is a utility for managing and monitoring processes, files, directories and filesystems (with automatic error recovery).

Link.inc  (monit-5.27.2):Link.inc  (monit-5.28.0)
skipping to change at line 51 skipping to change at line 51
THROW(AssertException, "Cannot get link statistics -- %s", Syste m_getError(errno)); THROW(AssertException, "Cannot get link statistics -- %s", Syste m_getError(errno));
} }
for (struct if_msghdr2 *ifm = buf; (void *)ifm < (void *)buf + len; ifm = (void *)ifm + ifm->ifm_msglen) { for (struct if_msghdr2 *ifm = buf; (void *)ifm < (void *)buf + len; ifm = (void *)ifm + ifm->ifm_msglen) {
if (ifm->ifm_type == RTM_IFINFO2) { if (ifm->ifm_type == RTM_IFINFO2) {
char name[STRLEN]; char name[STRLEN];
struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1 ); struct sockaddr_dl *sdl = (struct sockaddr_dl *)(ifm + 1 );
strncpy(name, sdl->sdl_data, sdl->sdl_nlen); strncpy(name, sdl->sdl_data, sdl->sdl_nlen);
name[sdl->sdl_nlen] = 0; name[sdl->sdl_nlen] = 0;
if (Str_isEqual(interface, name)) { if (Str_isEqual(interface, name)) {
int s = socket(AF_INET, SOCK_DGRAM, 0); int s = socket(AF_INET, SOCK_DGRAM, 0);
if (s > 0) { if (s >= 0) {
struct ifmediareq ifmr; struct ifmediareq ifmr;
memset(&ifmr, 0, sizeof(ifmr)); memset(&ifmr, 0, sizeof(ifmr));
strncpy(ifmr.ifm_name, interface, sizeof (ifmr.ifm_name)); strncpy(ifmr.ifm_name, interface, sizeof (ifmr.ifm_name) - 1);
// try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface) // try SIOCGIFMEDIA - if not supported, assume the interface is UP (loopback or other virtual interface)
if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifm r) >= 0) { if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifm r) >= 0) {
if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) { if (ifmr.ifm_status & IFM_AVALID && ifmr.ifm_status & IFM_ACTIVE) {
L->state = 1LL; L->state = 1LL;
L->duplex = ifmr.ifm_act ive & 0x00100000 ? 1LL : 0LL; L->duplex = ifmr.ifm_act ive & 0x00100000 ? 1LL : 0LL;
} else { } else {
L->state = 0LL; L->state = 0LL;
L->duplex = -1LL; L->duplex = -1LL;
} }
} else { } else {
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)