diff options
author | sem <sem@FreeBSD.org> | 2009-03-11 03:27:14 +0800 |
---|---|---|
committer | sem <sem@FreeBSD.org> | 2009-03-11 03:27:14 +0800 |
commit | 18d207ce6a5d730e44c5c2d164a4b690f335334f (patch) | |
tree | 8da8e7d4274ad9fd57367a5a6593ff873872d872 /devel | |
parent | 3a466a7c388ada47235a324453d9001f6b1bca51 (diff) | |
download | freebsd-ports-gnome-18d207ce6a5d730e44c5c2d164a4b690f335334f.tar.gz freebsd-ports-gnome-18d207ce6a5d730e44c5c2d164a4b690f335334f.tar.zst freebsd-ports-gnome-18d207ce6a5d730e44c5c2d164a4b690f335334f.zip |
- Add patch to unbroke on CURRENT (with new ARP code)
Diffstat (limited to 'devel')
-rw-r--r-- | devel/libpdel/Makefile | 8 | ||||
-rw-r--r-- | devel/libpdel/files/patch-arp | 195 |
2 files changed, 196 insertions, 7 deletions
diff --git a/devel/libpdel/Makefile b/devel/libpdel/Makefile index e0b00d53bd8e..8f6f0278324f 100644 --- a/devel/libpdel/Makefile +++ b/devel/libpdel/Makefile @@ -18,10 +18,4 @@ LIB_DEPENDS= expat.6:${PORTSDIR}/textproc/expat2 USE_LDCONFIG= yes -.include <bsd.port.pre.mk> - -.if ${OSVERSION} >= 800059 -BROKEN= does not build -.endif - -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/devel/libpdel/files/patch-arp b/devel/libpdel/files/patch-arp new file mode 100644 index 000000000000..51841780f1e2 --- /dev/null +++ b/devel/libpdel/files/patch-arp @@ -0,0 +1,195 @@ +--- net/uroute.c.prev 2005-01-21 23:02:03.000000000 +0200 ++++ net/uroute.c 2008-12-24 21:34:43.000000000 +0200 +@@ -74,9 +74,15 @@ + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) + #define ADVANCE(x, n) ((x) += ROUNDUP((n)->sa_len)) + ++#ifdef RTF_CLONING + #define WRITABLE_FLAGS (RTF_STATIC | RTF_LLINFO | RTF_REJECT | RTF_BLACKHOLE \ + | RTF_PROTO1 | RTF_PROTO2 | RTF_CLONING \ + | RTF_XRESOLVE | RTF_UP | RTF_GATEWAY) ++#else ++#define WRITABLE_FLAGS (RTF_STATIC | RTF_REJECT | RTF_BLACKHOLE \ ++ | RTF_PROTO1 | RTF_PROTO2 \ ++ | RTF_XRESOLVE | RTF_UP | RTF_GATEWAY) ++#endif + + struct route_flag { + const char *name; +@@ -92,15 +98,21 @@ static const struct route_flag route_fla + FLAG(DYNAMIC), + FLAG(MODIFIED), + FLAG(DONE), ++#ifdef RTF_CLONING + FLAG(CLONING), ++#endif + FLAG(XRESOLVE), ++#ifdef RTF_LLINFO + FLAG(LLINFO), ++#endif + FLAG(STATIC), + FLAG(BLACKHOLE), + FLAG(PROTO2), + FLAG(PROTO1), + FLAG(PRCLONING), ++#ifdef RTF_WASCLONED + FLAG(WASCLONED), ++#endif + FLAG(PROTO3), + FLAG(PINNED), + FLAG(LOCAL), +--- net/if_arp.c.prev 2005-01-21 23:02:02.000000000 +0200 ++++ net/if_arp.c 2008-12-24 23:01:46.000000000 +0200 +@@ -68,7 +68,6 @@ + #include "structs/type/array.h" + + #include "net/if_util.h" +-#include "net/uroute.h" + #include "util/typed_mem.h" + + #define ROUNDUP(a) \ +@@ -124,7 +123,11 @@ if_get_arp(struct in_addr ip, u_char *et + mib[2] = 0; + mib[3] = AF_INET; + mib[4] = NET_RT_FLAGS; ++#ifdef RTF_LLINFO + mib[5] = RTF_LLINFO; ++#else ++ mib[5] = 0; ++#endif + if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + return (-1); + needed += 128; +@@ -227,9 +230,11 @@ tryagain: + sdl = (struct sockaddr_dl *)(void *) + (ROUNDUP(sin->sin_len) + (char *)sin); + if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { +- if (sdl->sdl_family == AF_LINK +- && (rtm->rtm_flags & (RTF_LLINFO|RTF_GATEWAY)) +- == RTF_LLINFO) { ++ if (sdl->sdl_family == AF_LINK && ++#ifdef RTF_LLINFO ++ (rtm->rtm_flags & RTF_LLINFO) != 0 && ++#endif ++ (rtm->rtm_flags & RTF_GATEWAY) == 0) { + switch (sdl->sdl_type) { + case IFT_ETHER: + case IFT_FDDI: +@@ -278,6 +283,7 @@ arp_delete(int sock, struct in_addr ip) + struct rt_msghdr *const rtm = &m_rtmsg.m_rtm; + struct sockaddr_dl *sdl; + ++ sdl_m = zero_sdl; + sin_m = zero_sin; + sin->sin_addr = ip; + tryagain: +@@ -286,14 +292,15 @@ tryagain: + sin = (struct sockaddr_inarp *)(rtm + 1); + sdl = (struct sockaddr_dl *)(void *) + (ROUNDUP(sin->sin_len) + (char *)sin); +- if (sin->sin_addr.s_addr == sin_m.sin_addr.s_addr) { +- if (sdl->sdl_family == AF_LINK && +- (rtm->rtm_flags & RTF_LLINFO) && +- !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { ++ if (sdl->sdl_family == AF_LINK && ++#ifdef RTF_LLINFO ++ (rtm->rtm_flags & RTF_LLINFO) && ++#endif ++ !(rtm->rtm_flags & RTF_GATEWAY)) switch (sdl->sdl_type) { + case IFT_ETHER: case IFT_FDDI: case IFT_ISO88023: + case IFT_ISO88024: case IFT_ISO88025: ++ sin->sin_addr.s_addr = sin_m.sin_addr.s_addr; + goto delete; +- } + } + if (sin_m.sin_other & SIN_PROXY) { + errno = ENOENT; +@@ -384,42 +391,55 @@ int + if_flush_arp(void) + { + int errno_save = errno; +- struct uroute **list; +- int rtn = 0; +- int num; +- int i; +- +- /* Get list of routes */ +- if ((num = uroute_get_all(&list, TYPED_MEM_TEMP)) == -1) +- return (-1); +- +- /* Delete ARP routes */ +- for (i = 0; i < num; i++) { +- struct uroute *const route = list[i]; +- const struct sockaddr *dest; +- const struct sockaddr *gw; +- +- /* Is this an ARP entry? */ +- dest = uroute_get_dest(route); +- gw = uroute_get_gateway(route); +- if ((uroute_get_flags(route) +- & (RTF_HOST|RTF_LLINFO|RTF_WASCLONED)) +- != (RTF_HOST|RTF_LLINFO|RTF_WASCLONED) +- || dest->sa_family != AF_INET +- || gw->sa_family != AF_LINK) +- continue; ++ int mib[6]; ++ size_t needed; ++ char *lim, *buf, *next; ++ struct rt_msghdr *rtm; ++ struct sockaddr_inarp *sin; ++ struct sockaddr_dl *sdl; ++ int sock, rtn = -1; + +- /* Delete it */ +- if (uroute_delete(route) == -1) { +- errno_save = errno; +- rtn = -1; +- } ++ /* Get socket */ ++ if ((sock = socket(PF_ROUTE, SOCK_RAW, 0)) == -1) ++ return (-1); ++ ++ /* Get ARP table */ ++ mib[0] = CTL_NET; ++ mib[1] = PF_ROUTE; ++ mib[2] = 0; ++ mib[3] = AF_INET; ++ mib[4] = NET_RT_FLAGS; ++#ifdef RTF_LLINFO ++ mib[5] = RTF_LLINFO; ++#else ++ mib[5] = 0; ++#endif ++ if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) ++ goto done; ++ needed += 128; ++ if ((buf = MALLOC(TYPED_MEM_TEMP, needed)) == NULL) ++ goto done; ++ if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { ++ goto done2; ++ } ++ ++ /* Find desired entry */ ++ lim = buf + needed; ++ for (next = buf; next < lim; next += rtm->rtm_msglen) { ++ rtm = (struct rt_msghdr *)(void *)next; ++ sin = (struct sockaddr_inarp *)(rtm + 1); ++ sdl = (struct sockaddr_dl *)(void *) ++ ((char *)sin + ROUNDUP(sin->sin_len)); ++ if (sdl->sdl_alen == 0) ++ break; ++ arp_delete(sock, sin->sin_addr); + } + +- /* Clean up */ +- while (num > 0) +- uroute_destroy(&list[--num]); +- FREE(TYPED_MEM_TEMP, list); ++ rtn = 0; ++done2: ++ FREE(TYPED_MEM_TEMP, buf); ++done: ++ (void)close(sock); + errno = errno_save; + return (rtn); + } |