Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 2015 04:54:30 +0000 (UTC)
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288297 - in head: sys/netinet sys/netinet6 usr.sbin/arp usr.sbin/ndp
Message-ID:  <201509270454.t8R4sUYo083058@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: melifaro
Date: Sun Sep 27 04:54:29 2015
New Revision: 288297
URL: https://svnweb.freebsd.org/changeset/base/288297

Log:
  rtsock requests for deleting interface address lles started to return EPERM
    instead of old "ignore-and-return 0" in r287789. This broke arp -da /
    ndp -cn behavior (they exit on rtsock command failure). Fix this by
    translating LLE_IFADDR to RTM_PINNED flag, passing it to userland and
    making arp/ndp ignore these entries in batched delete.
  
  MFC after:	2 weeks

Modified:
  head/sys/netinet/in.c
  head/sys/netinet6/in6.c
  head/usr.sbin/arp/arp.c
  head/usr.sbin/ndp/ndp.c

Modified: head/sys/netinet/in.c
==============================================================================
--- head/sys/netinet/in.c	Sun Sep 27 04:47:08 2015	(r288296)
+++ head/sys/netinet/in.c	Sun Sep 27 04:54:29 2015	(r288297)
@@ -1333,6 +1333,8 @@ in_lltable_dump_entry(struct lltable *ll
 			arpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA);
 			if (lle->la_flags & LLE_STATIC)
 				arpc.rtm.rtm_flags |= RTF_STATIC;
+			if (lle->la_flags & LLE_IFADDR)
+				arpc.rtm.rtm_flags |= RTF_PINNED;
 			arpc.rtm.rtm_index = ifp->if_index;
 			error = SYSCTL_OUT(wr, &arpc, sizeof(arpc));
 

Modified: head/sys/netinet6/in6.c
==============================================================================
--- head/sys/netinet6/in6.c	Sun Sep 27 04:47:08 2015	(r288296)
+++ head/sys/netinet6/in6.c	Sun Sep 27 04:54:29 2015	(r288297)
@@ -2354,6 +2354,8 @@ in6_lltable_dump_entry(struct lltable *l
 			ndpc.rtm.rtm_flags |= (RTF_HOST | RTF_LLDATA);
 			if (lle->la_flags & LLE_STATIC)
 				ndpc.rtm.rtm_flags |= RTF_STATIC;
+			if (lle->la_flags & LLE_IFADDR)
+				ndpc.rtm.rtm_flags |= RTF_PINNED;
 			ndpc.rtm.rtm_index = ifp->if_index;
 			error = SYSCTL_OUT(wr, &ndpc, sizeof(ndpc));
 

Modified: head/usr.sbin/arp/arp.c
==============================================================================
--- head/usr.sbin/arp/arp.c	Sun Sep 27 04:47:08 2015	(r288296)
+++ head/usr.sbin/arp/arp.c	Sun Sep 27 04:54:29 2015	(r288297)
@@ -673,10 +673,13 @@ print_entry(struct sockaddr_dl *sdl,
  */
 static void
 nuke_entry(struct sockaddr_dl *sdl __unused,
-	struct sockaddr_in *addr, struct rt_msghdr *rtm __unused)
+	struct sockaddr_in *addr, struct rt_msghdr *rtm)
 {
 	char ip[20];
 
+	if (rtm->rtm_flags & RTF_PINNED)
+		return;
+
 	snprintf(ip, sizeof(ip), "%s", inet_ntoa(addr->sin_addr));
 	delete(ip);
 }

Modified: head/usr.sbin/ndp/ndp.c
==============================================================================
--- head/usr.sbin/ndp/ndp.c	Sun Sep 27 04:47:08 2015	(r288296)
+++ head/usr.sbin/ndp/ndp.c	Sun Sep 27 04:54:29 2015	(r288297)
@@ -649,6 +649,8 @@ again:;
 			if (rtm->rtm_flags & RTF_CLONED)
 				delete(host_buf);
 #else
+			if (rtm->rtm_flags & RTF_PINNED)
+				continue;
 			delete(host_buf);
 #endif
 			continue;



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