From ff6f118abfa4b74f4d79424f14ee396be15ee591 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Fri, 2 Nov 2007 12:50:20 +0000 Subject: [PATCH] 'ipfw pipe X config bw iface' never works, so nuke the related user/kernel land bits. --- sbin/ipfw/ipfw.8 | 15 ++------------ sbin/ipfw/ipfw2.c | 30 ++++++++++------------------ sys/net/dummynet/ip_dummynet.c | 45 +++++++++++------------------------------- 3 files changed, 24 insertions(+), 66 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index e50b3d9f8f..1045c7b564 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,6 +1,6 @@ .\" .\" $FreeBSD: src/sbin/ipfw/ipfw.8,v 1.63.2.33 2003/02/04 01:36:02 brueffer Exp $ -.\" $DragonFly: src/sbin/ipfw/ipfw.8,v 1.13 2007/09/14 23:47:53 swildner Exp $ +.\" $DragonFly: src/sbin/ipfw/ipfw.8,v 1.14 2007/11/02 12:50:20 sephe Exp $ .\" .Dd August 13, 2002 .Dt IPFW 8 @@ -1282,7 +1282,7 @@ configuration commands are the following: The following parameters can be configured for a pipe: .Pp .Bl -tag -width indent -compact -.It Cm bw Ar bandwidth | device +.It Cm bw Ar bandwidth Bandwidth, measured in .Sm off .Op Cm K | M @@ -1294,17 +1294,6 @@ The unit must immediately follow the number, as in .Pp .Dl "ipfw pipe 1 config bw 300Kbit/s" .Pp -If a device name is specified instead of a numeric value, as in -.Pp -.Dl "ipfw pipe 1 config bw tun0" -.Pp -then the transmit clock is supplied by the specified device. -At the moment only the -.Xr tun 4 -device supports this -functionality, for use in conjunction with -.Xr ppp 8 . -.Pp .It Cm delay Ar ms-delay Propagation delay, measured in milliseconds. The value is rounded to the next multiple of the clock tick diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 5abf3c4757..86de86af16 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -18,7 +18,7 @@ * NEW command line interface for IP firewall facility * * $FreeBSD: src/sbin/ipfw/ipfw2.c,v 1.4.2.13 2003/05/27 22:21:11 gshapiro Exp $ - * $DragonFly: src/sbin/ipfw/ipfw2.c,v 1.8 2006/06/25 11:02:37 corecode Exp $ + * $DragonFly: src/sbin/ipfw/ipfw2.c,v 1.9 2007/11/02 12:50:20 sephe Exp $ */ #include @@ -1380,11 +1380,9 @@ list_pipes(void *data, int nbytes, int ac, char *av[]) continue; /* - * Print rate (or clocking interface) + * Print rate */ - if (p->if_name[0] != '\0') - sprintf(buf, "%s", p->if_name); - else if (b == 0) + if (b == 0) sprintf(buf, "unlimited"); else if (b >= 1000000) sprintf(buf, "%7.3f Mbit/s", b/1000000); @@ -2209,25 +2207,17 @@ end_mask: break; case TOK_BW: - NEED1("bw needs bandwidth or interface\n"); + NEED1("bw needs bandwidth\n"); if (do_pipe != 1) errx(EX_DATAERR, "bandwidth only valid for pipes"); /* - * set clocking interface or bandwidth value + * set bandwidth value */ - if (av[0][0] >= 'a' && av[0][0] <= 'z') { - int l = sizeof(pipe.if_name)-1; - /* interface name */ - strncpy(pipe.if_name, av[0], l); - pipe.if_name[l] = '\0'; - pipe.bandwidth = 0; - } else { - pipe.if_name[0] = '\0'; - pipe.bandwidth = strtoul(av[0], &end, 0); - pipe.bandwidth = getbw(av[0], NULL, 1000); - if (pipe.bandwidth < 0) - errx(EX_DATAERR, "bandwidth too large"); - } + pipe.if_name[0] = '\0'; + pipe.bandwidth = strtoul(av[0], &end, 0); + pipe.bandwidth = getbw(av[0], NULL, 1000); + if (pipe.bandwidth < 0) + errx(EX_DATAERR, "bandwidth too large"); ac--; av++; break; diff --git a/sys/net/dummynet/ip_dummynet.c b/sys/net/dummynet/ip_dummynet.c index 66a5b146c0..87edc64ff5 100644 --- a/sys/net/dummynet/ip_dummynet.c +++ b/sys/net/dummynet/ip_dummynet.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.24.2.22 2003/05/13 09:31:06 maxim Exp $ - * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.38 2007/11/02 10:28:50 sephe Exp $ + * $DragonFly: src/sys/net/dummynet/ip_dummynet.c,v 1.39 2007/11/02 12:50:20 sephe Exp $ */ #ifndef KLD_MODULE @@ -557,16 +557,7 @@ ready_event_wfq(struct dn_pipe *p) struct dn_heap *sch = &p->scheduler_heap; struct dn_heap *neh = &p->not_eligible_heap; - if (p->if_name[0] == 0) { /* tx clock is simulated */ - p->numbytes += (curr_time - p->sched_time) * p->bandwidth; - } else { /* tx clock is for real, the ifq must be empty or this is a NOP */ - if (p->ifp && p->ifp->if_snd.ifq_head != NULL) { - return; - } else { - DEB(kprintf("pipe %d ready from %s --\n", - p->pipe_nr, p->if_name);) - } - } + p->numbytes += (curr_time - p->sched_time) * p->bandwidth; /* * While we have backlogged traffic AND credit, we need to do @@ -622,11 +613,6 @@ ready_event_wfq(struct dn_pipe *p) heap_extract(neh, NULL); heap_insert(sch, q->F, q); } - - if (p->if_name[0] != '\0') { /* tx clock is from a real thing */ - p->numbytes = -1; /* mark not ready for I/O */ - break; - } } if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0 && @@ -648,11 +634,11 @@ ready_event_wfq(struct dn_pipe *p) } /* - * If we are getting clocks from dummynet (not a real interface) and - * If we are under credit, schedule the next ready event. + * If we are getting clocks from dummynet and if we are under credit, + * schedule the next ready event. * Also fix the delivery time of the last packet. */ - if (p->if_name[0] == 0 && p->numbytes < 0) { /* This implies bandwidth>0 */ + if (p->numbytes < 0) { /* This implies bandwidth>0 */ dn_key t = 0; /* Number of ticks i have to wait */ if (p->bandwidth > 0) @@ -708,20 +694,12 @@ dummynet(struct netmsg *msg) p = h->p[0].object; /* Store a copy before heap_extract */ heap_extract(h, NULL); /* Need to extract before processing */ - if (i == 0) { + if (i == 0) ready_event(p); - } else if (i == 1) { - struct dn_pipe *pipe = p; - - if (pipe->if_name[0] != '\0') { - kprintf("*** bad ready_event_wfq for pipe %s\n", - pipe->if_name); - } else { - ready_event_wfq(p); - } - } else { + else if (i == 1) + ready_event_wfq(p); + else transmit_event(p); - } } } @@ -1562,10 +1540,11 @@ config_pipe(struct dn_pipe *p) x->bandwidth = p->bandwidth; x->numbytes = 0; /* Just in case... */ - bcopy(p->if_name, x->if_name, sizeof(x->if_name)); - x->ifp = NULL; /* Reset interface ptr */ x->delay = p->delay; + bzero(x->if_name, sizeof(x->if_name)); /* XXX nuke */ + x->ifp = NULL; /* XXX nuke, Reset interface ptr */ + set_fs_parms(&x->fs, pfs); if (x->fs.rq == NULL) { /* A new pipe */ -- 2.11.4.GIT