Project

General

Profile

Bug #675 » netgraph-remove-xLEN3.patch

nant, 06/04/2007 12:37 AM

View differences:

libexec/pppoed/pppoed.c 2007-06-04 01:02:18.000000000 +0100
int
main(int argc, char *argv[])
{
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKLEN + 1];
char hostname[MAXHOSTNAMELEN], *exec, rhook[NG_HOOKSIZ];
unsigned char response[1024];
const char *label, *prog, *provider, *acname;
struct ngm_connect ngc;
-- share/examples/netgraph/ngctl.orig 2007-06-04 01:02:35.000000000 +0100
++ share/examples/netgraph/ngctl 2007-06-04 01:03:34.000000000 +0100
......
#
# /* Structure used for NGM_LISTHOOKS */
# struct linkinfo {
# char ourhook[NG_HOOKLEN + 1]; /* hook name */
# char peerhook[NG_HOOKLEN + 1]; /* peer hook */
# char ourhook[NG_HOOKSIZ]; /* hook name */
# char peerhook[NG_HOOSIZ]; /* peer hook */
# struct nodeinfo nodeinfo;
# };
#
-- share/man/man4/netgraph.4.orig 2007-06-04 01:03:49.000000000 +0100
++ share/man/man4/netgraph.4 2007-06-04 01:05:10.000000000 +0100
......
or
.Dq \&:
and is limited to
.Dv "NG_NODELEN + 1"
.Dv "NG_NODESIZ"
characters (including NUL byte).
.Pp
Each node instance has a unique
......
.Dq \&:
and is
limited to
.Dv "NG_HOOKLEN + 1"
.Dv "NG_HOOKSIZ"
characters (including NUL byte).
.It
A hook is always connected to another hook. That is, hooks are
......
.Pp
Control messages have the following structure:
.Bd -literal
#define NG_CMDSTRLEN 15 /* Max command string (16 with null) */
#define NG_CMDSTRSIZ 16 /* Max command string (including null) */
struct ng_mesg {
struct ng_msghdr {
......
u_long token; /* Reply should have the same token */
u_long typecookie; /* Node type understanding this message */
u_long cmd; /* Command identifier */
u_char cmdstr[NG_CMDSTRLEN+1]; /* Cmd string (for debug) */
u_char cmdstr[NG_CMDSTRSIZ]; /* Cmd string (for debug) */
} header;
char data[0]; /* Start of cmd/resp data */
};
-- share/man/man4/ng_bpf.4.orig 2007-06-04 01:05:49.000000000 +0100
++ share/man/man4/ng_bpf.4 2007-06-04 01:06:51.000000000 +0100
......
data on a hook. The following structure must be supplied as an argument:
.Bd -literal -offset 4n
struct ng_bpf_hookprog {
char thisHook[NG_HOOKLEN+1]; /* name of hook */
char ifMatch[NG_HOOKLEN+1]; /* match dest hook */
char ifNotMatch[NG_HOOKLEN+1]; /* !match dest hook */
char thisHook[NG_HOOKSIZ]; /* name of hook */
char ifMatch[NG_HOOKSIZ]; /* match dest hook */
char ifNotMatch[NG_HOOKSIZ]; /* !match dest hook */
int32_t bpf_prog_len; /* #isns in program */
struct bpf_insn bpf_prog[0]; /* bpf program */
};
-- share/man/man4/ng_etf.4.orig 2007-06-04 01:07:09.000000000 +0100
++ share/man/man4/ng_etf.4 2007-06-04 01:07:36.000000000 +0100
......
.Vt "struct ng_etffilter" :
.Bd -literal -offset 4n
struct ng_etffilter {
char matchhook[NG_HOOKLEN + 1]; /* hook name */
char matchhook[NG_HOOKSIZ]; /* hook name */
u_int16_t ethertype; /* catch these */
};
.Ed
-- share/man/man4/ng_pppoe.4.orig 2007-06-04 01:08:06.000000000 +0100
++ share/man/man4/ng_pppoe.4 2007-06-04 01:08:56.000000000 +0100
......
The three commands above use a common data structure:
.Bd -literal -offset 4n
struct ngpppoe_init_data {
char hook[NG_HOOKLEN + 1]; /* hook to monitor on */
char hook[NG_HOOKSIZ]; /* hook to monitor on */
u_int16_t data_len; /* service name length */
char data[0]; /* init data goes here */
};
......
The three commands above use a common data structure:
.Bd -literal -offset 4n
struct ngpppoe_sts {
char hook[NG_HOOKLEN + 1]; /* hook associated with event session */
char hook[NG_HOOKSIZ]; /* hook associated with event session */
};
.Ed
.El
......
} message;
/********tracking our little graph ********/
char path[100];
char source_ID[NG_NODELEN + 1];
char source_ID[NG_NODESIZ];
char pppoe_node_name[100];
int k;
-- sys/dev/misc/musycc/musycc.c.orig 2007-06-04 01:09:25.000000000 +0100
++ sys/dev/misc/musycc/musycc.c 2007-06-04 01:09:44.000000000 +0100
......
struct mdesc *mdt[NHDLC];
struct mdesc *mdr[NHDLC];
node_p node; /* NG node */
char nodename[NG_NODELEN + 1]; /* NG nodename */
char nodename[NG_NODESIZ]; /* NG nodename */
struct schan *chan[NHDLC];
u_long cnt_ferr;
u_long cnt_cerr;
-- sys/net/i4b/driver/i4b_ing.c.orig 2007-06-04 01:10:02.000000000 +0100
++ sys/net/i4b/driver/i4b_ing.c 2007-06-04 01:10:30.000000000 +0100
......
struct ifqueue xmitq; /* transmit queue */
node_p node; /* back pointer to node */
char nodename[NG_NODELEN + 1]; /* store our node name */
char nodename[NG_NODESIZ]; /* store our node name */
hook_p debughook;
hook_p hook;
-- usr.sbin/ngctl/list.c.orig 2007-06-04 01:11:10.000000000 +0100
++ usr.sbin/ngctl/list.c 2007-06-04 01:11:25.000000000 +0100
......
printf("There are %d total %snodes:\n",
nlist->numnames, named_only ? "named " : "");
for (k = 0; k < nlist->numnames; k++) {
char path[NG_PATHLEN+1];
char path[NG_PATHSIZ];
const char *new_av[3] = { "list", "-n", path };
snprintf(path, sizeof(path),
-- usr.sbin/ngctl/main.c.orig 2007-06-04 01:11:37.000000000 +0100
++ usr.sbin/ngctl/main.c 2007-06-04 01:12:01.000000000 +0100
......
int
main(int ac, char *av[])
{
char name[NG_NODELEN + 1];
char name[NG_NODESIZ];
int interactive = isatty(0) && isatty(1);
FILE *fp = NULL;
int ch, rtn = 0;
......
/* Display any incoming data packet */
if (FD_ISSET(dsock, &rfds)) {
u_char buf[8192];
char hook[NG_HOOKLEN + 1];
char hook[NG_HOOKSIZ];
int rl;
/* Read packet from socket */
-- usr.sbin/ngctl/msg.c.orig 2007-06-04 01:12:13.000000000 +0100
++ usr.sbin/ngctl/msg.c 2007-06-04 01:12:36.000000000 +0100
......
u_char buf[2 * sizeof(struct ng_mesg) + BUF_SIZE];
struct ng_mesg *const m = (struct ng_mesg *)buf;
struct ng_mesg *const ascii = (struct ng_mesg *)m->data;
char path[NG_PATHLEN+1];
char path[NG_PATHSIZ];
/* Get incoming message (in binary form) */
if (NgRecvMsg(csock, m, sizeof(buf), path) < 0) {
-- usr.sbin/ppp/netgraph.c.orig 2007-06-04 01:12:50.000000000 +0100
++ usr.sbin/ppp/netgraph.c 2007-06-04 01:14:23.000000000 +0100
......
struct ngdevice {
struct device dev; /* What struct physical knows about */
int cs; /* Control socket */
char hook[NG_HOOKLEN + 1]; /* Our socket node hook */
char hook[NG_HOOKSIZ]; /* Our socket node hook */
};
#define device2ng(d) ((d)->type == NG_DEVICE ? (struct ngdevice *)d : NULL)
......
static int
ng_MessageOut(struct ngdevice *dev, struct physical *p, const char *data)
{
char path[NG_PATHLEN + 1];
char path[NG_PATHSIZ];
int len, pos, dpos;
char *fmt;
......
char msgbuf[sizeof(struct ng_mesg) * 2 + NG_MSGBUFSZ];
struct ngdevice *dev = device2ng(p->handler);
struct ng_mesg *rep = (struct ng_mesg *)msgbuf;
char path[NG_PATHLEN + 1];
char path[NG_PATHSIZ];
int len;
#ifdef BROKEN_SELECT
......
static ssize_t
ng_Read(struct physical *p, void *v, size_t n)
{
char hook[NG_HOOKLEN + 1];
char hook[NG_HOOKSIZ];
log_Printf(LogDEBUG, "ng_Read\n");
switch (p->dl->state) {
......
struct ngm_mkpeer mkp;
struct ngm_connect ngc;
const char *devp, *endp;
char lasthook[NG_HOOKLEN + 1];
char hook[NG_HOOKLEN + 1];
char nodetype[NG_TYPELEN + NG_NODELEN + 2];
char modname[NG_TYPELEN + 4];
char path[NG_PATHLEN + 1];
char lasthook[NG_HOOKSIZ];
char hook[NG_HOOKSIZ];
char nodetype[NG_TYPESIZ + NG_NODESIZ];
char modname[NG_TYPESIZ + 3];
char path[NG_PATHSIZ];
char *nodename;
int len, sz, done, f;
-- usr.sbin/ppp/tty.c.orig 2007-06-04 01:14:45.000000000 +0100
++ usr.sbin/ppp/tty.c 2007-06-04 01:15:04.000000000 +0100
......
tty_SetAsyncParams(struct physical *p, u_int32_t mymap, u_int32_t hismap)
{
struct ttydevice *dev = device2tty(p->handler);
char asyncpath[NG_PATHLEN + 1];
char asyncpath[NG_PATHSIZ];
struct ng_async_cfg cfg;
if (isngtty(dev)) {
......
u_char rbuf[sizeof(struct ng_mesg) + sizeof(struct nodeinfo)];
struct ng_mesg *reply;
struct nodeinfo *info;
char ttypath[NG_NODELEN + 1];
char ttypath[NG_NODESIZ];
struct ngm_mkpeer ngm;
struct ngm_connect ngc;
int ldisc, cs, ds, hot, speed;
(3-3/3)