summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/physical.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-08-05 10:32:16 +0000
committerbrian <brian@FreeBSD.org>1999-08-05 10:32:16 +0000
commit75000c38838f6ae4afe9de4dd06bd3fde6120e1b (patch)
tree26404e4742c87264dac32602be9ec171a2100df1 /usr.sbin/ppp/physical.c
parentc32597f76112e043f5178c1c2237ad6d753da072 (diff)
downloadFreeBSD-src-75000c38838f6ae4afe9de4dd06bd3fde6120e1b.zip
FreeBSD-src-75000c38838f6ae4afe9de4dd06bd3fde6120e1b.tar.gz
o Obsolete the undocumented ``set weight'' command.
o If we're using RADIUS and the RADIUS mtu is less than our peers mru/mrru, reduce our mtu to this value for NetBSD too. o Make struct throughput's sample period dynamic and tweak the ppp version number to reflect the extra stuff being passed through the local domain socket as a result (MP mode). o Measure the current throughput based on the number of samples actually taken rather than on the full sample period. o Keep the throughput statisics persistent while being passed to another ppp invocation through the local domain socket. o When showing throughput statistics after the timer has stopped, use the stopped time for overall calculations, not the current time. Also show the stopped time and how long the current throughput has been sampled for. o Use time() consistently in throughput.c o Tighten up the ``show bundle'' output. o Introduce the ``set bandwidth'' command. o Rewrite the ``set autoload'' command. It now takes three arguments and works based on a rolling bundle throughput average compared against the theoretical bundle bandwidth over a given period (read: it's now functional).
Diffstat (limited to 'usr.sbin/ppp/physical.c')
-rw-r--r--usr.sbin/ppp/physical.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/usr.sbin/ppp/physical.c b/usr.sbin/ppp/physical.c
index ecc1a38..05e1afd 100644
--- a/usr.sbin/ppp/physical.c
+++ b/usr.sbin/ppp/physical.c
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: physical.c,v 1.17 1999/06/05 21:35:51 brian Exp $
+ * $Id: physical.c,v 1.18 1999/06/11 13:28:29 brian Exp $
*
*/
@@ -137,7 +137,9 @@ physical_Create(struct datalink *dl, int type)
p->link.type = PHYSICAL_LINK;
p->link.name = dl->name;
p->link.len = sizeof *p;
- throughput_init(&p->link.throughput);
+
+ /* The sample period is fixed - see physical2iov() & iov2physical() */
+ throughput_init(&p->link.throughput, SAMPLE_PERIOD);
memset(p->link.Queue, '\0', sizeof p->link.Queue);
memset(p->link.proto_in, '\0', sizeof p->link.proto_in);
@@ -232,7 +234,7 @@ physical_GetSpeed(struct physical *p)
if (p->handler && p->handler->speed)
return (*p->handler->speed)(p);
- return 115200;
+ return 0;
}
int
@@ -347,6 +349,7 @@ void
physical_Destroy(struct physical *p)
{
physical_Close(p);
+ throughput_destroy(&p->link.throughput);
free(p);
}
@@ -526,7 +529,6 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov,
p = (struct physical *)iov[(*niov)++].iov_base;
p->link.name = dl->name;
- throughput_init(&p->link.throughput);
memset(p->link.Queue, '\0', sizeof p->link.Queue);
p->desc.UpdateSet = physical_UpdateSet;
@@ -565,6 +567,7 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov,
p->hdlc.lqm.timer.state = TIMER_STOPPED;
p->fd = fd;
+ p->link.throughput.SampleOctets = (long long *)iov[(*niov)++].iov_base;
type = (long)p->handler;
p->handler = NULL;
@@ -584,8 +587,8 @@ iov2physical(struct datalink *dl, struct iovec *iov, int *niov, int maxiov,
lqr_reStart(&p->link.lcp);
hdlc_StartTimer(&p->hdlc);
- throughput_start(&p->link.throughput, "physical throughput",
- Enabled(dl->bundle, OPT_THROUGHPUT));
+ throughput_restart(&p->link.throughput, "physical throughput",
+ Enabled(dl->bundle, OPT_THROUGHPUT));
return p;
}
@@ -638,8 +641,9 @@ physical2iov(struct physical *p, struct iovec *iov, int *niov, int maxiov,
physical_ChangedPid(p, newpid);
}
- if (*niov + 1 >= maxiov) {
- log_Printf(LogERROR, "physical2iov: No room for physical + device !\n");
+ if (*niov + 2 >= maxiov) {
+ log_Printf(LogERROR, "physical2iov: No room for physical + throughput"
+ " + device !\n");
if (p)
free(p);
return -1;
@@ -649,6 +653,11 @@ physical2iov(struct physical *p, struct iovec *iov, int *niov, int maxiov,
iov[*niov].iov_len = sizeof *p;
(*niov)++;
+ iov[*niov].iov_base = p ? (void *)p->link.throughput.SampleOctets :
+ malloc(SAMPLE_PERIOD * sizeof(long long));
+ iov[*niov].iov_len = SAMPLE_PERIOD * sizeof(long long);
+ (*niov)++;
+
sz = physical_MaxDeviceSize();
if (p) {
if (h)
OpenPOWER on IntegriCloud