summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorCedric Berger <cedric@cvs.openbsd.org>2004-06-19 19:55:54 +0000
committerCedric Berger <cedric@cvs.openbsd.org>2004-06-19 19:55:54 +0000
commit28b515bbefd3b127eb44ccd3870c0d83faea1bc6 (patch)
treefff59f9746cbae4f8c82675f1523e9cf6f5b9002 /sys
parent8492edcbdd71a02640bccdc064efdaec439e7b62 (diff)
require RTF_MPATH to enter a multipath route with RTM_ADD.
route(8) takes a new -mpath modifier to enter a multipath route. requested deraadt@, ok itojun@ mcbride@ millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/radix_mpath.c9
-rw-r--r--sys/net/radix_mpath.h4
-rw-r--r--sys/net/route.c4
-rw-r--r--sys/net/route.h3
4 files changed, 12 insertions, 8 deletions
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 */