sync with latest kame tree. snprintf() return value audit, log() cleanup,
and such.
This commit is contained in:
parent
9fac675c1e
commit
d5e1f166e0
@ -1,5 +1,5 @@
|
||||
.\" $NetBSD: altqd.8,v 1.4 2001/08/16 07:45:35 itojun Exp $
|
||||
.\" $KAME: altqd.8,v 1.5 2001/07/19 11:07:33 kjc Exp $
|
||||
.\" $NetBSD: altqd.8,v 1.5 2001/08/22 08:52:35 itojun Exp $
|
||||
.\" $KAME: altqd.8,v 1.8 2001/08/22 08:49:35 itojun Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 2000
|
||||
.\" Sony Computer Science Laboratories Inc. All rights reserved.
|
||||
@ -32,8 +32,8 @@
|
||||
.Nd ALTQ daemon
|
||||
.Sh SYNOPSIS
|
||||
.Nm altqd
|
||||
.Op Fl f Ar conf_file
|
||||
.Op Fl dvD
|
||||
.Op Fl f Ar conf_file
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a daemon program that reads a configuration file and then sets up
|
||||
@ -43,12 +43,12 @@ After configuring the ALTQ state,
|
||||
will detach and become a daemon.
|
||||
.Pp
|
||||
The signal SIGINT or SIGTERM will shutdown
|
||||
.Nm
|
||||
, and the signal SIGHUP will restart
|
||||
.Nm .
|
||||
.Nm Ns ,
|
||||
and the signal SIGHUP will restart
|
||||
.Nm Ns .
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width Fl -offset indent
|
||||
.Bl -tag -width Fl
|
||||
.It Fl f
|
||||
Specify a configuration file to read instead of the default.
|
||||
The default file is
|
||||
@ -76,24 +76,33 @@ setting up the ALTQ state.
|
||||
Each command is a single line, starting with the command verb.
|
||||
.Pp
|
||||
The basic commands are as follows:
|
||||
.Bl -tag -width help -offset indent
|
||||
.It Cm help|?
|
||||
.Bl -tag -width help
|
||||
.It Cm help | ?
|
||||
Display a complete list of commands and their syntax.
|
||||
.It Cm quit
|
||||
Exit.
|
||||
.It Cm altq Ar reload
|
||||
reload the configuration file and reinitialize ALTQ.
|
||||
.It Cm altq Ar iface_name Op enable|disable
|
||||
Reload the configuration file and reinitialize ALTQ.
|
||||
.It Cm altq Ar interface Op enable|disable
|
||||
Enables or disables ALTQ on the interface named
|
||||
.Em iface_name .
|
||||
.Em interface .
|
||||
When
|
||||
.Nm
|
||||
enters the command mode, ALTQ is enabled on all the
|
||||
interfaces listed in the configuration file.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Pa /etc/altq.conf ,
|
||||
.Pa /var/run/altqd.pid
|
||||
.Pa /var/run/altq_quip
|
||||
.Bl -tag -width /var/run/altqd.pid -compact
|
||||
.It Pa /etc/altq.conf
|
||||
configuration file
|
||||
.It Pa /var/run/altqd.pid
|
||||
pid of the running
|
||||
.Nm
|
||||
.It Pa /var/run/altq_quip
|
||||
Unix domain socket for communicating with
|
||||
.Xr altqstat 1
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr altq.conf 5
|
||||
.Xr altq.conf 5 ,
|
||||
.Xr altqstat 1 ,
|
||||
.Xr altq 9
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: altqd.c,v 1.5 2001/08/16 07:48:08 itojun Exp $ */
|
||||
/* $KAME: altqd.c,v 1.3 2001/08/15 03:36:07 kjc Exp $ */
|
||||
/* $NetBSD: altqd.c,v 1.6 2001/08/22 08:52:35 itojun Exp $ */
|
||||
/* $KAME: altqd.c,v 1.6 2001/08/20 08:25:23 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Theo de Raadt
|
||||
* All rights reserved.
|
||||
@ -181,7 +181,7 @@ main(int argc, char **argv)
|
||||
* open a unix domain socket for altqd clients
|
||||
*/
|
||||
if ((altqd_socket = socket(AF_LOCAL, SOCK_STREAM, 0)) < 0)
|
||||
LOG(LOG_ERR, errno, "can't open unix domain socket\n");
|
||||
LOG(LOG_ERR, errno, "can't open unix domain socket");
|
||||
else {
|
||||
struct sockaddr_un addr;
|
||||
|
||||
@ -191,13 +191,13 @@ main(int argc, char **argv)
|
||||
unlink(QUIP_PATH);
|
||||
if (bind(altqd_socket, (struct sockaddr *)&addr,
|
||||
sizeof(addr)) < 0) {
|
||||
LOG(LOG_ERR, errno, "can't bind to %s\n", QUIP_PATH);
|
||||
LOG(LOG_ERR, errno, "can't bind to %s", QUIP_PATH);
|
||||
close(altqd_socket);
|
||||
altqd_socket = -1;
|
||||
}
|
||||
chmod(QUIP_PATH, 0666);
|
||||
if (listen(altqd_socket, SOMAXCONN) < 0) {
|
||||
LOG(LOG_ERR, errno, "can't listen to %s\n", QUIP_PATH);
|
||||
LOG(LOG_ERR, errno, "can't listen to %s", QUIP_PATH);
|
||||
close(altqd_socket);
|
||||
altqd_socket = -1;
|
||||
}
|
||||
@ -304,7 +304,7 @@ main(int argc, char **argv)
|
||||
printf("\nEnter ? or command:\n");
|
||||
FD_SET(fileno(infp), &fds);
|
||||
} else {
|
||||
LOG(LOG_INFO, 0, "Exiting.\n");
|
||||
LOG(LOG_INFO, 0, "Exiting.");
|
||||
(void) qcmd_destroyall();
|
||||
exit(0);
|
||||
}
|
||||
@ -320,7 +320,7 @@ main(int argc, char **argv)
|
||||
int newsock = accept(altqd_socket, NULL, NULL);
|
||||
|
||||
if (newsock == -1) {
|
||||
LOG(LOG_ERR, errno, "accept error\n");
|
||||
LOG(LOG_ERR, errno, "accept");
|
||||
continue;
|
||||
}
|
||||
FD_SET(newsock, &fds);
|
||||
@ -334,7 +334,7 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* check input from a client via unix domain socket
|
||||
*/
|
||||
for (i = 0; i <= MAX_CLIENT; i++) {
|
||||
for (i = 0; i < MAX_CLIENT; i++) {
|
||||
int fd;
|
||||
|
||||
if (client[i] == NULL)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: libaltq2.c,v 1.3 2001/08/16 07:48:09 itojun Exp $ */
|
||||
/* $KAME: libaltq2.c,v 1.2 2001/08/15 03:38:04 kjc Exp $ */
|
||||
/* $NetBSD: libaltq2.c,v 1.4 2001/08/22 08:52:35 itojun Exp $ */
|
||||
/* $KAME: libaltq2.c,v 1.4 2001/08/22 08:47:54 itojun Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1997-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -43,6 +43,7 @@
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
|
||||
#include "altq_qop.h"
|
||||
|
||||
@ -69,29 +70,27 @@ log_write(int severity, int syserr, const char *format, ...)
|
||||
#endif
|
||||
|
||||
if (severity <= l_debug) {
|
||||
if (!daemonize)
|
||||
if (!daemonize) {
|
||||
vfprintf(stderr, format, ap);
|
||||
else
|
||||
vsyslog(severity, format, ap);
|
||||
if (syserr != 0) {
|
||||
if (syserr < sys_nerr)
|
||||
fprintf(stderr, ": %s", sys_errlist[syserr]);
|
||||
else
|
||||
fprintf(stderr, ": errno %d", syserr);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
} else {
|
||||
if (syserr == 0)
|
||||
vsyslog(severity, format, ap);
|
||||
else {
|
||||
char buf[512];
|
||||
|
||||
strlcpy(buf, format, sizeof(buf));
|
||||
strlcat(buf, ": %m", sizeof(buf));
|
||||
vsyslog(severity, buf, ap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
if (syserr == 0) {
|
||||
/* Do nothing for now */
|
||||
} else if (syserr < sys_nerr) {
|
||||
if (severity <= l_debug) {
|
||||
if (!daemonize)
|
||||
fprintf(stderr, ": %s\n", sys_errlist[syserr]);
|
||||
else
|
||||
syslog(severity, ": %s", sys_errlist[syserr]);
|
||||
}
|
||||
} else {
|
||||
if (severity <= l_debug) {
|
||||
if (!daemonize)
|
||||
fprintf(stderr, ": errno %d\n", syserr);
|
||||
else
|
||||
syslog(severity, ": errno %d", syserr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\" $NetBSD: altqstat.1,v 1.4 2001/08/16 07:45:36 itojun Exp $
|
||||
.\" $KAME: altqstat.1,v 1.3 2001/04/09 16:26:29 thorpej Exp $
|
||||
.\" $NetBSD: altqstat.1,v 1.5 2001/08/22 08:52:36 itojun Exp $
|
||||
.\" $KAME: altqstat.1,v 1.6 2001/08/22 08:50:49 itojun Exp $
|
||||
.\"
|
||||
.\" Copyright (C) 2000
|
||||
.\" Sony Computer Science Laboratories Inc. All rights reserved.
|
||||
@ -90,9 +90,13 @@ used to specify
|
||||
.Em traffic conditioner
|
||||
at an input interface.
|
||||
.El
|
||||
|
||||
.Sh FILES
|
||||
.Pa /var/run/altq_quip
|
||||
.Bl -tag -width /var/run/altqd.pid -compact
|
||||
.It Pa /var/run/altq_quip
|
||||
Unix domain socket for communicating with
|
||||
.Xr altqd 1
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr altqd 8 ,
|
||||
.Xr altq.conf 5
|
||||
.Xr altq.conf 5 ,
|
||||
.Xr altq 9
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: altqstat.c,v 1.3 2001/08/16 07:48:09 itojun Exp $ */
|
||||
/* $KAME: altqstat.c,v 1.5 2001/08/15 12:51:58 kjc Exp $ */
|
||||
/* $NetBSD: altqstat.c,v 1.4 2001/08/22 08:52:36 itojun Exp $ */
|
||||
/* $KAME: altqstat.c,v 1.6 2001/08/16 07:43:14 itojun Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: altqstat.h,v 1.3 2001/08/16 07:48:10 itojun Exp $ */
|
||||
/* $KAME: altqstat.h,v 1.3 2001/08/15 12:51:58 kjc Exp $ */
|
||||
/* $NetBSD: altqstat.h,v 1.4 2001/08/22 08:52:36 itojun Exp $ */
|
||||
/* $KAME: altqstat.h,v 1.4 2001/08/16 07:43:14 itojun Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: quip_client.c,v 1.3 2001/08/16 07:48:12 itojun Exp $ */
|
||||
/* $KAME: quip_client.c,v 1.3 2001/08/15 12:51:59 kjc Exp $ */
|
||||
/* $NetBSD: quip_client.c,v 1.4 2001/08/22 08:52:36 itojun Exp $ */
|
||||
/* $KAME: quip_client.c,v 1.5 2001/08/20 06:41:33 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -99,6 +99,8 @@
|
||||
* GET handle-to-name?fxp0::0x1000000a QUIP/1.0<cr>
|
||||
*/
|
||||
|
||||
#define MAXLINESIZE 1024
|
||||
|
||||
enum nametype { INTERFACE, CLASS, FILTER, CONDITIONER };
|
||||
|
||||
static FILE *server = NULL;
|
||||
@ -152,8 +154,8 @@ quip_sendrequest(FILE *fp, const char *request)
|
||||
if (cp == NULL || n > REQ_MAXSIZE - 10)
|
||||
return;
|
||||
strncpy(buf, request, n);
|
||||
n += snprintf(buf + n, REQ_MAXSIZE - n, " QUIP/1.0");
|
||||
strlcpy(buf + n, cp, REQ_MAXSIZE - n);
|
||||
snprintf(buf + n, REQ_MAXSIZE - n, " QUIP/1.0");
|
||||
strlcat(buf, cp, REQ_MAXSIZE);
|
||||
}
|
||||
else
|
||||
strlcpy(buf, request, REQ_MAXSIZE);
|
||||
@ -175,14 +177,15 @@ quip_sendrequest(FILE *fp, const char *request)
|
||||
int
|
||||
quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
|
||||
{
|
||||
char buf[QUIPMSG_MAXSIZE], version[64];
|
||||
int code, resid;
|
||||
char buf[MAXLINESIZE], version[MAXLINESIZE];
|
||||
int code, resid, len, buflen;
|
||||
int end_of_header = 0;
|
||||
|
||||
if (blen != NULL)
|
||||
*blen = 0;
|
||||
code = 0;
|
||||
resid = 0;
|
||||
buflen = RES_MAXSIZE;
|
||||
while (fgets(buf, sizeof(buf), fp) != 0) {
|
||||
if (quip_echo) {
|
||||
fputs("> ", stdout);
|
||||
@ -191,8 +194,16 @@ quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
|
||||
|
||||
if (!end_of_header) {
|
||||
/* process message header */
|
||||
if (header != NULL)
|
||||
header += snprintf(header, RES_MAXSIZE, "%s", buf);
|
||||
if (header != NULL) {
|
||||
len = strlcpy(header, buf, buflen);
|
||||
if (len >= buflen) {
|
||||
/* header too long */
|
||||
fpurge(fp);
|
||||
return (-1);
|
||||
}
|
||||
header += len;
|
||||
buflen -= len;
|
||||
}
|
||||
|
||||
if (code == 0) {
|
||||
/* status line expected */
|
||||
@ -213,6 +224,7 @@ quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
|
||||
if (buf[0] == '\n') {
|
||||
/* end of header */
|
||||
end_of_header = 1;
|
||||
buflen = BODY_MAXSIZE;
|
||||
if (resid == 0)
|
||||
/* no message body */
|
||||
return (code);
|
||||
@ -232,11 +244,15 @@ quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
|
||||
}
|
||||
else {
|
||||
/* process message body */
|
||||
int len;
|
||||
|
||||
if (body != NULL) {
|
||||
len = snprintf(body, BODY_MAXSIZE, "%s", buf);
|
||||
len = strlcpy(body, buf, buflen);
|
||||
if (len >= buflen) {
|
||||
/* body too long */
|
||||
fpurge(fp);
|
||||
return (-1);
|
||||
}
|
||||
body += len;
|
||||
buflen -= len;
|
||||
}
|
||||
else
|
||||
len = strlen(buf);
|
||||
@ -251,7 +267,7 @@ quip_recvresponse(FILE *fp, char *header, char *body, int *blen)
|
||||
void
|
||||
quip_rawmode(void)
|
||||
{
|
||||
char line[1024];
|
||||
char line[MAXLINESIZE];
|
||||
int result_code;
|
||||
|
||||
printf(">>>Entering the raw interactive mode to the server:\n\n");
|
||||
@ -263,7 +279,7 @@ quip_rawmode(void)
|
||||
while (1) {
|
||||
printf("%% "); fflush(stdout);
|
||||
/* read a line from stdin */
|
||||
if (fgets(line, 1024, stdin) == NULL)
|
||||
if (fgets(line, sizeof(line), stdin) == NULL)
|
||||
break;
|
||||
|
||||
if (line[0] == '\n') {
|
||||
@ -287,7 +303,7 @@ quip_rawmode(void)
|
||||
char *
|
||||
quip_selectinterface(char *ifname)
|
||||
{
|
||||
char buf[8192], *cp;
|
||||
char buf[BODY_MAXSIZE], *cp;
|
||||
int result_code, len;
|
||||
u_int if_index;
|
||||
static char interface[64];
|
||||
@ -311,9 +327,8 @@ quip_selectinterface(char *ifname)
|
||||
return (interface);
|
||||
}
|
||||
if (strcmp(ifname, interface) == 0)
|
||||
/* found the matching entry */
|
||||
|
||||
return (interface);
|
||||
/* found the matching entry */
|
||||
return (interface);
|
||||
if ((cp = strchr(cp+1, '\n')) == NULL)
|
||||
break;
|
||||
}
|
||||
@ -443,7 +458,7 @@ extract_ifname(const char *name)
|
||||
void
|
||||
quip_printconfig(void)
|
||||
{
|
||||
char buf[8192], name[256], *cp, *p, *flname;
|
||||
char buf[BODY_MAXSIZE], name[256], *cp, *p, *flname;
|
||||
int result_code, len;
|
||||
enum nametype type;
|
||||
u_long handle;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: quip_client.h,v 1.3 2001/08/16 07:48:12 itojun Exp $ */
|
||||
/* $KAME: quip_client.h,v 1.3 2001/08/15 12:51:59 kjc Exp $ */
|
||||
/* $NetBSD: quip_client.h,v 1.4 2001/08/22 08:52:36 itojun Exp $ */
|
||||
/* $KAME: quip_client.h,v 1.4 2001/08/16 07:43:15 itojun Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: parser.c,v 1.5 2001/08/16 07:48:12 itojun Exp $ */
|
||||
/* $KAME: parser.c,v 1.10 2001/08/15 12:51:57 kjc Exp $ */
|
||||
/* $NetBSD: parser.c,v 1.6 2001/08/22 08:52:36 itojun Exp $ */
|
||||
/* $KAME: parser.c,v 1.12 2001/08/16 10:39:13 kjc Exp $ */
|
||||
/*******************************************************************
|
||||
|
||||
Copyright (c) 1996 by the University of Southern California
|
||||
@ -181,13 +181,13 @@ qdisc_class_parser(const char *qname, const char *ifname,
|
||||
}
|
||||
if ((ifinfo = ifname2ifinfo(ifname)) == NULL) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"no such interface, line %d\n", line_no);
|
||||
"no such interface, line %d", line_no);
|
||||
return (0);
|
||||
}
|
||||
if (strncmp(ifinfo->qdisc->qname, qname,
|
||||
strlen(ifinfo->qdisc->qname)) != 0) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"qname doesn't match the interface, line %d\n",
|
||||
"qname doesn't match the interface, line %d",
|
||||
line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -215,11 +215,11 @@ qcmd_config(void)
|
||||
for (i = 0; i < MAX_T; i++)
|
||||
if_names[i][0] = '\0';
|
||||
|
||||
LOG(LOG_INFO, 0, "ALTQ config file is %s\n", altqconfigfile);
|
||||
LOG(LOG_INFO, 0, "ALTQ config file is %s", altqconfigfile);
|
||||
|
||||
f = fopen(altqconfigfile, "r");
|
||||
if (f == NULL) {
|
||||
LOG(LOG_ERR, errno, "Can't open %s", altqconfigfile, 0);
|
||||
LOG(LOG_ERR, errno, "can't open %s", altqconfigfile, 0);
|
||||
return (QOPERR_INVAL);
|
||||
}
|
||||
line_no = 0;
|
||||
@ -289,7 +289,7 @@ DoCommand(char *infile, FILE *infp)
|
||||
if (rc == 0) {
|
||||
if (infile) {
|
||||
/* error in the config file. cleanup and exit. */
|
||||
LOG(LOG_ERR, 0, "Config failed. Exiting.\n");
|
||||
LOG(LOG_ERR, 0, "config failed. exiting...");
|
||||
(void) qcmd_destroyall();
|
||||
(void) fclose(infp);
|
||||
exit(1);
|
||||
@ -564,7 +564,7 @@ interface_parser(char *cmdbuf)
|
||||
int argc, rval;
|
||||
|
||||
if (!get_ifname(&cp, &ifname)) {
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -586,7 +586,7 @@ interface_parser(char *cmdbuf)
|
||||
|
||||
rval = qdisc_interface_parser(qdisc_name, ifname, argc, argv);
|
||||
if (rval == 0) {
|
||||
LOG(LOG_ERR, 0, "Error in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "Error in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -605,34 +605,34 @@ class_parser(char *cmdbuf)
|
||||
|
||||
/* get scheduling class */
|
||||
if (!next_word(&cp, qdisc_name)) {
|
||||
LOG(LOG_ERR, 0, "missing scheduling discipline in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing scheduling discipline in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!is_qdisc_name(qdisc_name)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"unknown scheduling discipline '%s' in %s, line %d\n",
|
||||
"unknown scheduling discipline '%s' in %s, line %d",
|
||||
qdisc_name, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get interface name */
|
||||
if (!get_ifname(&cp, &ifname)) {
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get class name */
|
||||
if (!next_word(&cp, class_name)) {
|
||||
LOG(LOG_ERR, 0, "missing class name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing class name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get parent name */
|
||||
if (!next_word(&cp, parent_name)) {
|
||||
LOG(LOG_ERR, 0, "missing parent class in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing parent class in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -653,7 +653,7 @@ class_parser(char *cmdbuf)
|
||||
rval = qdisc_class_parser(qdisc_name, ifname, clname, parent,
|
||||
argc, argv);
|
||||
if (rval == 0) {
|
||||
LOG(LOG_ERR, 0, "can't add class '%s' on interface '%s'\n",
|
||||
LOG(LOG_ERR, 0, "can't add class '%s' on interface '%s'",
|
||||
clname, ifname);
|
||||
return (0);
|
||||
}
|
||||
@ -677,14 +677,14 @@ filter_parser(char *cmdbuf)
|
||||
sfilt.ff_flow.fi_family = AF_INET;
|
||||
|
||||
if (!get_ifname(&cp, &ifname)) {
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!next_word(&cp, class_name)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing class name in %s, line %d\n",
|
||||
"missing class name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -693,7 +693,7 @@ filter_parser(char *cmdbuf)
|
||||
ruleno = 0;
|
||||
if (!get_fltr_opts(&cp, &fltr_name[0], sizeof(fltr_name), &ruleno)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"bad filter option in %s, line %d\n",
|
||||
"bad filter option in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -704,7 +704,7 @@ filter_parser(char *cmdbuf)
|
||||
/* get filter destination Address */
|
||||
if (!get_addr(&cp, &sfilt.ff_flow.fi_dst, &sfilt.ff_mask.mask_dst)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"bad filter destination address in %s, line %d\n",
|
||||
"bad filter destination address in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -712,43 +712,43 @@ filter_parser(char *cmdbuf)
|
||||
/* get filter destination port */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing filter destination port in %s, line %d\n",
|
||||
"missing filter destination port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_port(w, &sfilt.ff_flow.fi_dport)) {
|
||||
LOG(LOG_ERR, 0, "bad filter destination port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad filter destination port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get filter source address */
|
||||
if (!get_addr(&cp, &sfilt.ff_flow.fi_src, &sfilt.ff_mask.mask_src)) {
|
||||
LOG(LOG_ERR, 0, "bad filter source address in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad filter source address in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get filter source port */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing filter source port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing filter source port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_port(w, &sfilt.ff_flow.fi_sport)) {
|
||||
LOG(LOG_ERR, 0, "bad filter source port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad filter source port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get filter protocol id */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing filter protocol id in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing filter protocol id in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_proto(w, &protocol)) {
|
||||
LOG(LOG_ERR, 0, "bad protocol in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad protocol in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -789,7 +789,7 @@ filter_parser(char *cmdbuf)
|
||||
filter_dontwarn = 0; /* XXX */
|
||||
if (error) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"can't add filter to class '%s' on interface '%s'\n",
|
||||
"can't add filter to class '%s' on interface '%s'",
|
||||
class_name, ifname);
|
||||
return (0);
|
||||
}
|
||||
@ -814,13 +814,13 @@ filter6_parser(char *cmdbuf)
|
||||
sfilt.ff_flow6.fi6_family = AF_INET6;
|
||||
|
||||
if (!get_ifname(&cp, &ifname)) {
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!next_word(&cp, class_name)) {
|
||||
LOG(LOG_ERR, 0, "missing class name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing class name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -829,7 +829,7 @@ filter6_parser(char *cmdbuf)
|
||||
ruleno = 0;
|
||||
if (!get_fltr_opts(&cp, &fltr_name[0], sizeof(fltr_name), &ruleno)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"bad filter option in %s, line %d\n",
|
||||
"bad filter option in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -840,52 +840,52 @@ filter6_parser(char *cmdbuf)
|
||||
/* get filter destination address */
|
||||
if (!get_ip6addr(&cp, &sfilt.ff_flow6.fi6_dst,
|
||||
&sfilt.ff_mask6.mask6_dst)) {
|
||||
LOG(LOG_ERR, 0, "bad destination address in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad destination address in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* get filter destination port */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing filter destination port in %s, line %d\n",
|
||||
"missing filter destination port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_port(w, &sfilt.ff_flow6.fi6_dport)) {
|
||||
LOG(LOG_ERR, 0, "bad filter destination port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad filter destination port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/* get filter source address */
|
||||
if (!get_ip6addr(&cp, &sfilt.ff_flow6.fi6_src,
|
||||
&sfilt.ff_mask6.mask6_src)) {
|
||||
LOG(LOG_ERR, 0, "bad source address in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad source address in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get filter source port */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing filter source port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing filter source port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_port(w, &sfilt.ff_flow6.fi6_sport)) {
|
||||
LOG(LOG_ERR, 0, "bad filter source port in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad filter source port in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get filter protocol id */
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing filter protocol id in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing filter protocol id in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
if (!get_proto(w, &protocol)) {
|
||||
LOG(LOG_ERR, 0, "bad protocol in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad protocol in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -906,8 +906,8 @@ filter6_parser(char *cmdbuf)
|
||||
}
|
||||
}
|
||||
}
|
||||
sfilt.ff_flow6.fi6_tclass = tclass;
|
||||
sfilt.ff_mask6.mask6_tclass = tclassmask;
|
||||
sfilt.ff_flow6.fi6_tclass = tclass;
|
||||
sfilt.ff_mask6.mask6_tclass = tclassmask;
|
||||
} else if (EQUAL(w, "gpi")) {
|
||||
if (next_word(&cp, w)) {
|
||||
sfilt.ff_flow6.fi6_gpi =
|
||||
@ -935,7 +935,7 @@ filter6_parser(char *cmdbuf)
|
||||
filter_dontwarn = 0; /* XXX */
|
||||
if (ret) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"can't add filter to class '%s' on interface '%s'\n",
|
||||
"can't add filter to class '%s' on interface '%s'",
|
||||
class_name, ifname);
|
||||
return (0);
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ ctl_parser(char *cmdbuf)
|
||||
state ? "enabled" : "disabled", ifname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
if (EQUAL(w, "enable")) {
|
||||
rval = qcmd_enable(ifname);
|
||||
printf("altq %s on %s\n",
|
||||
@ -1049,7 +1049,7 @@ delete_parser(char *cmdbuf)
|
||||
|
||||
if (!next_word(&cp, class_name)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing class name in %s, line %d\n",
|
||||
"missing class name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1057,7 +1057,7 @@ delete_parser(char *cmdbuf)
|
||||
ret = qcmd_delete_class(ifname, class_name);
|
||||
if (ret) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"can't delete class '%s' on interface '%s'\n",
|
||||
"can't delete class '%s' on interface '%s'",
|
||||
class_name, ifname);
|
||||
return (0);
|
||||
}
|
||||
@ -1084,14 +1084,14 @@ red_parser(char *cmdbuf)
|
||||
inv_pmax = (int)strtol(w, NULL, 0);
|
||||
|
||||
if (qop_red_set_defaults(th_min, th_max, inv_pmax) != 0) {
|
||||
LOG(LOG_ERR, 0, "can't set red default parameters\n");
|
||||
LOG(LOG_ERR, 0, "can't set red default parameters");
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
|
||||
bad:
|
||||
LOG(LOG_ERR, 0, "bad red parameter in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad red parameter in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1118,14 +1118,14 @@ rio_parser(char *cmdbuf)
|
||||
}
|
||||
|
||||
if (qop_rio_set_defaults(¶ms[0]) != 0) {
|
||||
LOG(LOG_ERR, 0, "can't set rio default parameters\n");
|
||||
LOG(LOG_ERR, 0, "can't set rio default parameters");
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
|
||||
bad:
|
||||
LOG(LOG_ERR, 0, "bad rio parameter in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "bad rio parameter in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1138,14 +1138,14 @@ conditioner_parser(char *cmdbuf)
|
||||
struct tc_action action[64];
|
||||
|
||||
if (!get_ifname(&cp, &ifname)) {
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing interface name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* get conditioner name */
|
||||
if (!next_word(&cp, cdnr_name)) {
|
||||
LOG(LOG_ERR, 0, "missing cdnr name in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing cdnr name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1169,14 +1169,14 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
char type[128], w[128];
|
||||
int depth, i;
|
||||
struct tb_profile profile[2];
|
||||
|
||||
|
||||
/*
|
||||
* find a possibly nested pair of '<' and '>',
|
||||
* make them pointed by 'start' and 'end'.
|
||||
*/
|
||||
start = strchr(*cpp, '<');
|
||||
if (start == NULL) {
|
||||
LOG(LOG_ERR, 0, "conditioner action missing in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "conditioner action missing in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1186,7 +1186,7 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
end = strpbrk(cp, "<>");
|
||||
if (end == NULL) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"conditioner action delimiter mismatch in %s, line %d\n",
|
||||
"conditioner action delimiter mismatch in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1206,18 +1206,18 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
|
||||
if (!next_word(&cp, type)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing conditioner action type in %s, line %d\n",
|
||||
"missing conditioner action type in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* action type specific process
|
||||
*/
|
||||
if (EQUAL(type, "conditioner")) {
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing conditioner name in %s, line %d\n",
|
||||
"missing conditioner name in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1225,7 +1225,7 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
action->tca_handle = cdnr_name2handle(ifname, w);
|
||||
if (action->tca_handle == CDNR_NULL_HANDLE) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"wrong conditioner name %s in %s, line %d\n",
|
||||
"wrong conditioner name %s in %s, line %d",
|
||||
w, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1235,7 +1235,7 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
action->tca_code = TCACODE_DROP;
|
||||
} else if (EQUAL(type, "mark")) {
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing dscp in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing dscp in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1243,13 +1243,13 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
action->tca_dscp = (u_int8_t)strtol(w, NULL, 0);
|
||||
} else if (EQUAL(type, "tbmeter")) {
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing tb profile in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing tb profile in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
profile[0].rate = atobps(w);
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing tb profile in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing tb profile in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1268,14 +1268,14 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
for (i=0; i<2; i++) {
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing tb profile in %s, line %d\n",
|
||||
"missing tb profile in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
profile[i].rate = atobps(w);
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"missing tb profile in %s, line %d\n",
|
||||
"missing tb profile in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1303,21 +1303,21 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
u_int32_t cmtd_rate, peak_rate, avg_interval;
|
||||
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing cmtd rate in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing cmtd rate in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
cmtd_rate = atobps(w);
|
||||
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing peak rate in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing peak rate in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
peak_rate = atobps(w);
|
||||
|
||||
if (!next_word(&cp, w)) {
|
||||
LOG(LOG_ERR, 0, "missing avg interval in %s, line %d\n",
|
||||
LOG(LOG_ERR, 0, "missing avg interval in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -1337,11 +1337,11 @@ tc_action_parser(char *ifname, char **cpp, struct tc_action *action)
|
||||
return (0);
|
||||
} else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Unkown action type %s in %s, line %d\n",
|
||||
"Unkown action type %s in %s, line %d",
|
||||
type, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
*end = '>'; /* restore the end delimiter */
|
||||
|
||||
return (1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop.c,v 1.3 2001/08/16 07:48:13 itojun Exp $ */
|
||||
/* $KAME: qop.c,v 1.8 2001/08/16 04:31:41 kjc Exp $ */
|
||||
/* $NetBSD: qop.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop.c,v 1.10 2001/08/16 10:39:13 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -108,13 +108,12 @@ qcmd_init(void)
|
||||
|
||||
/* read config file and execute commands */
|
||||
error = qcmd_config();
|
||||
|
||||
if (error == 0)
|
||||
error = qcmd_enableall();
|
||||
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: qcmd_init failed.\n",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
|
||||
error = qcmd_enableall();
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: qcmd_init failed", qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -131,10 +130,10 @@ qcmd_enable(const char *ifname)
|
||||
error = qop_enable(ifinfo);
|
||||
|
||||
if (error == 0) {
|
||||
LOG(LOG_INFO, 0, "%s enabled on interface %s (mtu:%d)\n",
|
||||
LOG(LOG_INFO, 0, "%s enabled on interface %s (mtu:%d)",
|
||||
ifinfo->qdisc->qname, ifname, ifinfo->ifmtu);
|
||||
} else
|
||||
LOG(LOG_ERR, errno, "%s: enable failed!\n", qoperror(error));
|
||||
LOG(LOG_ERR, errno, "%s: enable failed!", qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -151,7 +150,7 @@ qcmd_disable(const char *ifname)
|
||||
error = qop_disable(ifinfo);
|
||||
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: disable failed!\n", qoperror(error));
|
||||
LOG(LOG_ERR, errno, "%s: disable failed!", qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -164,7 +163,7 @@ qcmd_enableall()
|
||||
LIST_FOREACH(ifinfo, &qop_iflist, next) {
|
||||
if ((error = qop_enable(ifinfo)) != 0)
|
||||
return (error);
|
||||
LOG(LOG_INFO, 0, "%s enabled on interface %s (mtu:%d)\n",
|
||||
LOG(LOG_INFO, 0, "%s enabled on interface %s (mtu:%d)",
|
||||
ifinfo->qdisc->qname, ifinfo->ifname, ifinfo->ifmtu);
|
||||
}
|
||||
return (0);
|
||||
@ -195,7 +194,7 @@ qcmd_clear(const char *ifname)
|
||||
if (error == 0)
|
||||
error = qop_clear(ifinfo);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: clear failed!\n", qoperror(error));
|
||||
LOG(LOG_ERR, errno, "%s: clear failed!", qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -231,7 +230,7 @@ qcmd_delete_class(const char *ifname, const char *clname)
|
||||
if (error == 0)
|
||||
error = qop_delete_class(clinfo);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: delete_class failed\n",
|
||||
LOG(LOG_ERR, errno, "%s: delete_class failed",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -262,10 +261,10 @@ qcmd_add_filter(const char *ifname, const char *clname, const char *flname,
|
||||
error = qop_add_filter(NULL, clinfo, flname, fltr, NULL);
|
||||
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: add filter failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: add filter failed!",
|
||||
qoperror(error));
|
||||
else if (IsDebug(DEBUG_ALTQ)) {
|
||||
LOG(LOG_DEBUG, 0, "%s: add a filter %s to class %s\n",
|
||||
LOG(LOG_DEBUG, 0, "%s: add a filter %s to class %s",
|
||||
ifname, flname ? flname : "(null)",
|
||||
clname ? clname : "(null)");
|
||||
print_filter(fltr);
|
||||
@ -302,7 +301,7 @@ qcmd_delete_filter(const char *ifname, const char *clname, const char *flname)
|
||||
if (error == 0)
|
||||
error = qop_delete_filter(fltrinfo);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: delete filter failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: delete filter failed!",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -335,7 +334,7 @@ qop_add_if(struct ifinfo **rp, const char *ifname, u_int bandwidth,
|
||||
int error;
|
||||
|
||||
if (ifname2ifinfo(ifname) != NULL) {
|
||||
LOG(LOG_ERR, 0, "qop_add_if: %s already exists!\n", ifname);
|
||||
LOG(LOG_ERR, 0, "qop_add_if: %s already exists!", ifname);
|
||||
return (QOPERR_BADIF);
|
||||
}
|
||||
|
||||
@ -885,7 +884,7 @@ tbr_install(const char *ifname)
|
||||
if (req.tb_prof.rate != 0) {
|
||||
LOG(LOG_INFO, 0,
|
||||
"tbr is already installed on %s,\n"
|
||||
" using the current setting (rate:%.2fM size:%.2fK).\n",
|
||||
" using the current setting (rate:%.2fM size:%.2fK).",
|
||||
info->ifname,
|
||||
(double)req.tb_prof.rate/1000000.0,
|
||||
(double)req.tb_prof.depth/1024.0);
|
||||
@ -917,7 +916,7 @@ tbr_install(const char *ifname)
|
||||
if (ioctl(fd, ALTQTBRSET, &req) < 0)
|
||||
err(1, "ALTQTBRSET for interface %s", req.ifname);
|
||||
LOG(LOG_INFO, 0,
|
||||
"tbr installed on %s (rate:%.2fM size:%.2fK)\n",
|
||||
"tbr installed on %s (rate:%.2fM size:%.2fK)",
|
||||
info->ifname,
|
||||
(double)info->tb_prof.rate/1000000.0,
|
||||
(double)info->tb_prof.depth/1024.0);
|
||||
@ -961,15 +960,15 @@ print_filter(const struct flow_filter *filt)
|
||||
|
||||
in_addr.s_addr = filt->ff_flow.fi_dst.s_addr;
|
||||
LOG(LOG_DEBUG, 0,
|
||||
" Filter Dest Addr: %s (mask %#x) Port: %d\n",
|
||||
" Filter Dest Addr: %s (mask %#x) Port: %d",
|
||||
inet_ntoa(in_addr), ntoh32(filt->ff_mask.mask_dst.s_addr),
|
||||
ntoh16(filt->ff_flow.fi_dport));
|
||||
in_addr.s_addr = filt->ff_flow.fi_src.s_addr;
|
||||
LOG(LOG_DEBUG, 0,
|
||||
" Src Addr: %s (mask %#x) Port: %d\n",
|
||||
" Src Addr: %s (mask %#x) Port: %d",
|
||||
inet_ntoa(in_addr), ntoh32(filt->ff_mask.mask_src.s_addr),
|
||||
ntoh16(filt->ff_flow.fi_sport));
|
||||
LOG(LOG_DEBUG, 0, " Protocol: %d TOS %#x (mask %#x)\n",
|
||||
LOG(LOG_DEBUG, 0, " Protocol: %d TOS %#x (mask %#x)",
|
||||
filt->ff_flow.fi_proto, filt->ff_flow.fi_tos,
|
||||
filt->ff_mask.mask_tos);
|
||||
}
|
||||
@ -991,7 +990,7 @@ print_filter(const struct flow_filter *filt)
|
||||
inet_ntop(AF_INET6, &sfilt6->ff_mask6.mask6_src,
|
||||
str2, sizeof(str2)),
|
||||
ntoh16(sfilt6->ff_flow6.fi6_sport));
|
||||
LOG(LOG_DEBUG, 0, " Protocol: %d TCLASS %#x (mask %#x)\n",
|
||||
LOG(LOG_DEBUG, 0, " Protocol: %d TCLASS %#x (mask %#x)",
|
||||
sfilt6->ff_flow6.fi6_proto, sfilt6->ff_flow6.fi6_tclass,
|
||||
sfilt6->ff_mask6.mask6_tclass);
|
||||
}
|
||||
@ -1056,7 +1055,7 @@ add_filter_rule(struct ifinfo *ifinfo, struct fltrinfo *fltrinfo,
|
||||
case FILT_SUPERSET:
|
||||
if (front->dontwarn == 0 && back->dontwarn == 0)
|
||||
LOG(LOG_ERR, 0,
|
||||
"filters for \"%s\" at line %d and for \"%s\" at line %d has an order problem!\n",
|
||||
"filters for \"%s\" at line %d and for \"%s\" at line %d has an order problem!",
|
||||
front->clinfo->clname, front->line_no,
|
||||
back->clinfo->clname, back->line_no);
|
||||
|
||||
@ -1074,7 +1073,7 @@ add_filter_rule(struct ifinfo *ifinfo, struct fltrinfo *fltrinfo,
|
||||
break;
|
||||
if (front->dontwarn == 0 && back->dontwarn == 0)
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: filter for \"%s\" at line %d could override filter for \"%s\" at line %d\n",
|
||||
"warning: filter for \"%s\" at line %d could override filter for \"%s\" at line %d",
|
||||
front->clinfo->clname, front->line_no,
|
||||
back->clinfo->clname, back->line_no);
|
||||
break;
|
||||
@ -1354,7 +1353,7 @@ qop_red_set_defaults(int th_min, int th_max, int inv_pmax)
|
||||
int fd;
|
||||
|
||||
if ((fd = open(RED_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "RED open\n");
|
||||
LOG(LOG_ERR, errno, "RED open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -1363,7 +1362,7 @@ qop_red_set_defaults(int th_min, int th_max, int inv_pmax)
|
||||
params.inv_pmax = inv_pmax;
|
||||
|
||||
if (ioctl(fd, RED_SETDEFAULTS, ¶ms) < 0) {
|
||||
LOG(LOG_ERR, errno, "RED_SETDEFAULTS\n");
|
||||
LOG(LOG_ERR, errno, "RED_SETDEFAULTS");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -1380,16 +1379,16 @@ qop_rio_set_defaults(struct redparams *params)
|
||||
for (i = 1; i < RIO_NDROPPREC; i++) {
|
||||
if (params[i].th_max > params[i-1].th_min)
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: overlap found in RIO thresholds\n");
|
||||
"warning: overlap found in RIO thresholds");
|
||||
}
|
||||
|
||||
if ((fd = open(RIO_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "RIO open\n");
|
||||
LOG(LOG_ERR, errno, "RIO open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
if (ioctl(fd, RIO_SETDEFAULTS, params) < 0) {
|
||||
LOG(LOG_ERR, errno, "RIO_SETDEFAULTS\n");
|
||||
LOG(LOG_ERR, errno, "RIO_SETDEFAULTS");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -1399,6 +1398,7 @@ qop_rio_set_defaults(struct redparams *params)
|
||||
|
||||
/*
|
||||
* try to load and open KLD module
|
||||
* (also check the altq device file)
|
||||
*/
|
||||
int
|
||||
open_module(const char *devname, int flags)
|
||||
@ -1406,8 +1406,16 @@ open_module(const char *devname, int flags)
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version > 300000)
|
||||
char modname[64], filename[MAXPATHLEN], *cp;
|
||||
int fd;
|
||||
#endif
|
||||
struct stat sbuf;
|
||||
|
||||
/* check if the altq device exists */
|
||||
if (stat(devname, &sbuf) < 0) {
|
||||
LOG(LOG_ERR, errno, "can't access %s!", devname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#if defined(__FreeBSD__) && (__FreeBSD_version > 300000)
|
||||
/* turn discipline name into module name */
|
||||
strlcpy(modname, "altq_", sizeof(modname));
|
||||
if ((cp = strrchr(devname, '/')) == NULL)
|
||||
@ -1422,12 +1430,12 @@ open_module(const char *devname, int flags)
|
||||
}
|
||||
|
||||
if (kldload(modname) < 0) {
|
||||
LOG(LOG_ERR, errno, "kldload %s failed!\n", modname);
|
||||
LOG(LOG_ERR, errno, "kldload %s failed!", modname);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* successfully loaded, open the device */
|
||||
LOG(LOG_INFO, 0, "kld module %s loaded\n", modname);
|
||||
LOG(LOG_INFO, 0, "kld module %s loaded", modname);
|
||||
fd = open(devname, flags);
|
||||
return (fd);
|
||||
#else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_blue.c,v 1.3 2001/08/16 07:48:13 itojun Exp $ */
|
||||
/* $KAME: qop_blue.c,v 1.3 2000/10/18 09:15:18 kjc Exp $ */
|
||||
/* $NetBSD: qop_blue.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_blue.c,v 1.5 2001/08/16 10:39:13 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -125,7 +125,7 @@ blue_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "ecn")) {
|
||||
flags |= BLUEF_ECN;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -154,7 +154,7 @@ qcmd_blue_add_if(const char *ifname, u_int bandwidth, int max_pmark,
|
||||
error = qop_blue_add_if(NULL, ifname, bandwidth, max_pmark, hold_time,
|
||||
qlimit, pkttime, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add blue on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add blue on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -204,7 +204,7 @@ blue_attach(struct ifinfo *ifinfo)
|
||||
if (blue_fd < 0 &&
|
||||
(blue_fd = open(BLUE_DEVICE, O_RDWR)) < 0 &&
|
||||
(blue_fd = open_module(BLUE_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "BLUE open\n");
|
||||
LOG(LOG_ERR, errno, "BLUE open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ blue_attach(struct ifinfo *ifinfo)
|
||||
return (QOPERR_SYSCALL);
|
||||
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "blue attached to %s\n", iface.blue_ifname);
|
||||
LOG(LOG_INFO, 0, "blue attached to %s", iface.blue_ifname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_cbq.c,v 1.3 2001/08/16 07:48:13 itojun Exp $ */
|
||||
/* $KAME: qop_cbq.c,v 1.3 2000/10/18 09:15:18 kjc Exp $ */
|
||||
/* $NetBSD: qop_cbq.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_cbq.c,v 1.5 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
|
||||
*
|
||||
@ -134,7 +134,7 @@ cbq_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "cbq-prr")) {
|
||||
is_wrr = 0;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -193,7 +193,7 @@ cbq_class_parser(const char *ifname, const char *class_name,
|
||||
admission_type = CBQ_QOS_NONE;
|
||||
else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"unknown admission type - %s, line %d\n",
|
||||
"unknown admission type - %s, line %d",
|
||||
*argv, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -218,7 +218,7 @@ cbq_class_parser(const char *ifname, const char *class_name,
|
||||
pbandwidth = strtoul(*argv, NULL, 0);
|
||||
if (pbandwidth > 100) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"bad pbandwidth %d for %s!\n",
|
||||
"bad pbandwidth %d for %s!",
|
||||
pbandwidth, class_name);
|
||||
return (0);
|
||||
}
|
||||
@ -254,7 +254,7 @@ cbq_class_parser(const char *ifname, const char *class_name,
|
||||
flags |= CBQCLF_CLEARDSCP;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Unknown keyword '%s' in %s, line %d\n",
|
||||
"Unknown keyword '%s' in %s, line %d",
|
||||
*argv, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -264,7 +264,7 @@ cbq_class_parser(const char *ifname, const char *class_name,
|
||||
|
||||
if ((flags & (CBQCLF_RED|CBQCLF_RIO)) == (CBQCLF_RED|CBQCLF_RIO)) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"both red and rio defined on interface '%s'\n",
|
||||
"both red and rio defined on interface '%s'",
|
||||
ifname);
|
||||
return (0);
|
||||
}
|
||||
@ -302,7 +302,7 @@ qcmd_cbq_add_if(const char *ifname, u_int bandwidth, int is_wrr, int efficient)
|
||||
|
||||
error = qop_cbq_add_if(NULL, ifname, bandwidth, is_wrr, efficient);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add cbq on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add cbq on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -354,7 +354,7 @@ qcmd_cbq_add_class(const char *ifname, const char *class_name,
|
||||
admission_type, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno,
|
||||
"cbq: %s: can't add class '%s' on interface '%s'\n",
|
||||
"cbq: %s: can't add class '%s' on interface '%s'",
|
||||
qoperror(error), class_name, ifname);
|
||||
|
||||
if (ctl_bandwidth != 0) {
|
||||
@ -430,7 +430,7 @@ qcmd_cbq_add_ctl_filters(const char *ifname, const char *clname)
|
||||
filter_dontwarn = 0; /* XXX */
|
||||
if (error) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"can't add ctl class filter on interface '%s'\n",
|
||||
"can't add ctl class filter on interface '%s'",
|
||||
ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -446,7 +446,7 @@ qcmd_cbq_add_ctl_filters(const char *ifname, const char *clname)
|
||||
(struct flow_filter *)&sfilt6);
|
||||
if (error) {
|
||||
LOG(LOG_WARNING, 0,
|
||||
"can't add ctl class IPv6 filter on interface '%s'\n",
|
||||
"can't add ctl class IPv6 filter on interface '%s'",
|
||||
ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -530,14 +530,14 @@ qop_cbq_add_class(struct classinfo **rp, const char *class_name,
|
||||
parent_clinfo->bandwidth - parent_clinfo->allocated) {
|
||||
#ifdef ALLOW_OVERCOMMIT
|
||||
LOG(LOG_WARNING, 0,
|
||||
"bandwidth overcommitted %uK requested but only %dK available (%uK already allocated)\n",
|
||||
"bandwidth overcommitted %uK requested but only %dK available (%uK already allocated)",
|
||||
bandwidth / 1000,
|
||||
((int)parent_clinfo->bandwidth -
|
||||
parent_clinfo->allocated) / 1000,
|
||||
parent_clinfo->allocated / 1000);
|
||||
#else /* !ALLOW_OVERCOMMIT */
|
||||
LOG(LOG_ERR, 0,
|
||||
"cbq admission failed! %uK requested but only %uK available (%uK already allocated)\n",
|
||||
"cbq admission failed! %uK requested but only %uK available (%uK already allocated)",
|
||||
bandwidth / 1000,
|
||||
(parent_clinfo->bandwidth -
|
||||
parent_clinfo->allocated) / 1000,
|
||||
@ -609,7 +609,7 @@ qop_cbq_add_class(struct classinfo **rp, const char *class_name,
|
||||
case CBQ_QOS_CNTR_DELAY:
|
||||
if (ifinfo->resv_class != NULL) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"%s: duplicate resv meta class\n", class_name);
|
||||
"%s: duplicate resv meta class", class_name);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
ifinfo->resv_class = clinfo;
|
||||
@ -731,12 +731,12 @@ qop_cbq_enable_hook(struct ifinfo *ifinfo)
|
||||
|
||||
cbq_ifinfo = ifinfo->private;
|
||||
if (cbq_ifinfo->root_class == NULL) {
|
||||
LOG(LOG_ERR, 0, "cbq: no root class on interface %s!\n",
|
||||
LOG(LOG_ERR, 0, "cbq: no root class on interface %s!",
|
||||
ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
if (cbq_ifinfo->default_class == NULL) {
|
||||
LOG(LOG_ERR, 0, "cbq: no default class on interface %s!\n",
|
||||
LOG(LOG_ERR, 0, "cbq: no default class on interface %s!",
|
||||
ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
@ -788,7 +788,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
* (bandwidth < 6Kbps when max_pkt_size=1500)
|
||||
*/
|
||||
if (bandwidth != 0)
|
||||
LOG(LOG_WARNING, 0, "warning: class is too slow!!\n");
|
||||
LOG(LOG_WARNING, 0, "warning: class is too slow!!");
|
||||
nsPerByte = (double)(INT_MAX / max_pkt_size);
|
||||
}
|
||||
#endif
|
||||
@ -806,19 +806,19 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
if (IsDebug(DEBUG_ALTQ)) {
|
||||
int packet_time;
|
||||
LOG(LOG_DEBUG, 0,
|
||||
"cbq_flowspec: maxburst=%d,minburst=%d,pkt_size=%d\n",
|
||||
"cbq_flowspec: maxburst=%d,minburst=%d,pkt_size=%d",
|
||||
maxburst, minburst, av_pkt_size);
|
||||
LOG(LOG_DEBUG, 0,
|
||||
" nsPerByte=%.2f ns, link's nsPerByte=%.2f, f=%.3f\n",
|
||||
" nsPerByte=%.2f ns, link's nsPerByte=%.2f, f=%.3f",
|
||||
nsPerByte, cbq_ifinfo->nsPerByte, f);
|
||||
packet_time = av_pkt_size * (int)nsPerByte / 1000;
|
||||
LOG(LOG_DEBUG, 0,
|
||||
" packet time=%d [us]\n", packet_time);
|
||||
if (maxburst * packet_time < 20000) {
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: maxburst smaller than timer granularity!\n");
|
||||
"warning: maxburst smaller than timer granularity!");
|
||||
LOG(LOG_WARNING, 0,
|
||||
" maxburst=%d, packet_time=%d [us]\n",
|
||||
" maxburst=%d, packet_time=%d [us]",
|
||||
maxburst, packet_time);
|
||||
}
|
||||
}
|
||||
@ -831,14 +831,14 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
else
|
||||
maxidle = ptime * maxidle_s;
|
||||
if (IsDebug(DEBUG_ALTQ))
|
||||
LOG(LOG_DEBUG, 0, " maxidle=%.2f us\n", maxidle/1000.0);
|
||||
LOG(LOG_DEBUG, 0, " maxidle=%.2f us", maxidle/1000.0);
|
||||
if (minburst)
|
||||
offtime = cptime * (1.0 + 1.0/(1.0 - g) * (1.0 - gtom) / gtom);
|
||||
else
|
||||
offtime = cptime;
|
||||
minidle = -((double)max_pkt_size * (double)nsPerByte);
|
||||
if (IsDebug(DEBUG_ALTQ))
|
||||
LOG(LOG_DEBUG, 0, " offtime=%.2f us minidle=%.2f us\n",
|
||||
LOG(LOG_DEBUG, 0, " offtime=%.2f us minidle=%.2f us",
|
||||
offtime/1000.0, minidle/1000.0);
|
||||
|
||||
maxidle = ((maxidle * 8.0) / nsPerByte) * pow(2, RM_FILTER_GAIN);
|
||||
@ -861,7 +861,7 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
maxq = ((double) maxdelay * NS_PER_MS) / (nsPerByte * av_pkt_size);
|
||||
if (maxq < 4) {
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: maxq (%d) is too small. set to %d\n",
|
||||
"warning: maxq (%d) is too small. set to %d",
|
||||
(int)maxq, 4);
|
||||
maxq = 4;
|
||||
}
|
||||
@ -872,12 +872,12 @@ cbq_class_spec(struct ifinfo *ifinfo, u_long parent_class,
|
||||
if (IsDebug(DEBUG_ALTQ)) {
|
||||
if ((u_int)maxq < maxburst)
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: maxq (%d) is smaller than maxburst(%d)\n",
|
||||
"warning: maxq (%d) is smaller than maxburst(%d)",
|
||||
(int)maxq, maxburst);
|
||||
else if (maxq > 100.0)
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: maxq %d too large\n", (int)maxq);
|
||||
LOG(LOG_DEBUG, 0, " maxq=%d\n", (int)maxq);
|
||||
LOG(LOG_DEBUG, 0, " maxq=%d", (int)maxq);
|
||||
}
|
||||
|
||||
if (parent_class == NULL_CLASS_HANDLE) {
|
||||
@ -918,7 +918,7 @@ cbq_attach(struct ifinfo *ifinfo)
|
||||
if (cbq_fd < 0 &&
|
||||
(cbq_fd = open(CBQ_DEVICE, O_RDWR)) < 0 &&
|
||||
(cbq_fd = open_module(CBQ_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "CBQ open\n");
|
||||
LOG(LOG_ERR, errno, "CBQ open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_cdnr.c,v 1.3 2001/08/16 07:48:13 itojun Exp $ */
|
||||
/* $KAME: qop_cdnr.c,v 1.7 2001/08/15 12:51:57 kjc Exp $ */
|
||||
/* $NetBSD: qop_cdnr.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_cdnr.c,v 1.9 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -126,7 +126,7 @@ cdnr_ifname2ifinfo(const char *ifname)
|
||||
strlcpy(input_ifname+1, ifname, sizeof(input_ifname)-1);
|
||||
if (qop_add_if(&ifinfo, input_ifname, 0, &cdnr_qdisc, NULL) != 0) {
|
||||
LOG(LOG_ERR, errno,
|
||||
"cdnr_ifname2ifinfo: can't add a input interface %s\n",
|
||||
"cdnr_ifname2ifinfo: can't add a input interface %s",
|
||||
ifname);
|
||||
return (NULL);
|
||||
}
|
||||
@ -146,7 +146,7 @@ qcmd_cdnr_add_element(struct tc_action *rp, const char *ifname,
|
||||
|
||||
if ((error = qop_cdnr_add_element(&clinfo, cdnr_name, ifinfo,
|
||||
action)) != 0) {
|
||||
LOG(LOG_ERR, errno, "%s: add element failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: add element failed!",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -176,7 +176,7 @@ qcmd_cdnr_add_tbmeter(struct tc_action *rp, const char *ifname,
|
||||
|
||||
if ((error = qop_cdnr_add_tbmeter(&clinfo, cdnr_name, ifinfo,
|
||||
profile, in_action, out_action)) != 0) {
|
||||
LOG(LOG_ERR, errno, "%s: add tbmeter failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: add tbmeter failed!",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -211,7 +211,7 @@ qcmd_cdnr_add_trtcm(struct tc_action *rp, const char *ifname,
|
||||
cmtd_profile, peak_profile,
|
||||
green_action, yellow_action, red_action,
|
||||
coloraware)) != 0) {
|
||||
LOG(LOG_ERR, errno, "%s: add trtcm failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: add trtcm failed!",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -240,7 +240,7 @@ qcmd_cdnr_add_tswtcm(struct tc_action *rp, const char *ifname,
|
||||
|
||||
if (cmtd_rate > peak_rate) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"add tswtcm: cmtd_rate larger than peak_rate!\n");
|
||||
"add tswtcm: cmtd_rate larger than peak_rate!");
|
||||
return (QOPERR_INVAL);
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ qcmd_cdnr_add_tswtcm(struct tc_action *rp, const char *ifname,
|
||||
cmtd_rate, peak_rate, avg_interval,
|
||||
green_action, yellow_action,
|
||||
red_action)) != 0) {
|
||||
LOG(LOG_ERR, errno, "%s: add tswtcm failed!\n",
|
||||
LOG(LOG_ERR, errno, "%s: add tswtcm failed!",
|
||||
qoperror(error));
|
||||
return (error);
|
||||
}
|
||||
@ -308,7 +308,7 @@ qop_add_cdnr(struct classinfo **rp, const char *cdnr_name,
|
||||
if ((error = qop_add_class(&root, "cdnr_root",
|
||||
ifinfo, NULL, NULL)) != 0) {
|
||||
LOG(LOG_ERR, errno,
|
||||
"cdnr: %s: can't create dummy root cdnr on %s!\n",
|
||||
"cdnr: %s: can't create dummy root cdnr on %s!",
|
||||
qoperror(error), ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
@ -362,7 +362,7 @@ qop_delete_cdnr(struct classinfo *clinfo)
|
||||
int error;
|
||||
|
||||
if ((root = get_rootclass(clinfo->ifinfo)) == NULL) {
|
||||
LOG(LOG_ERR, 0, "qop_delete_cdnr: no root cdnr!\n");
|
||||
LOG(LOG_ERR, 0, "qop_delete_cdnr: no root cdnr!");
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
|
||||
@ -671,7 +671,7 @@ cdnr_attach(struct ifinfo *ifinfo)
|
||||
if (cdnr_fd < 0 &&
|
||||
(cdnr_fd = open(CDNR_DEVICE, O_RDWR)) < 0 &&
|
||||
(cdnr_fd = open_module(CDNR_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "CDNR open\n");
|
||||
LOG(LOG_ERR, errno, "CDNR open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -682,7 +682,7 @@ cdnr_attach(struct ifinfo *ifinfo)
|
||||
if (ioctl(cdnr_fd, CDNR_IF_ATTACH, &iface) < 0)
|
||||
return (QOPERR_SYSCALL);
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "conditioner attached to %s\n", iface.cdnr_ifname);
|
||||
LOG(LOG_INFO, 0, "conditioner attached to %s", iface.cdnr_ifname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
@ -924,7 +924,7 @@ verify_tbprofile(struct tb_profile *profile, const char *cdnr_name)
|
||||
{
|
||||
if (profile->depth < 1500) {
|
||||
LOG(LOG_WARNING, 0,
|
||||
"warning: token bucket depth for %s is too small (%d)\n",
|
||||
"warning: token bucket depth for %s is too small (%d)",
|
||||
cdnr_name, profile->depth);
|
||||
return (-1);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_dummy.c,v 1.4 2001/08/16 07:48:13 itojun Exp $ */
|
||||
/* $KAME: qop_dummy.c,v 1.2 2000/10/18 09:15:19 kjc Exp $ */
|
||||
/* $NetBSD: qop_dummy.c,v 1.5 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_dummy.c,v 1.4 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -89,7 +89,7 @@ null_interface_parser(const char *ifname, int argc, char **argv)
|
||||
if (argc > 0)
|
||||
tbrsize = atobytes(*argv);
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -112,7 +112,7 @@ null_class_parser(const char *ifname, const char *class_name,
|
||||
const char *parent_name, int argc, char **argv)
|
||||
{
|
||||
LOG(LOG_ERR, 0,
|
||||
"class cannot be defined without a queueing discipline in %s, line %d\n",
|
||||
"class cannot be defined without a queueing discipline in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -127,7 +127,7 @@ qcmd_nop_add_if(const char *ifname)
|
||||
|
||||
error = qop_add_if(NULL, ifname, 0, &nop_qdisc, NULL);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add nop on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add nop on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_fifoq.c,v 1.3 2001/08/16 07:48:14 itojun Exp $ */
|
||||
/* $KAME: qop_fifoq.c,v 1.3 2000/10/18 09:15:19 kjc Exp $ */
|
||||
/* $NetBSD: qop_fifoq.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_fifoq.c,v 1.5 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -106,7 +106,7 @@ fifoq_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "fifoq")) {
|
||||
/* just skip */
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -130,7 +130,7 @@ qcmd_fifoq_add_if(const char *ifname, u_int bandwidth, int qlimit)
|
||||
|
||||
error = qop_fifoq_add_if(NULL, ifname, bandwidth, qlimit);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add fifoq on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add fifoq on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -175,7 +175,7 @@ fifoq_attach(struct ifinfo *ifinfo)
|
||||
if (fifoq_fd < 0 &&
|
||||
(fifoq_fd = open(FIFOQ_DEVICE, O_RDWR)) < 0 &&
|
||||
(fifoq_fd = open_module(FIFOQ_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "FIFOQ open\n");
|
||||
LOG(LOG_ERR, errno, "FIFOQ open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -196,7 +196,7 @@ fifoq_attach(struct ifinfo *ifinfo)
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "fifoq attached to %s\n", iface.fifoq_ifname);
|
||||
LOG(LOG_INFO, 0, "fifoq attached to %s", iface.fifoq_ifname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_hfsc.c,v 1.3 2001/08/16 07:48:14 itojun Exp $ */
|
||||
/* $KAME: qop_hfsc.c,v 1.4 2000/10/18 09:15:19 kjc Exp $ */
|
||||
/* $NetBSD: qop_hfsc.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_hfsc.c,v 1.6 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -123,7 +123,7 @@ hfsc_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "hfsc")) {
|
||||
/* just skip */
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -151,7 +151,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
if (*argv[0] == '[') {
|
||||
if (read_sc(&argc, &argv, &type, &m1, &d, &m2) != 0) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Bad service curve in %s, line %d\n",
|
||||
"Bad service curve in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -195,7 +195,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
/* nothing */
|
||||
} else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"unknown admission type - %s, line %d\n",
|
||||
"unknown admission type - %s, line %d",
|
||||
*argv, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -210,7 +210,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
flags |= HFCF_CLEARDSCP;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Unknown keyword '%s' in %s, line %d\n",
|
||||
"Unknown keyword '%s' in %s, line %d",
|
||||
*argv, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -220,7 +220,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
|
||||
if (type == 0) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"hfsc: service curve not specified in %s, line %d\n",
|
||||
"hfsc: service curve not specified in %s, line %d",
|
||||
altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -258,7 +258,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
|
||||
if (ifinfo->resv_class != NULL) {
|
||||
LOG(LOG_ERR, 0,
|
||||
"more than one admission class specified: %s\n",
|
||||
"more than one admission class specified: %s",
|
||||
class_name);
|
||||
return (0);
|
||||
}
|
||||
@ -266,7 +266,7 @@ hfsc_class_parser(const char *ifname, const char *class_name,
|
||||
}
|
||||
|
||||
if (error) {
|
||||
LOG(LOG_ERR, errno, "hfsc_class_parser: %s\n",
|
||||
LOG(LOG_ERR, errno, "hfsc_class_parser: %s",
|
||||
qoperror(error));
|
||||
return (0);
|
||||
}
|
||||
@ -325,7 +325,7 @@ qcmd_hfsc_add_if(const char *ifname, u_int bandwidth, int flags)
|
||||
|
||||
error = qop_hfsc_add_if(NULL, ifname, bandwidth, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add hfsc on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add hfsc on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -356,7 +356,7 @@ qcmd_hfsc_add_class(const char *ifname, const char *class_name,
|
||||
&sc, qlimit, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno,
|
||||
"hfsc: %s: can't add class '%s' on interface '%s'\n",
|
||||
"hfsc: %s: can't add class '%s' on interface '%s'",
|
||||
qoperror(error), class_name, ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -412,7 +412,7 @@ qop_hfsc_add_if(struct ifinfo **rp, const char *ifname,
|
||||
if ((error = qop_hfsc_add_class(&hfsc_ifinfo->root_class, "root",
|
||||
ifinfo, NULL, &sc, 0, 0)) != 0) {
|
||||
LOG(LOG_ERR, errno,
|
||||
"hfsc: %s: can't create dummy root class on %s!\n",
|
||||
"hfsc: %s: can't create dummy root class on %s!",
|
||||
qoperror(error), ifname);
|
||||
(void)qop_delete_if(ifinfo);
|
||||
return (QOPERR_CLASS);
|
||||
@ -633,18 +633,19 @@ qop_hfsc_enable_hook(struct ifinfo *ifinfo)
|
||||
|
||||
hfsc_ifinfo = ifinfo->private;
|
||||
if (hfsc_ifinfo->default_class == NULL) {
|
||||
LOG(LOG_ERR, 0, "hfsc: no default class on interface %s!\n",
|
||||
LOG(LOG_ERR, 0, "hfsc: no default class on interface %s!",
|
||||
ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
} else if (hfsc_ifinfo->default_class->child != NULL) {
|
||||
LOG(LOG_ERR, 0, "hfsc: default class on %s must be a leaf!\n",
|
||||
LOG(LOG_ERR, 0, "hfsc: default class on %s must be a leaf!",
|
||||
ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
|
||||
LIST_FOREACH(clinfo, &ifinfo->cllist, next) {
|
||||
if (clinfo->child != NULL && !LIST_EMPTY(&clinfo->fltrlist)) {
|
||||
LOG(LOG_ERR, 0, "hfsc: internal class \"%s\" should not have a filter!\n",
|
||||
LOG(LOG_ERR, 0,
|
||||
"hfsc: internal class \"%s\" should not have a filter!",
|
||||
clinfo->clname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
@ -658,7 +659,7 @@ validate_sc(struct service_curve *sc)
|
||||
{
|
||||
/* the 1st segment of a concave curve must be zero */
|
||||
if (sc->m1 < sc->m2 && sc->m1 != 0) {
|
||||
LOG(LOG_ERR, 0, "m1 must be 0 for convex!\n");
|
||||
LOG(LOG_ERR, 0, "m1 must be 0 for convex!");
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
@ -910,7 +911,7 @@ hfsc_attach(struct ifinfo *ifinfo)
|
||||
if (hfsc_fd < 0 &&
|
||||
(hfsc_fd = open(HFSC_DEVICE, O_RDWR)) < 0 &&
|
||||
(hfsc_fd = open_module(HFSC_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "HFSC open\n");
|
||||
LOG(LOG_ERR, errno, "HFSC open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_priq.c,v 1.3 2001/08/16 07:48:14 itojun Exp $ */
|
||||
/* $KAME: qop_priq.c,v 1.1 2000/10/18 09:15:19 kjc Exp $ */
|
||||
/* $NetBSD: qop_priq.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_priq.c,v 1.3 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -110,7 +110,7 @@ priq_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "priq")) {
|
||||
/* just skip */
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -152,7 +152,7 @@ priq_class_parser(const char *ifname, const char *class_name,
|
||||
flags |= PRCF_CLEARDSCP;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Unknown keyword '%s' in %s, line %d\n",
|
||||
"Unknown keyword '%s' in %s, line %d",
|
||||
*argv, altqconfigfile, line_no);
|
||||
return (0);
|
||||
}
|
||||
@ -166,7 +166,7 @@ priq_class_parser(const char *ifname, const char *class_name,
|
||||
error = qcmd_priq_add_class(ifname, class_name, pri, qlimit, flags);
|
||||
|
||||
if (error) {
|
||||
LOG(LOG_ERR, errno, "priq_class_parser: %s\n",
|
||||
LOG(LOG_ERR, errno, "priq_class_parser: %s",
|
||||
qoperror(error));
|
||||
return (0);
|
||||
}
|
||||
@ -183,7 +183,7 @@ qcmd_priq_add_if(const char *ifname, u_int bandwidth, int flags)
|
||||
|
||||
error = qop_priq_add_if(NULL, ifname, bandwidth, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add priq on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add priq on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -203,7 +203,7 @@ qcmd_priq_add_class(const char *ifname, const char *class_name,
|
||||
pri, qlimit, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno,
|
||||
"priq: %s: can't add class '%s' on interface '%s'\n",
|
||||
"priq: %s: can't add class '%s' on interface '%s'",
|
||||
qoperror(error), class_name, ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -334,7 +334,7 @@ qop_priq_enable_hook(struct ifinfo *ifinfo)
|
||||
|
||||
priq_ifinfo = ifinfo->private;
|
||||
if (priq_ifinfo->default_class == NULL) {
|
||||
LOG(LOG_ERR, 0, "priq: no default class on interface %s!\n",
|
||||
LOG(LOG_ERR, 0, "priq: no default class on interface %s!",
|
||||
ifinfo->ifname);
|
||||
return (QOPERR_CLASS);
|
||||
}
|
||||
@ -355,7 +355,7 @@ priq_attach(struct ifinfo *ifinfo)
|
||||
if (priq_fd < 0 &&
|
||||
(priq_fd = open(PRIQ_DEVICE, O_RDWR)) < 0 &&
|
||||
(priq_fd = open_module(PRIQ_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "PRIQ open\n");
|
||||
LOG(LOG_ERR, errno, "PRIQ open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_red.c,v 1.3 2001/08/16 07:48:14 itojun Exp $ */
|
||||
/* $KAME: qop_red.c,v 1.3 2000/10/18 09:15:19 kjc Exp $ */
|
||||
/* $NetBSD: qop_red.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_red.c,v 1.5 2001/08/16 10:39:14 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -137,7 +137,7 @@ red_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "flowvalve")) {
|
||||
flags |= REDF_FLOWVALVE;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -181,7 +181,7 @@ qcmd_red_add_if(const char *ifname, u_int bandwidth, int weight,
|
||||
error = qop_red_add_if(NULL, ifname, bandwidth, weight, inv_pmax,
|
||||
th_min, th_max, qlimit, pkttime, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add red on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add red on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -233,7 +233,7 @@ red_attach(struct ifinfo *ifinfo)
|
||||
if (red_fd < 0 &&
|
||||
(red_fd = open(RED_DEVICE, O_RDWR)) < 0 &&
|
||||
(red_fd = open_module(RED_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "RED open\n");
|
||||
LOG(LOG_ERR, errno, "RED open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ red_attach(struct ifinfo *ifinfo)
|
||||
return (QOPERR_SYSCALL);
|
||||
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "red attached to %s\n", iface.red_ifname);
|
||||
LOG(LOG_INFO, 0, "red attached to %s", iface.red_ifname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_rio.c,v 1.3 2001/08/16 07:48:15 itojun Exp $ */
|
||||
/* $KAME: qop_rio.c,v 1.3 2000/10/18 09:15:20 kjc Exp $ */
|
||||
/* $NetBSD: qop_rio.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_rio.c,v 1.5 2001/08/16 10:39:15 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -166,7 +166,7 @@ rio_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "ecn")) {
|
||||
flags |= RIOF_ECN;
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -226,7 +226,7 @@ qcmd_rio_add_if(const char *ifname, u_int bandwidth, int weight,
|
||||
error = qop_rio_add_if(NULL, ifname, bandwidth, weight, red_params,
|
||||
qlimit, pkttime, flags);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add rio on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add rio on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -278,7 +278,7 @@ rio_attach(struct ifinfo *ifinfo)
|
||||
if (rio_fd < 0 &&
|
||||
(rio_fd = open(RIO_DEVICE, O_RDWR)) < 0 &&
|
||||
(rio_fd = open_module(RIO_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "RIO open\n");
|
||||
LOG(LOG_ERR, errno, "RIO open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ rio_attach(struct ifinfo *ifinfo)
|
||||
return (QOPERR_SYSCALL);
|
||||
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "rio attached to %s\n", iface.rio_ifname);
|
||||
LOG(LOG_INFO, 0, "rio attached to %s", iface.rio_ifname);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: qop_wfq.c,v 1.3 2001/08/16 07:48:15 itojun Exp $ */
|
||||
/* $KAME: qop_wfq.c,v 1.3 2000/10/18 09:15:20 kjc Exp $ */
|
||||
/* $NetBSD: qop_wfq.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: qop_wfq.c,v 1.5 2001/08/16 10:39:15 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -120,7 +120,7 @@ wfq_interface_parser(const char *ifname, int argc, char **argv)
|
||||
hash_policy = WFQ_HASH_SRCPORT;
|
||||
else {
|
||||
LOG(LOG_ERR, 0,
|
||||
"Unknown hash policy '%s'\n",
|
||||
"Unknown hash policy '%s'",
|
||||
argv);
|
||||
return (0);
|
||||
}
|
||||
@ -128,7 +128,7 @@ wfq_interface_parser(const char *ifname, int argc, char **argv)
|
||||
} else if (EQUAL(*argv, "wfq")) {
|
||||
/* just skip */
|
||||
} else {
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'\n", argv);
|
||||
LOG(LOG_ERR, 0, "Unknown keyword '%s'", argv);
|
||||
return (0);
|
||||
}
|
||||
argc--; argv++;
|
||||
@ -160,7 +160,7 @@ qcmd_wfq_add_if(const char *ifname, u_int bandwidth, int hash_policy,
|
||||
error = qop_wfq_add_if(NULL, ifname, bandwidth,
|
||||
hash_policy, nqueues, qsize);
|
||||
if (error != 0)
|
||||
LOG(LOG_ERR, errno, "%s: can't add wfq on interface '%s'\n",
|
||||
LOG(LOG_ERR, errno, "%s: can't add wfq on interface '%s'",
|
||||
qoperror(error), ifname);
|
||||
return (error);
|
||||
}
|
||||
@ -207,7 +207,7 @@ wfq_attach(struct ifinfo *ifinfo)
|
||||
if (wfq_fd < 0 &&
|
||||
(wfq_fd = open(WFQ_DEVICE, O_RDWR)) < 0 &&
|
||||
(wfq_fd = open_module(WFQ_DEVICE, O_RDWR)) < 0) {
|
||||
LOG(LOG_ERR, errno, "WFQ open\n");
|
||||
LOG(LOG_ERR, errno, "WFQ open");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
|
||||
@ -228,12 +228,12 @@ wfq_attach(struct ifinfo *ifinfo)
|
||||
conf.nqueues = wfq_ifinfo->nqueues;
|
||||
conf.qlimit = wfq_ifinfo->qsize;
|
||||
if (ioctl(wfq_fd, WFQ_CONFIG, &conf) < 0) {
|
||||
LOG(LOG_ERR, errno, "WFQ_CONFIG\n");
|
||||
LOG(LOG_ERR, errno, "WFQ_CONFIG");
|
||||
return (QOPERR_SYSCALL);
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
LOG(LOG_INFO, 0, "wfq attached to %s\n", iface.wfq_ifacename);
|
||||
LOG(LOG_INFO, 0, "wfq attached to %s", iface.wfq_ifacename);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* $NetBSD: quip_server.c,v 1.3 2001/08/16 07:48:15 itojun Exp $ */
|
||||
/* $KAME: quip_server.c,v 1.4 2001/08/15 12:51:58 kjc Exp $ */
|
||||
/* $NetBSD: quip_server.c,v 1.4 2001/08/22 08:52:37 itojun Exp $ */
|
||||
/* $KAME: quip_server.c,v 1.6 2001/08/20 06:41:32 kjc Exp $ */
|
||||
/*
|
||||
* Copyright (C) 1999-2000
|
||||
* Sony Computer Science Laboratories, Inc. All rights reserved.
|
||||
@ -201,8 +201,8 @@ expand_filtername(struct fltrinfo *fltrinfo, char *name, size_t maxname)
|
||||
int len;
|
||||
|
||||
len = expand_classname(fltrinfo->clinfo, name, maxname);
|
||||
len += snprintf(name + len, maxname - len, ":%s", fltrinfo->flname);
|
||||
return (len);
|
||||
snprintf(name + len, maxname - len, ":%s", fltrinfo->flname);
|
||||
return (strlen(name));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -213,7 +213,7 @@ query_handle2name(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
struct fltrinfo *fltrinfo;
|
||||
char *ifname, *class_field, *fltr_field, buf[256], *cp;
|
||||
u_long handle;
|
||||
int len, size;
|
||||
int len;
|
||||
|
||||
strlcpy(buf, arg, sizeof(buf));
|
||||
cp = buf;
|
||||
@ -240,23 +240,22 @@ query_handle2name(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
|
||||
len = expand_classname(clinfo, msg, maxmsg);
|
||||
}
|
||||
size = len + snprintf(msg + len, maxmsg - len, "\n");
|
||||
return (size);
|
||||
strlcat(msg, "\n", maxmsg);
|
||||
return (strlen(msg));
|
||||
}
|
||||
|
||||
static int
|
||||
query_qdisc(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
{
|
||||
struct ifinfo *ifinfo;
|
||||
int size;
|
||||
|
||||
if ((ifinfo = ifname2ifinfo(arg)) == NULL)
|
||||
return (-1);
|
||||
|
||||
size = snprintf(msg, maxmsg, "%s\nbandwidth:%.2fMbps\nstatus:%s\n",
|
||||
ifinfo->qdisc->qname, (double)ifinfo->bandwidth/1000000,
|
||||
snprintf(msg, maxmsg, "%s\nbandwidth:%.2fMbps\nstatus:%s\n",
|
||||
ifinfo->qdisc->qname, (double)ifinfo->bandwidth/1000000,
|
||||
(ifinfo->enabled ? "enabled" : "disabled"));
|
||||
return (size);
|
||||
return (strlen(msg));
|
||||
}
|
||||
|
||||
static int
|
||||
@ -267,7 +266,6 @@ query_filterspec(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
struct flow_filter *filt;
|
||||
char *ifname, *class_field, *fltr_field, buf[256], *cp;
|
||||
u_long handle;
|
||||
int size;
|
||||
|
||||
strlcpy(buf, arg, sizeof(buf));
|
||||
cp = buf;
|
||||
@ -321,12 +319,12 @@ query_filterspec(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
filt->ff_flow.fi_tos,
|
||||
filt->ff_mask.mask_tos);
|
||||
|
||||
size = snprintf(msg, maxmsg, "inet %s%s %d %s%s %d %d%s\n",
|
||||
dst, dmask,
|
||||
ntoh16(filt->ff_flow.fi_dport),
|
||||
src, smask,
|
||||
ntoh16(filt->ff_flow.fi_sport),
|
||||
filt->ff_flow.fi_proto, tos);
|
||||
snprintf(msg, maxmsg, "inet %s%s %d %s%s %d %d%s\n",
|
||||
dst, dmask,
|
||||
ntoh16(filt->ff_flow.fi_dport),
|
||||
src, smask,
|
||||
ntoh16(filt->ff_flow.fi_sport),
|
||||
filt->ff_flow.fi_proto, tos);
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (filt->ff_flow.fi_family == AF_INET6) {
|
||||
@ -378,16 +376,16 @@ query_filterspec(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
filt6->ff_flow6.fi6_tclass,
|
||||
filt6->ff_mask6.mask6_tclass);
|
||||
|
||||
size = snprintf(msg, maxmsg, "inet6 %s%s %d %s%s %d %d%s\n",
|
||||
dst6, dmask6,
|
||||
ntoh16(filt6->ff_flow6.fi6_dport),
|
||||
src6, smask6,
|
||||
ntoh16(filt6->ff_flow6.fi6_sport),
|
||||
filt6->ff_flow6.fi6_proto, tclass6);
|
||||
snprintf(msg, maxmsg, "inet6 %s%s %d %s%s %d %d%s\n",
|
||||
dst6, dmask6,
|
||||
ntoh16(filt6->ff_flow6.fi6_dport),
|
||||
src6, smask6,
|
||||
ntoh16(filt6->ff_flow6.fi6_sport),
|
||||
filt6->ff_flow6.fi6_proto, tclass6);
|
||||
}
|
||||
#endif /* INET6 */
|
||||
|
||||
return (size);
|
||||
return (strlen(msg));
|
||||
}
|
||||
|
||||
|
||||
@ -438,7 +436,7 @@ query_list(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
struct ifinfo *ifinfo;
|
||||
struct classinfo *clinfo;
|
||||
struct fltrinfo *fltrinfo;
|
||||
int print_if, print_class, print_fltr, size = 0;
|
||||
int print_if, print_class, print_fltr, len;
|
||||
|
||||
if (arg == NULL) {
|
||||
/* no arg, print all */
|
||||
@ -458,9 +456,13 @@ query_list(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
LIST_FOREACH(ifinfo, &qop_iflist, next) {
|
||||
if (print_if) {
|
||||
strlcpy(tmp, ifinfo->ifname, sizeof(tmp));
|
||||
if (arg == NULL || string_match(arg, tmp))
|
||||
cp += snprintf(cp, ep - cp, "%#010x\t%s\n",
|
||||
if (arg == NULL || string_match(arg, tmp)) {
|
||||
len = snprintf(cp, ep - cp, "%#010x\t%s\n",
|
||||
ifinfo->ifindex, tmp);
|
||||
if (len < 0 || len >= ep - cp)
|
||||
break;
|
||||
cp += len;
|
||||
}
|
||||
}
|
||||
if (!print_class && !print_fltr)
|
||||
continue;
|
||||
@ -468,22 +470,29 @@ query_list(const char *cmd, const char *arg, char *msg, size_t maxmsg)
|
||||
clinfo != NULL; clinfo = get_nextclass(clinfo)) {
|
||||
if (print_class) {
|
||||
expand_classname(clinfo, tmp, sizeof(tmp));
|
||||
if (arg == NULL || string_match(arg, tmp))
|
||||
cp += snprintf(cp, ep - cp,
|
||||
if (arg == NULL || string_match(arg, tmp)) {
|
||||
len = snprintf(cp, ep - cp,
|
||||
"%#010lx\t%s\n",
|
||||
clinfo->handle, tmp);
|
||||
if (len < 0 || len >= ep - cp)
|
||||
break;
|
||||
cp += len;
|
||||
}
|
||||
}
|
||||
if (!print_fltr)
|
||||
continue;
|
||||
LIST_FOREACH(fltrinfo, &clinfo->fltrlist, next) {
|
||||
expand_filtername(fltrinfo, tmp, sizeof(tmp));
|
||||
if (arg == NULL || string_match(arg, tmp))
|
||||
cp += snprintf(cp, ep - cp, "%#010lx\t%s\n",
|
||||
fltrinfo->handle, tmp);
|
||||
if (arg == NULL || string_match(arg, tmp)) {
|
||||
len = snprintf(cp, ep - cp, "%#010lx\t%s\n",
|
||||
fltrinfo->handle, tmp);
|
||||
if (len < 0 || len >= ep - cp)
|
||||
break;
|
||||
cp += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
size = cp - msg;
|
||||
return (size);
|
||||
return (strlen(msg));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user