diff options
-rw-r--r-- | sbin/route/keywords.c | 3 | ||||
-rw-r--r-- | sbin/route/keywords.h | 47 | ||||
-rw-r--r-- | sbin/route/keywords.sh | 3 | ||||
-rw-r--r-- | sbin/route/route.8 | 9 | ||||
-rw-r--r-- | sbin/route/route.c | 11 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 9 | ||||
-rw-r--r-- | sys/net/radix_mpath.h | 4 | ||||
-rw-r--r-- | sys/net/route.c | 4 | ||||
-rw-r--r-- | sys/net/route.h | 3 |
9 files changed, 56 insertions, 37 deletions
diff --git a/sbin/route/keywords.c b/sbin/route/keywords.c index eb6a73237db..e45986b497b 100644 --- a/sbin/route/keywords.c +++ b/sbin/route/keywords.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keywords.c,v 1.7 2004/06/06 17:08:23 cedric Exp $ */ +/* $OpenBSD: keywords.c,v 1.8 2004/06/19 19:55:53 cedric Exp $ */ /* WARNING! This file was generated by keywords.sh */ @@ -33,6 +33,7 @@ struct keytab keywords[] = { {"lockrest", K_LOCKREST}, {"mask", K_MASK}, {"monitor", K_MONITOR}, + {"mpath", K_MPATH}, {"mtu", K_MTU}, {"net", K_NET}, {"netmask", K_NETMASK}, diff --git a/sbin/route/keywords.h b/sbin/route/keywords.h index 2c2d9cdae8b..c3584a23d5a 100644 --- a/sbin/route/keywords.h +++ b/sbin/route/keywords.h @@ -1,4 +1,4 @@ -/* $OpenBSD: keywords.h,v 1.7 2004/06/06 17:08:23 cedric Exp $ */ +/* $OpenBSD: keywords.h,v 1.8 2004/06/19 19:55:53 cedric Exp $ */ /* WARNING! This file was generated by keywords.sh */ @@ -35,25 +35,26 @@ extern struct keytab { #define K_LOCKREST 25 #define K_MASK 26 #define K_MONITOR 27 -#define K_MTU 28 -#define K_NET 29 -#define K_NETMASK 30 -#define K_NOSTATIC 31 -#define K_OSI 32 -#define K_PREFIXLEN 33 -#define K_PROTO1 34 -#define K_PROTO2 35 -#define K_RECVPIPE 36 -#define K_REJECT 37 -#define K_RTT 38 -#define K_RTTVAR 39 -#define K_SA 40 -#define K_SENDPIPE 41 -#define K_SHOW 42 -#define K_SRC 43 -#define K_SRCMASK 44 -#define K_SSTHRESH 45 -#define K_STATIC 46 -#define K_X25 47 -#define K_XNS 48 -#define K_XRESOLVE 49 +#define K_MPATH 28 +#define K_MTU 29 +#define K_NET 30 +#define K_NETMASK 31 +#define K_NOSTATIC 32 +#define K_OSI 33 +#define K_PREFIXLEN 34 +#define K_PROTO1 35 +#define K_PROTO2 36 +#define K_RECVPIPE 37 +#define K_REJECT 38 +#define K_RTT 39 +#define K_RTTVAR 40 +#define K_SA 41 +#define K_SENDPIPE 42 +#define K_SHOW 43 +#define K_SRC 44 +#define K_SRCMASK 45 +#define K_SSTHRESH 46 +#define K_STATIC 47 +#define K_X25 48 +#define K_XNS 49 +#define K_XRESOLVE 50 diff --git a/sbin/route/keywords.sh b/sbin/route/keywords.sh index f79f7330a24..820672532a9 100644 --- a/sbin/route/keywords.sh +++ b/sbin/route/keywords.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $OpenBSD: keywords.sh,v 1.6 2004/06/06 17:08:23 cedric Exp $ +# $OpenBSD: keywords.sh,v 1.7 2004/06/19 19:55:53 cedric Exp $ # $NetBSD: keywords.sh,v 1.2 1996/11/15 18:57:21 gwr Exp $ # @(#)keywords 8.2 (Berkeley) 3/19/94 # @@ -36,6 +36,7 @@ lock lockrest mask monitor +mpath mtu net netmask diff --git a/sbin/route/route.8 b/sbin/route/route.8 index 8a500f180c4..7b0096f56fc 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: route.8,v 1.33 2004/06/18 17:04:15 millert Exp $ +.\" $OpenBSD: route.8,v 1.34 2004/06/19 19:55:53 cedric Exp $ .\" $NetBSD: route.8,v 1.6 1995/03/18 15:00:13 cgd Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 @@ -242,6 +242,13 @@ can be overridden by making sure this option follows the destination parameter. .Fl prefixlen is also available for a similar purpose, for IPv6/v4. .Pp +The +.Fl mpath +modifier need to be specified with the +.Cm add +command to be able to enter multiple gateways for the same destination address +(multipath). +.Pp Routes have associated flags which influence operation of the protocols when sending to destinations matched by the routes. These flags may be set (or sometimes cleared) diff --git a/sbin/route/route.c b/sbin/route/route.c index 102ca6c6114..e548d1d6e56 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.69 2004/06/12 09:40:49 claudio Exp $ */ +/* $OpenBSD: route.c,v 1.70 2004/06/19 19:55:53 cedric Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static const char rcsid[] = "$OpenBSD: route.c,v 1.69 2004/06/12 09:40:49 claudio Exp $"; +static const char rcsid[] = "$OpenBSD: route.c,v 1.70 2004/06/19 19:55:53 cedric Exp $"; #endif #endif /* not lint */ @@ -374,7 +374,7 @@ newroute(int argc, char **argv) { char *cmd, *dest = "", *source = "", *gateway = "", *err; int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC; - int key; + int key, mpath = 0; struct hostent *hp = 0; if (uid) { @@ -513,6 +513,9 @@ newroute(int argc, char **argv) usage(1+*argv); ishost = prefixlen(*++argv); break; + case K_MPATH: + mpath++; + break; case K_MTU: case K_HOPCOUNT: case K_EXPIRE: @@ -564,6 +567,8 @@ newroute(int argc, char **argv) if (forcenet) ishost = 0; flags |= RTF_UP; + if (mpath) + flags |= RTF_MPATH; if (ishost) flags |= RTF_HOST; if (iflag == 0) diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index e835b54a703..3d612bd98c8 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.1 2004/04/25 02:48:03 itojun Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.2 2004/06/19 19:55:53 cedric Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -116,10 +116,11 @@ rt_mpath_matchgate(rt, gate) * check if we have the same key/mask/gateway on the table already. */ int -rt_mpath_conflict(rnh, rt, netmask) +rt_mpath_conflict(rnh, rt, netmask, mpathok) struct radix_node_head *rnh; struct rtentry *rt; struct sockaddr *netmask; + int mpathok; { struct radix_node *rn, *rn1; struct rtentry *rt1; @@ -190,7 +191,9 @@ rt_mpath_conflict(rnh, rt, netmask) goto different; } - maskmatched:; + maskmatched: + if (!mpathok) + return EEXIST; /* key/mask were the same. compare gateway for all multipaths */ do { diff --git a/sys/net/radix_mpath.h b/sys/net/radix_mpath.h index 6ea34e344ce..8ee88ee34a8 100644 --- a/sys/net/radix_mpath.h +++ b/sys/net/radix_mpath.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.h,v 1.2 2004/06/14 00:32:30 deraadt Exp $ */ +/* $OpenBSD: radix_mpath.h,v 1.3 2004/06/19 19:55:53 cedric Exp $ */ /* $KAME: radix_mpath.h,v 1.9 2004/03/30 11:21:49 keiichi Exp $ */ /* @@ -49,7 +49,7 @@ struct radix_node *rn_mpath_next(struct radix_node *); int rn_mpath_count(struct radix_node *); struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *); int rt_mpath_conflict(struct radix_node_head *, struct rtentry *, - struct sockaddr *); + struct sockaddr *, int); void rtalloc_mpath(struct route *, int); int rn_mpath_inithead(void **, int); #endif diff --git a/sys/net/route.c b/sys/net/route.c index 62c5b865121..f7cbbaba971 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.41 2004/06/06 16:49:09 cedric Exp $ */ +/* $OpenBSD: route.c,v 1.42 2004/06/19 19:55:53 cedric Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -769,7 +769,7 @@ rtrequest1(req, info, ret_nrt) #ifndef SMALL_KERNEL /* do not permit exactly the same dst/mask/gw pair */ if (rn_mpath_capable(rnh) && - rt_mpath_conflict(rnh, rt, netmask)) { + rt_mpath_conflict(rnh, rt, netmask, flags & RTF_MPATH)) { if (rt->rt_gwroute) rtfree(rt->rt_gwroute); Free(rt_key(rt)); diff --git a/sys/net/route.h b/sys/net/route.h index fefbda574d2..31a25a0e73e 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.22 2004/06/06 16:49:09 cedric Exp $ */ +/* $OpenBSD: route.h,v 1.23 2004/06/19 19:55:53 cedric Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -151,6 +151,7 @@ struct ortentry { #define RTF_PROTO1 0x8000 /* protocol specific routing flag */ #define RTF_CLONED 0x10000 /* this is a cloned route */ #define RTF_SOURCE 0x20000 /* this route has a source selector */ +#define RTF_MPATH 0x40000 /* multipath route or operation */ #ifndef _KERNEL /* obsoleted */ |