diff options
author | melifaro <melifaro@FreeBSD.org> | 2016-08-15 07:08:09 +0800 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2016-08-15 07:08:09 +0800 |
commit | e7d00903fa59680c12c5902b32269230da61ebbb (patch) | |
tree | f938712ecf606499f9edf8686852904041780288 /net | |
parent | 8e166800095f190c8d56ac8e045d2ccc87e0af11 (diff) | |
download | freebsd-ports-gnome-e7d00903fa59680c12c5902b32269230da61ebbb.tar.gz freebsd-ports-gnome-e7d00903fa59680c12c5902b32269230da61ebbb.tar.zst freebsd-ports-gnome-e7d00903fa59680c12c5902b32269230da61ebbb.zip |
Fix net/bird r420176 update: really add bugfixes from git.
Approved by: az(implicit)
Diffstat (limited to 'net')
-rw-r--r-- | net/bird/files/patch-proto-bgp-attrs.c | 62 | ||||
-rw-r--r-- | net/bird/files/patch-sysdep-unix-io.c | 80 |
2 files changed, 142 insertions, 0 deletions
diff --git a/net/bird/files/patch-proto-bgp-attrs.c b/net/bird/files/patch-proto-bgp-attrs.c new file mode 100644 index 000000000000..7c5fb93d117c --- /dev/null +++ b/net/bird/files/patch-proto-bgp-attrs.c @@ -0,0 +1,62 @@ +diff --git proto/bgp/attrs.c proto/bgp/attrs.c +index d85afa8..b8371f3 100644 +--- proto/bgp/attrs.c ++++ proto/bgp/attrs.c +@@ -118,7 +118,7 @@ validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, uint *ileng + { + int res = 0; + u8 *a, *dst; +- int len, plen, copy; ++ int len, plen; + + dst = a = idata; + len = *ilength; +@@ -132,15 +132,20 @@ validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, uint *ileng + if (len < plen) + return -1; + ++ if (a[1] == 0) ++ { ++ log(L_WARN "%s: %s_PATH attribute contains empty segment, skipping it", ++ p->p.name, as_path ? "AS" : "AS4"); ++ goto skip; ++ } ++ + switch (a[0]) + { + case AS_PATH_SET: +- copy = 1; + res++; + break; + + case AS_PATH_SEQUENCE: +- copy = 1; + res += a[1]; + break; + +@@ -154,20 +159,17 @@ validate_path(struct bgp_proto *p, int as_path, int bs, byte *idata, uint *ileng + + log(L_WARN "%s: %s_PATH attribute contains AS_CONFED_* segment, skipping segment", + p->p.name, as_path ? "AS" : "AS4"); +- copy = 0; +- break; ++ goto skip; + + default: + return -1; + } + +- if (copy) +- { +- if (dst != a) +- memmove(dst, a, plen); +- dst += plen; +- } ++ if (dst != a) ++ memmove(dst, a, plen); ++ dst += plen; + ++ skip: + len -= plen; + a += plen; + } diff --git a/net/bird/files/patch-sysdep-unix-io.c b/net/bird/files/patch-sysdep-unix-io.c new file mode 100644 index 000000000000..8802bc3a2475 --- /dev/null +++ b/net/bird/files/patch-sysdep-unix-io.c @@ -0,0 +1,80 @@ +diff --git sysdep/unix/io.c sysdep/unix/io.c +index 486319f..8198743 100644 +--- sysdep/unix/io.c ++++ sysdep/unix/io.c +@@ -1211,7 +1211,7 @@ sk_setup(sock *s) + if (s->iface) + { + #ifdef SO_BINDTODEVICE +- struct ifreq ifr; ++ struct ifreq ifr = {}; + strcpy(ifr.ifr_name, s->iface->name); + if (setsockopt(s->fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0) + ERR("SO_BINDTODEVICE"); +@@ -1854,6 +1854,20 @@ sk_write(sock *s) + } + + void ++sk_err(sock *s, int revents) ++{ ++ int se = 0, sse = sizeof(se); ++ if (revents & POLLERR) ++ if (getsockopt(s->fd, SOL_SOCKET, SO_ERROR, &se, &sse) < 0) ++ { ++ log(L_ERR "IO: Socket error: SO_ERROR: %m"); ++ se = 0; ++ } ++ ++ s->err_hook(s, se); ++} ++ ++void + sk_dump_all(void) + { + node *n; +@@ -2163,7 +2177,7 @@ io_loop(void) + int steps; + + steps = MAX_STEPS; +- if (s->fast_rx && (pfd[s->index].revents & (POLLIN | POLLHUP | POLLERR)) && s->rx_hook) ++ if (s->fast_rx && (pfd[s->index].revents & POLLIN) && s->rx_hook) + do + { + steps--; +@@ -2185,6 +2199,7 @@ io_loop(void) + goto next; + } + while (e && steps); ++ + current_sock = sk_next(s); + next: ; + } +@@ -2208,18 +2223,26 @@ io_loop(void) + goto next2; + } + +- if (!s->fast_rx && (pfd[s->index].revents & (POLLIN | POLLHUP | POLLERR)) && s->rx_hook) ++ if (!s->fast_rx && (pfd[s->index].revents & POLLIN) && s->rx_hook) + { + count++; + io_log_event(s->rx_hook, s->data); + sk_read(s, pfd[s->index].revents); + if (s != current_sock) +- goto next2; ++ goto next2; ++ } ++ ++ if (pfd[s->index].revents & (POLLHUP | POLLERR)) ++ { ++ sk_err(s, pfd[s->index].revents); ++ goto next2; + } ++ + current_sock = sk_next(s); + next2: ; + } + ++ + stored_sock = current_sock; + } + } |