diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-12-09 10:11:54 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-12-09 10:11:54 +0000 |
commit | a5067ef6691277e4fbaa1b87da74ecb3dee425d3 (patch) | |
tree | 4f10d364a34a108b8ac539400e2d17d77180cb65 /sys | |
parent | a132b5806b65d29bb80a0aab6478ed425672a4f3 (diff) |
allow setting of ifcost with brconfig. enables selection of preferred
port/path to root bridge among several LANs. unlike ifpriority, which
allows you to select designated port if serveral interfaces belong
to the same LAN; ok jason@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/bridgestp.c | 3 | ||||
-rw-r--r-- | sys/net/if_bridge.c | 15 | ||||
-rw-r--r-- | sys/net/if_bridge.h | 3 | ||||
-rw-r--r-- | sys/sys/sockio.h | 3 |
4 files changed, 19 insertions, 5 deletions
diff --git a/sys/net/bridgestp.c b/sys/net/bridgestp.c index 4bb56448500..e743e97a3b3 100644 --- a/sys/net/bridgestp.c +++ b/sys/net/bridgestp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bridgestp.c,v 1.11 2002/12/04 15:44:21 markus Exp $ */ +/* $OpenBSD: bridgestp.c,v 1.12 2002/12/09 10:11:52 markus Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -1259,6 +1259,7 @@ bstp_ioctl(ifp, cmd, data) case SIOCBRDGDEL: case SIOCBRDGSIFFLGS: case SIOCBRDGSIFPRIO: + case SIOCBRDGSIFCOST: r = 1; break; default: diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 09464b62af1..9440531e475 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.104 2002/12/04 15:44:21 markus Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.105 2002/12/09 10:11:52 markus Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -432,6 +432,7 @@ bridge_ioctl(ifp, cmd, data) req->ifbr_ifsflags = p->bif_flags; req->ifbr_state = p->bif_state; req->ifbr_priority = p->bif_priority; + req->ifbr_path_cost = p->bif_path_cost; req->ifbr_portno = p->ifp->if_index & 0xff; break; case SIOCBRDGSIFFLGS: @@ -466,6 +467,7 @@ bridge_ioctl(ifp, cmd, data) p->bif_flags = req->ifbr_ifsflags; break; case SIOCBRDGSIFPRIO: + case SIOCBRDGSIFCOST: if ((error = suser(prc->p_ucred, &prc->p_acflag)) != 0) break; ifs = ifunit(req->ifbr_ifsname); @@ -485,7 +487,14 @@ bridge_ioctl(ifp, cmd, data) error = ESRCH; break; } - p->bif_priority = req->ifbr_priority; + if (cmd == SIOCBRDGSIFPRIO) + p->bif_priority = req->ifbr_priority; + else { + if (req->ifbr_path_cost < 1) + error = EINVAL; + else + p->bif_path_cost = req->ifbr_path_cost; + } break; case SIOCBRDGRTS: error = bridge_rtfind(sc, baconf); @@ -685,6 +694,7 @@ bridge_bifconf(sc, bifc) breq.ifbr_ifsflags = p->bif_flags; breq.ifbr_state = p->bif_state; breq.ifbr_priority = p->bif_priority; + breq.ifbr_path_cost = p->bif_path_cost; breq.ifbr_portno = p->ifp->if_index & 0xff; error = copyout((caddr_t)&breq, (caddr_t)(bifc->ifbic_req + i), sizeof(breq)); @@ -701,6 +711,7 @@ bridge_bifconf(sc, bifc) breq.ifbr_ifsflags = p->bif_flags | IFBIF_SPAN; breq.ifbr_state = p->bif_state; breq.ifbr_priority = p->bif_priority; + breq.ifbr_path_cost = p->bif_path_cost; breq.ifbr_portno = p->ifp->if_index & 0xff; error = copyout((caddr_t)&breq, (caddr_t)(bifc->ifbic_req + i), sizeof(breq)); diff --git a/sys/net/if_bridge.h b/sys/net/if_bridge.h index 18832b4dabc..b629cada435 100644 --- a/sys/net/if_bridge.h +++ b/sys/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.19 2002/12/04 15:44:21 markus Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.20 2002/12/09 10:11:52 markus Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -49,6 +49,7 @@ struct ifbreq { u_int8_t ifbr_state; /* member stp state */ u_int8_t ifbr_priority; /* member stp priority */ u_int8_t ifbr_portno; /* member port number */ + u_int32_t ifbr_path_cost; /* member stp path cost */ }; /* SIOCBRDGIFFLGS, SIOCBRDGIFFLGS */ #define IFBIF_LEARNING 0x0001 /* ifs can learn */ diff --git a/sys/sys/sockio.h b/sys/sys/sockio.h index b21bac6b425..fdd43bfe6fe 100644 --- a/sys/sys/sockio.h +++ b/sys/sys/sockio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sockio.h,v 1.20 2001/12/15 08:40:56 jason Exp $ */ +/* $OpenBSD: sockio.h,v 1.21 2002/12/09 10:11:52 markus Exp $ */ /* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */ /*- @@ -128,6 +128,7 @@ #define SIOCBRDGGMA _IOWR('i', 83, struct ifbrparam)/* get max age */ #define SIOCBRDGSMA _IOW('i', 83, struct ifbrparam)/* set max age */ #define SIOCBRDGSIFPRIO _IOW('i', 84, struct ifbreq) /* set if priority */ +#define SIOCBRDGSIFCOST _IOW('i', 85, struct ifbreq) /* set if cost */ #define SIOCBRDGS #define GRESADDRS _IOW('i', 101, struct ifreq) |