Page MenuHomeFreeBSD

D42316.id129266.diff
No OneTemporary

D42316.id129266.diff

diff --git a/usr.sbin/ndp/ndp.h b/usr.sbin/ndp/ndp.h
--- a/usr.sbin/ndp/ndp.h
+++ b/usr.sbin/ndp/ndp.h
@@ -20,7 +20,7 @@
char *sec2str(time_t total);
int getaddr(char *host, struct sockaddr_in6 *sin6);
int print_entries_nl(uint32_t ifindex, struct sockaddr_in6 *addr, bool cflag);
-int delete_nl(uint32_t ifindex, char *host);
+int delete_nl(uint32_t ifindex, char *host, bool warn);
int set_nl(uint32_t ifindex, struct sockaddr_in6 *dst, struct sockaddr_dl *sdl,
char *host);
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c
--- a/usr.sbin/ndp/ndp.c
+++ b/usr.sbin/ndp/ndp.c
@@ -201,6 +201,7 @@
{
int ch, mode = 0;
char *arg = NULL;
+ int ret = 0;
pid = getpid();
thiszone = utc_offset();
@@ -280,7 +281,7 @@
/*NOTREACHED*/
}
xo_open_list("neighbor-cache");
- delete(arg);
+ ret = delete(arg);
xo_close_list("neighbor-cache");
break;
case 'I':
@@ -353,7 +354,8 @@
}
xo_close_container("ndp");
xo_finish();
- exit(0);
+
+ return (ret);
}
/*
@@ -841,7 +843,7 @@
delete(char *host)
{
#ifndef WITHOUT_NETLINK
- return (delete_nl(0, host));
+ return (delete_nl(0, host, true)); /* do warn */
#else
return (delete_rtsock(host));
#endif
diff --git a/usr.sbin/ndp/ndp_netlink.c b/usr.sbin/ndp/ndp_netlink.c
--- a/usr.sbin/ndp/ndp_netlink.c
+++ b/usr.sbin/ndp/ndp_netlink.c
@@ -180,7 +180,7 @@
int off = snl_add_msg_attr_nested(&nw, NHA_FREEBSD);
snl_add_msg_attr_u32(&nw, NHAF_KID, r.rta_knh_id);
- snl_add_msg_attr_u8(&nw, NHAF_FAMILY, AF_INET);
+ snl_add_msg_attr_u8(&nw, NHAF_FAMILY, AF_INET6);
snl_add_msg_attr_u32(&nw, NHAF_TABLE, fibnum);
snl_end_attr_nested(&nw, off);
@@ -372,13 +372,14 @@
continue;
}
- print_entry(&neigh, &link);
if (cflag) {
char dst_str[INET6_ADDRSTRLEN];
inet_ntop(AF_INET6, &dst->sin6_addr, dst_str, sizeof(dst_str));
- delete_nl(neigh.nda_ifindex, dst_str);
- }
+ delete_nl(neigh.nda_ifindex, dst_str, false); /* no warn */
+ } else
+ print_entry(&neigh, &link);
+
count++;
snl_clear_lb(&ss_req);
}
@@ -391,8 +392,9 @@
}
int
-delete_nl(uint32_t ifindex, char *host)
+delete_nl(uint32_t ifindex, char *host, bool warn)
{
+#define xo_warnx(...) do { if (warn) { xo_warnx(__VA_ARGS__); } } while(0)
struct snl_state ss = {};
struct snl_writer nw;
struct sockaddr_in6 dst;
@@ -458,6 +460,7 @@
snl_free(&ss);
return (e.error != 0);
+#undef xo_warnx /* see above */
}
int

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 7:50 PM (19 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14947437
Default Alt Text
D42316.id129266.diff (2 KB)

Event Timeline