Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/rarpd/rarpd.c
Show First 20 Lines • Show All 749 Lines • ▼ Show 20 Lines | update_arptab(u_char *ep, in_addr_t ipaddr) | ||||
errno = 0; | errno = 0; | ||||
if ((write(r, rt, rt->rtm_msglen) == -1) && (errno != ESRCH)) { | if ((write(r, rt, rt->rtm_msglen) == -1) && (errno != ESRCH)) { | ||||
logmsg(LOG_ERR, "rtmsg get write: %m"); | logmsg(LOG_ERR, "rtmsg get write: %m"); | ||||
close(r); | close(r); | ||||
return; | return; | ||||
} | } | ||||
do { | do { | ||||
cc = read(r, rt, sizeof(rtmsg)); | cc = read(r, rt, sizeof(rtmsg)); | ||||
} while (cc > 0 && (rt->rtm_seq != seq || rt->rtm_pid != pid)); | } while (cc > 0 && (rt->rtm_type != RTM_GET || rt->rtm_seq != seq || | ||||
rt->rtm_pid != pid)); | |||||
if (cc == -1) { | if (cc == -1) { | ||||
logmsg(LOG_ERR, "rtmsg get read: %m"); | logmsg(LOG_ERR, "rtmsg get read: %m"); | ||||
close(r); | close(r); | ||||
return; | return; | ||||
} | } | ||||
ll2 = (struct sockaddr_dl *)((u_char *)ar2 + ar2->sin_len); | ll2 = (struct sockaddr_dl *)((u_char *)ar2 + ar2->sin_len); | ||||
if (ll2->sdl_family != AF_LINK) { | if (ll2->sdl_family != AF_LINK) { | ||||
/* | /* | ||||
Show All 31 Lines | update_arptab(u_char *ep, in_addr_t ipaddr) | ||||
errno = 0; | errno = 0; | ||||
if ((write(r, rt, rt->rtm_msglen) == -1) && (errno != EEXIST)) { | if ((write(r, rt, rt->rtm_msglen) == -1) && (errno != EEXIST)) { | ||||
logmsg(LOG_ERR, "rtmsg add write: %m"); | logmsg(LOG_ERR, "rtmsg add write: %m"); | ||||
close(r); | close(r); | ||||
return; | return; | ||||
} | } | ||||
do { | do { | ||||
cc = read(r, rt, sizeof(rtmsg)); | cc = read(r, rt, sizeof(rtmsg)); | ||||
} while (cc > 0 && (rt->rtm_seq != seq || rt->rtm_pid != pid)); | } while (cc > 0 && (rt->rtm_type != RTM_ADD || rt->rtm_seq != seq || | ||||
rt->rtm_pid != pid)); | |||||
close(r); | close(r); | ||||
if (cc == -1) { | if (cc == -1) { | ||||
logmsg(LOG_ERR, "rtmsg add read: %m"); | logmsg(LOG_ERR, "rtmsg add read: %m"); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 189 Lines • Show Last 20 Lines |