Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Aug 2016 23:08:09 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r420203 - head/net/bird/files
Message-ID:  <201608142308.u7EN89bx036687@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro (src committer)
Date: Sun Aug 14 23:08:09 2016
New Revision: 420203
URL: https://svnweb.freebsd.org/changeset/ports/420203

Log:
  Fix net/bird r420176  update: really add bugfixes from git.
  
  Approved by:	az(implicit)

Added:
  head/net/bird/files/patch-proto-bgp-attrs.c   (contents, props changed)
  head/net/bird/files/patch-sysdep-unix-io.c   (contents, props changed)

Added: head/net/bird/files/patch-proto-bgp-attrs.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/bird/files/patch-proto-bgp-attrs.c	Sun Aug 14 23:08:09 2016	(r420203)
@@ -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;
+     }

Added: head/net/bird/files/patch-sysdep-unix-io.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/bird/files/patch-sysdep-unix-io.c	Sun Aug 14 23:08:09 2016	(r420203)
@@ -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;
+ 	}
+     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201608142308.u7EN89bx036687>