From 7f832c3059b3b2f864f0b1f3fac0c4ed8e268b27 Mon Sep 17 00:00:00 2001 From: glebius Date: Thu, 31 Jan 2013 08:55:21 +0000 Subject: Retire struct sockaddr_inarp. Since ARP and routing are separated, "proxy only" entries don't have any meaning, thus we don't need additional field in sockaddr to pass SIN_PROXY flag. New kernel is binary compatible with old tools, since sizes of sockaddr_inarp and sockaddr_in match, and sa_family are filled with same value. The structure declaration is left for compatibility with third party software, but in tree code no longer use it. Reviewed by: ru, andre, net@ --- libexec/bootpd/rtmsg.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'libexec/bootpd/rtmsg.c') diff --git a/libexec/bootpd/rtmsg.c b/libexec/bootpd/rtmsg.c index 8b81dab..c075bc5 100644 --- a/libexec/bootpd/rtmsg.c +++ b/libexec/bootpd/rtmsg.c @@ -106,9 +106,9 @@ static void getsocket () { } static struct sockaddr_in so_mask = {8, 0, 0, { 0xffffffff}}; -static struct sockaddr_inarp blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; +static struct sockaddr_in blank_sin = {sizeof(blank_sin), AF_INET }, sin_m; static struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m; -static int expire_time, flags, export_only, doing_proxy; +static int expire_time, flags, doing_proxy; static struct { struct rt_msghdr m_rtm; char m_space[512]; @@ -122,7 +122,7 @@ int bsd_arp_set(ia, eaddr, len) char *eaddr; int len; { - register struct sockaddr_inarp *sin = &sin_m; + register struct sockaddr_in *sin = &sin_m; register struct sockaddr_dl *sdl; register struct rt_msghdr *rtm = &(m_rtmsg.m_rtm); u_char *ea; @@ -137,7 +137,7 @@ int bsd_arp_set(ia, eaddr, len) ea = (u_char *)LLADDR(&sdl_m); bcopy(eaddr, ea, len); sdl_m.sdl_alen = len; - doing_proxy = flags = export_only = expire_time = 0; + doing_proxy = flags = expire_time = 0; /* make arp entry temporary */ clock_gettime(CLOCK_MONOTONIC, &tp); @@ -148,7 +148,7 @@ tryagain: report(LOG_WARNING, "rtmget: %s", strerror(errno)); return (1); } - sin = (struct sockaddr_inarp *)(rtm + 1); + sin = (struct sockaddr_in *)(rtm + 1); sdl = (struct sockaddr_dl *)(sin->sin_len + (char *)sin); if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { if (sdl->sdl_family == AF_LINK && @@ -163,13 +163,6 @@ tryagain: inet_ntoa(sin->sin_addr)); return (1); } - if (sin_m.sin_other & SIN_PROXY) { - report(LOG_WARNING, - "set: proxy entry exists for non 802 device\n"); - return(1); - } - sin_m.sin_other = SIN_PROXY; - export_only = 1; goto tryagain; } overwrite: @@ -209,14 +202,9 @@ static int rtmsg(cmd) rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; rtm->rtm_flags |= (RTF_HOST | RTF_STATIC | RTF_LLDATA); - sin_m.sin_other = 0; if (doing_proxy) { - if (export_only) - sin_m.sin_other = SIN_PROXY; - else { - rtm->rtm_addrs |= RTA_NETMASK; - rtm->rtm_flags &= ~RTF_HOST; - } + rtm->rtm_addrs |= RTA_NETMASK; + rtm->rtm_flags &= ~RTF_HOST; } /* FALLTHROUGH */ case RTM_GET: -- cgit v1.1