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
This commit is contained in:
Alexander V. Chernikov 2015-09-27 04:54:29 +00:00
parent c91afdd4d0
commit 4a336ef40c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288297
4 changed files with 10 additions and 1 deletions

View file

@ -1333,6 +1333,8 @@ in_lltable_dump_entry(struct lltable *llt, struct llentry *lle,
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));

View file

@ -2354,6 +2354,8 @@ in6_lltable_dump_entry(struct lltable *llt, struct llentry *lle,
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));

View file

@ -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);
}

View file

@ -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;