summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclaudio <claudio@openbsd.org>2016-09-04 09:41:03 +0000
committerclaudio <claudio@openbsd.org>2016-09-04 09:41:03 +0000
commitf4fe0610e8692a6081e04f976638bb3cdaf3a5bb (patch)
tree8db09c36a4e3b069de43eb45b5615b6ac15bcbea
parentMake it possible to toggle RTF_BFD via RTM_CHANGE and fix some minor things (diff)
downloadwireguard-openbsd-f4fe0610e8692a6081e04f976638bb3cdaf3a5bb.tar.xz
wireguard-openbsd-f4fe0610e8692a6081e04f976638bb3cdaf3a5bb.zip
Make it possible to set the RTF_BFD flag in a change request. Also add a
nobfd option to turn it off again. While here also print the fmask in the rtmsg dump so it is possible to figure out why something happens (or not). OK phessler@
-rw-r--r--sbin/route/keywords.h4
-rw-r--r--sbin/route/keywords.sh3
-rw-r--r--sbin/route/route.c11
3 files changed, 14 insertions, 4 deletions
diff --git a/sbin/route/keywords.h b/sbin/route/keywords.h
index 8345534d493..0e03f7931bb 100644
--- a/sbin/route/keywords.h
+++ b/sbin/route/keywords.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: keywords.h,v 1.32 2016/09/03 14:23:14 phessler Exp $ */
+/* $OpenBSD: keywords.h,v 1.33 2016/09/04 09:41:03 claudio Exp $ */
/* WARNING! This file was generated by keywords.sh */
@@ -46,6 +46,7 @@ enum {
K_MTU,
K_NET,
K_NETMASK,
+ K_NOBFD,
K_NOJUMBO,
K_NOSTATIC,
K_OSPF,
@@ -107,6 +108,7 @@ struct keytab keywords[] = {
{ "mtu", K_MTU },
{ "net", K_NET },
{ "netmask", K_NETMASK },
+ { "nobfd", K_NOBFD },
{ "nojumbo", K_NOJUMBO },
{ "nostatic", K_NOSTATIC },
{ "ospf", K_OSPF },
diff --git a/sbin/route/keywords.sh b/sbin/route/keywords.sh
index 2e372ff9816..ec77099f9e6 100644
--- a/sbin/route/keywords.sh
+++ b/sbin/route/keywords.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: keywords.sh,v 1.30 2016/09/03 14:23:14 phessler Exp $
+# $OpenBSD: keywords.sh,v 1.31 2016/09/04 09:41:03 claudio Exp $
# $NetBSD: keywords.sh,v 1.2 1996/11/15 18:57:21 gwr Exp $
# @(#)keywords 8.2 (Berkeley) 3/19/94
#
@@ -47,6 +47,7 @@ mplslabel
mtu
net
netmask
+nobfd
nojumbo
nostatic
ospf
diff --git a/sbin/route/route.c b/sbin/route/route.c
index dc0bd45a456..1892e2a1984 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.189 2016/09/03 14:23:14 phessler Exp $ */
+/* $OpenBSD: route.c,v 1.190 2016/09/04 09:41:03 claudio Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -609,6 +609,11 @@ newroute(int argc, char **argv)
break;
case K_BFD:
flags |= RTF_BFD;
+ fmask |= RTF_BFD;
+ break;
+ case K_NOBFD:
+ flags &= ~RTF_BFD;
+ fmask |= RTF_BFD;
break;
default:
usage(1+*argv);
@@ -1244,7 +1249,7 @@ char routeflags[] =
"\1UP\2GATEWAY\3HOST\4REJECT\5DYNAMIC\6MODIFIED\7DONE\010XMASK_PRESENT"
"\011CLONING\012MULTICAST\013LLINFO\014STATIC\015BLACKHOLE\016PROTO3\017PROTO2"
"\020PROTO1\021CLONED\022CACHED\023MPATH\025MPLS\026LOCAL\027BROADCAST"
-"\030CONNECTED";
+"\030CONNECTED\031BFD";
char ifnetflags[] =
"\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5PTP\6NOTRAILERS\7RUNNING\010NOARP\011PPROMISC"
"\012ALLMULTI\013OACTIVE\014SIMPLEX\015LINK0\016LINK1\017LINK2\020MULTICAST";
@@ -1336,6 +1341,8 @@ print_rtmsg(struct rt_msghdr *rtm, int msglen)
printf("pid: %ld, seq %d, errno %d\nflags:",
(long)rtm->rtm_pid, rtm->rtm_seq, rtm->rtm_errno);
bprintf(stdout, rtm->rtm_flags, routeflags);
+ printf("\nfmask:");
+ bprintf(stdout, rtm->rtm_fmask, routeflags);
if (verbose) {
#define lock(f) ((rtm->rtm_rmx.rmx_locks & __CONCAT(RTV_,f)) ? 'L' : ' ')
relative_expire = rtm->rtm_rmx.rmx_expire ?