diff options
author | brian <brian@FreeBSD.org> | 1998-08-26 17:39:37 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-08-26 17:39:37 +0000 |
commit | f0dee2c38ca3e4eeca64ea4679b582c4373dbbf4 (patch) | |
tree | 82b255b761af56aea6d84d320188e4c0db94aae0 | |
parent | 307727cd4cb34041ce7fbca4c3323678d1dd9f0c (diff) | |
download | FreeBSD-src-f0dee2c38ca3e4eeca64ea4679b582c4373dbbf4.zip FreeBSD-src-f0dee2c38ca3e4eeca64ea4679b582c4373dbbf4.tar.gz |
Put the IP buffer queues into struct ipcp.
Forgotten by: me
-rw-r--r-- | usr.sbin/ppp/alias_cmd.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/arp.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/auth.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/bundle.c | 12 | ||||
-rw-r--r-- | usr.sbin/ppp/ccp.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.c | 31 | ||||
-rw-r--r-- | usr.sbin/ppp/ip.h | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.c | 7 | ||||
-rw-r--r-- | usr.sbin/ppp/ipcp.h | 3 | ||||
-rw-r--r-- | usr.sbin/ppp/mp.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/nat_cmd.c | 6 | ||||
-rw-r--r-- | usr.sbin/ppp/prompt.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/slcompress.c | 6 |
14 files changed, 62 insertions, 57 deletions
diff --git a/usr.sbin/ppp/alias_cmd.c b/usr.sbin/ppp/alias_cmd.c index 8ebd5ec..1ca4ab4 100644 --- a/usr.sbin/ppp/alias_cmd.c +++ b/usr.sbin/ppp/alias_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.c,v 1.15 1998/06/27 14:17:23 brian Exp $ + * $Id: alias_cmd.c,v 1.16 1998/06/27 14:17:59 brian Exp $ */ #include <sys/types.h> @@ -31,10 +31,10 @@ #include "slcompress.h" #include "throughput.h" #include "iplist.h" -#include "ipcp.h" +#include "mbuf.h" #include "lqr.h" #include "hdlc.h" -#include "mbuf.h" +#include "ipcp.h" #include "lcp.h" #include "ccp.h" #include "link.h" diff --git a/usr.sbin/ppp/arp.c b/usr.sbin/ppp/arp.c index 79a5cfa..b819c9a 100644 --- a/usr.sbin/ppp/arp.c +++ b/usr.sbin/ppp/arp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: arp.c,v 1.28 1998/05/21 21:43:51 brian Exp $ + * $Id: arp.c,v 1.29 1998/06/16 19:40:34 brian Exp $ * */ @@ -53,11 +53,11 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "filter.h" #include "descriptor.h" -#include "lqr.h" -#include "hdlc.h" #include "lcp.h" #include "ccp.h" #include "link.h" diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 811709e..be406d0 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.31 1998/07/19 21:07:24 brian Exp $ + * $Id: auth.c,v 1.32 1998/08/07 18:42:47 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -40,12 +40,12 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "auth.h" #include "systems.h" #include "lcp.h" -#include "lqr.h" -#include "hdlc.h" #include "ccp.h" #include "link.h" #include "descriptor.h" diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index 9e7cd40..2949386 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: bundle.c,v 1.32 1998/08/09 15:34:11 brian Exp $ + * $Id: bundle.c,v 1.33 1998/08/25 17:48:42 brian Exp $ */ #include <sys/param.h> @@ -231,7 +231,7 @@ bundle_ClearQueues(void *v) * dictionaries in use (causing the relevant RESET_REQ/RESET_ACK). */ - ip_DeleteQueue(); + ip_DeleteQueue(&bundle->ncp.ipcp); mp_DeleteQueue(&bundle->ncp.mp); for (dl = bundle->links; dl; dl = dl->next) physical_DeleteQueue(dl->physical); @@ -555,7 +555,7 @@ bundle_UpdateSet(struct descriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n) nlinks++; if (nlinks) { - queued = r ? bundle_FillQueues(bundle) : ip_QueueLen(); + queued = r ? bundle_FillQueues(bundle) : ip_QueueLen(&bundle->ncp.ipcp); if (bundle->autoload.running) { if (queued < bundle->cfg.autoload.max.packets) { if (queued > bundle->cfg.autoload.min.packets) @@ -710,7 +710,7 @@ bundle_DescriptorRead(struct descriptor *d, struct bundle *bundle, n = ntohs(((struct ip *)tun.data)->ip_len); } #endif - ip_Enqueue(pri, tun.data, n); + ip_Enqueue(&bundle->ncp.ipcp, pri, tun.data, n); } } } @@ -1202,7 +1202,7 @@ bundle_FillQueues(struct bundle *bundle) } } - return total + ip_QueueLen(); + return total + ip_QueueLen(&bundle->ncp.ipcp); } int @@ -1257,7 +1257,7 @@ bundle_ShowStatus(struct cmdargs const *arg) else prompt_Printf(arg->prompt, " %srunning with %d" " packets queued\n", arg->bundle->autoload.running ? - "" : "not ", ip_QueueLen()); + "" : "not ", ip_QueueLen(&arg->bundle->ncp.ipcp)); prompt_Printf(arg->prompt, " Choked Timer: %ds\n", arg->bundle->cfg.choked.timeout); diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c index dc33e77..d28c12c 100644 --- a/usr.sbin/ppp/ccp.c +++ b/usr.sbin/ppp/ccp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ccp.c,v 1.37 1998/06/30 23:04:10 brian Exp $ + * $Id: ccp.c,v 1.38 1998/08/07 18:42:47 brian Exp $ * * TODO: * o Support other compression protocols @@ -46,12 +46,12 @@ #include "throughput.h" #include "iplist.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "filter.h" #include "descriptor.h" #include "prompt.h" -#include "lqr.h" -#include "hdlc.h" #include "link.h" #include "mp.h" #include "async.h" diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index d239967..d4f98c1 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: command.c,v 1.159 1998/08/07 18:42:48 brian Exp $ + * $Id: command.c,v 1.160 1998/08/25 17:48:42 brian Exp $ * */ #include <sys/types.h> @@ -53,13 +53,13 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "modem.h" #ifndef NOALIAS #include "alias_cmd.h" #endif -#include "lqr.h" -#include "hdlc.h" #include "systems.h" #include "filter.h" #include "descriptor.h" @@ -126,7 +126,7 @@ #define NEG_DNS 50 const char Version[] = "2.0"; -const char VersionDate[] = "$Date: 1998/08/07 18:42:48 $"; +const char VersionDate[] = "$Date: 1998/08/25 17:48:42 $"; static int ShowCommand(struct cmdargs const *); static int TerminalCommand(struct cmdargs const *); diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index e5f1d53..f837c9b 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.50 1998/08/07 18:42:48 brian Exp $ + * $Id: ip.c,v 1.51 1998/08/25 17:48:42 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -493,35 +493,37 @@ ip_Input(struct bundle *bundle, struct mbuf * bp) mbuf_Free(bp); } -static struct mqueue IpOutputQueues[PRI_FAST + 1]; - void -ip_Enqueue(int pri, char *ptr, int count) +ip_Enqueue(struct ipcp *ipcp, int pri, char *ptr, int count) { struct mbuf *bp; - bp = mbuf_Alloc(count, MB_IPQ); - memcpy(MBUF_CTOP(bp), ptr, count); - mbuf_Enqueue(&IpOutputQueues[pri], bp); + if (pri < 0 || pri > sizeof ipcp->Queue / sizeof ipcp->Queue[0]) + log_Printf(LogERROR, "Can't store in ip queue %d\n", pri); + else { + bp = mbuf_Alloc(count, MB_IPQ); + memcpy(MBUF_CTOP(bp), ptr, count); + mbuf_Enqueue(&ipcp->Queue[pri], bp); + } } void -ip_DeleteQueue() +ip_DeleteQueue(struct ipcp *ipcp) { struct mqueue *queue; - for (queue = IpOutputQueues; queue < IpOutputQueues + PRI_MAX; queue++) + for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++) while (queue->top) mbuf_Free(mbuf_Dequeue(queue)); } int -ip_QueueLen() +ip_QueueLen(struct ipcp *ipcp) { struct mqueue *queue; int result = 0; - for (queue = &IpOutputQueues[PRI_MAX]; queue >= IpOutputQueues; queue--) + for (queue = ipcp->Queue; queue < ipcp->Queue + PRI_MAX; queue++) result += queue->qlen; return result; @@ -530,14 +532,15 @@ ip_QueueLen() int ip_FlushPacket(struct link *l, struct bundle *bundle) { + struct ipcp *ipcp = &bundle->ncp.ipcp; struct mqueue *queue; struct mbuf *bp; int cnt; - if (bundle->ncp.ipcp.fsm.state != ST_OPENED) + if (ipcp->fsm.state != ST_OPENED) return 0; - for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--) + for (queue = &ipcp->Queue[PRI_FAST]; queue >= ipcp->Queue; queue--) if (queue->top) { bp = mbuf_Dequeue(queue); if (bp) { @@ -547,7 +550,7 @@ ip_FlushPacket(struct link *l, struct bundle *bundle) if (!(FilterCheck(pip, &bundle->filter.alive) & A_DENY)) bundle_StartIdleTimer(bundle); vj_SendFrame(l, bp, bundle); - ipcp_AddOutOctets(&bundle->ncp.ipcp, cnt); + ipcp_AddOutOctets(ipcp, cnt); return 1; } } diff --git a/usr.sbin/ppp/ip.h b/usr.sbin/ppp/ip.h index faa93f9..20ce67d 100644 --- a/usr.sbin/ppp/ip.h +++ b/usr.sbin/ppp/ip.h @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.h,v 1.9 1998/05/21 21:45:40 brian Exp $ + * $Id: ip.h,v 1.10 1998/08/25 17:48:42 brian Exp $ * */ @@ -28,7 +28,7 @@ struct bundle; extern int ip_FlushPacket(struct link *, struct bundle *); extern int PacketCheck(struct bundle *, char *, int, struct filter *); -extern void ip_Enqueue(int, char *, int); +extern void ip_Enqueue(struct ipcp *, int, char *, int); extern void ip_Input(struct bundle *, struct mbuf *); -extern void ip_DeleteQueue(void); -extern int ip_QueueLen(void); +extern void ip_DeleteQueue(struct ipcp *); +extern int ip_QueueLen(struct ipcp *); diff --git a/usr.sbin/ppp/ipcp.c b/usr.sbin/ppp/ipcp.c index d61016f..dfd8ce9 100644 --- a/usr.sbin/ppp/ipcp.c +++ b/usr.sbin/ppp/ipcp.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.c,v 1.62 1998/06/27 23:48:45 brian Exp $ + * $Id: ipcp.c,v 1.63 1998/08/07 18:42:49 brian Exp $ * * TODO: * o More RFC1772 backward compatibility @@ -55,12 +55,12 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "filter.h" #include "descriptor.h" #include "vjcomp.h" -#include "lqr.h" -#include "hdlc.h" #include "async.h" #include "ccp.h" #include "link.h" @@ -375,6 +375,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l, ipcp->peer_ifip.s_addr = INADDR_ANY; throughput_init(&ipcp->throughput); + memset(ipcp->Queue, '\0', sizeof ipcp->Queue); ipcp_Setup(ipcp); } diff --git a/usr.sbin/ppp/ipcp.h b/usr.sbin/ppp/ipcp.h index 410dda5..c0a025e 100644 --- a/usr.sbin/ppp/ipcp.h +++ b/usr.sbin/ppp/ipcp.h @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ipcp.h,v 1.18.2.28 1998/05/21 01:26:10 brian Exp $ + * $Id: ipcp.h,v 1.19 1998/05/21 21:45:49 brian Exp $ * * TODO: */ @@ -91,6 +91,7 @@ struct ipcp { struct in_addr peer_ifip; /* My congigured destination address */ struct pppThroughput throughput; /* throughput statistics */ + struct mqueue Queue[PRI_FAST + 1]; /* Output packet queues */ }; #define fsm2ipcp(fp) (fp->proto == PROTO_IPCP ? (struct ipcp *)fp : NULL) diff --git a/usr.sbin/ppp/mp.c b/usr.sbin/ppp/mp.c index 14de66a..810447e 100644 --- a/usr.sbin/ppp/mp.c +++ b/usr.sbin/ppp/mp.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp.c,v 1.13 1998/08/07 18:42:50 brian Exp $ + * $Id: mp.c,v 1.14 1998/08/25 17:48:42 brian Exp $ */ #include <sys/types.h> @@ -53,11 +53,11 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" +#include "lqr.h" +#include "hdlc.h" #include "ipcp.h" #include "auth.h" #include "lcp.h" -#include "lqr.h" -#include "hdlc.h" #include "async.h" #include "ccp.h" #include "link.h" diff --git a/usr.sbin/ppp/nat_cmd.c b/usr.sbin/ppp/nat_cmd.c index 8ebd5ec..1ca4ab4 100644 --- a/usr.sbin/ppp/nat_cmd.c +++ b/usr.sbin/ppp/nat_cmd.c @@ -2,7 +2,7 @@ * The code in this file was written by Eivind Eklund <perhaps@yes.no>, * who places it in the public domain without restriction. * - * $Id: alias_cmd.c,v 1.15 1998/06/27 14:17:23 brian Exp $ + * $Id: alias_cmd.c,v 1.16 1998/06/27 14:17:59 brian Exp $ */ #include <sys/types.h> @@ -31,10 +31,10 @@ #include "slcompress.h" #include "throughput.h" #include "iplist.h" -#include "ipcp.h" +#include "mbuf.h" #include "lqr.h" #include "hdlc.h" -#include "mbuf.h" +#include "ipcp.h" #include "lcp.h" #include "ccp.h" #include "link.h" diff --git a/usr.sbin/ppp/prompt.c b/usr.sbin/ppp/prompt.c index 14daa0c..cdd2304 100644 --- a/usr.sbin/ppp/prompt.c +++ b/usr.sbin/ppp/prompt.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: prompt.c,v 1.10 1998/08/07 18:42:50 brian Exp $ + * $Id: prompt.c,v 1.11 1998/08/09 15:34:11 brian Exp $ */ #include <sys/param.h> @@ -53,12 +53,12 @@ #include "iplist.h" #include "throughput.h" #include "slcompress.h" -#include "ipcp.h" -#include "filter.h" +#include "mbuf.h" #include "lqr.h" #include "hdlc.h" +#include "ipcp.h" +#include "filter.h" #include "async.h" -#include "mbuf.h" #include "ccp.h" #include "link.h" #include "physical.h" diff --git a/usr.sbin/ppp/slcompress.c b/usr.sbin/ppp/slcompress.c index c6dfe62..0a1b9c1 100644 --- a/usr.sbin/ppp/slcompress.c +++ b/usr.sbin/ppp/slcompress.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: slcompress.c,v 1.18 1998/06/15 19:06:24 brian Exp $ + * $Id: slcompress.c,v 1.19 1998/06/27 12:03:50 brian Exp $ * * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: * - Initial distribution. @@ -45,10 +45,10 @@ #include "fsm.h" #include "throughput.h" #include "iplist.h" -#include "ipcp.h" -#include "filter.h" #include "lqr.h" #include "hdlc.h" +#include "ipcp.h" +#include "filter.h" #include "lcp.h" #include "ccp.h" #include "link.h" |