diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-02-09 10:04:55 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 1998-02-09 10:04:55 +0000 |
commit | 0322911902352177a33e23b73e79a82e6bddd4b9 (patch) | |
tree | 5f5aafb26ca749dfe9682fd2ef64f986a06b565a /usr.sbin | |
parent | 70337ea9a07ed61c143846a89d9adf090d0a945b (diff) |
Close/reopen routing socket, to avoid running out of the socket's buffer space.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rarpd/arptab.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/usr.sbin/rarpd/arptab.c b/usr.sbin/rarpd/arptab.c index 976b41d1380..9bd055dedf8 100644 --- a/usr.sbin/rarpd/arptab.c +++ b/usr.sbin/rarpd/arptab.c @@ -78,12 +78,10 @@ static int s = -1; void getsocket() { + s = socket(PF_ROUTE, SOCK_RAW, 0); if (s < 0) { - s = socket(PF_ROUTE, SOCK_RAW, 0); - if (s < 0) { - perror("arp: socket"); - exit(1); - } + perror("arp: socket"); + exit(1); } } @@ -122,6 +120,8 @@ arptab_set(eaddr, host) tryagain: if (rtmsg(RTM_GET) < 0) { syslog(LOG_ERR,"%s: %m", inet_ntoa(sin->sin_addr)); + close(s); + s = -1; return (1); } sin = (struct sockaddr_inarp *)(rtm + 1); @@ -137,11 +137,15 @@ tryagain: if (doing_proxy == 0) { syslog(LOG_ERR, "arptab_set: can only proxy for %s\n", inet_ntoa(sin->sin_addr)); + close(s); + s = -1; return (1); } if (sin_m.sin_other & SIN_PROXY) { syslog(LOG_ERR, "arptab_set: proxy entry exists for non 802 device\n"); + close(s); + s = -1; return(1); } sin_m.sin_other = SIN_PROXY; @@ -153,10 +157,14 @@ overwrite: syslog(LOG_ERR, "arptab_set: cannot intuit interface index and type for %s\n", inet_ntoa(sin->sin_addr)); + close(s); + s = -1; return (1); } sdl_m.sdl_type = sdl->sdl_type; sdl_m.sdl_index = sdl->sdl_index; + close(s); + s = -1; return (rtmsg(RTM_ADD)); } |