summaryrefslogtreecommitdiff
path: root/sbin/brconfig/brconfig.c
diff options
context:
space:
mode:
authorJason Wright <jason@cvs.openbsd.org>1999-09-03 12:47:13 +0000
committerJason Wright <jason@cvs.openbsd.org>1999-09-03 12:47:13 +0000
commitca6c031ba2f96dfd33331129d4c75bcab1c9d98b (patch)
treecbdbbe2b228124b4e8f47ee9adc9a42cf09de54a /sbin/brconfig/brconfig.c
parent95e954703325257fecc63c102648a19235fb9618 (diff)
Don't delete the cache on down/up transitions unless it's empty. Instead
flush the dynamics. Required other handling of the cache table to accomodate. Modify SIOCBRDGFLUSH to handle flushall and flush dynamic requests.
Diffstat (limited to 'sbin/brconfig/brconfig.c')
-rw-r--r--sbin/brconfig/brconfig.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/sbin/brconfig/brconfig.c b/sbin/brconfig/brconfig.c
index 786d9a925df..c10025b1929 100644
--- a/sbin/brconfig/brconfig.c
+++ b/sbin/brconfig/brconfig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: brconfig.c,v 1.1 1999/09/01 03:28:01 deraadt Exp $ */
+/* $OpenBSD: brconfig.c,v 1.2 1999/09/03 12:47:12 jason Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -429,31 +429,14 @@ bridge_flushall(s, brdg)
int s;
char *brdg;
{
- struct ifreq ifr;
-
- strlcpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name));
- if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
- warn("ioctl(SIOCGIFFLAGS)");
- return (EX_IOERR);
- }
-
- if ((ifr.ifr_flags & IFF_UP) == 0)
- return (0);
-
- strlcpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name));
- ifr.ifr_flags &= ~IFF_UP;
- if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) {
- warn("ioctl(SIOCSIFFLAGS)");
- return (EX_IOERR);
- }
+ struct ifbreq req;
- strlcpy(ifr.ifr_name, brdg, sizeof(ifr.ifr_name));
- ifr.ifr_flags |= IFF_UP;
- if (ioctl(s, SIOCSIFFLAGS, (caddr_t)&ifr) < 0) {
- warn("ioctl(SIOCSIFFLAGS)");
+ strlcpy(req.ifbr_name, brdg, sizeof(req.ifbr_name));
+ req.ifbr_ifsflags = IFBF_FLUSHALL;
+ if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) {
+ warn("ioctl(SIOCBRDGFLUSH)");
return (EX_IOERR);
}
-
return (0);
}
@@ -465,6 +448,7 @@ bridge_flush(s, brdg)
struct ifbreq req;
strlcpy(req.ifbr_name, brdg, sizeof(req.ifbr_name));
+ req.ifbr_ifsflags = IFBF_FLUSHDYN;
if (ioctl(s, SIOCBRDGFLUSH, &req) < 0) {
warn("ioctl(SIOCBRDGFLUSH)");
return (EX_IOERR);