FreeBSD kernel netgraph code
ng_cisco.c
Go to the documentation of this file.
1/*
2 * ng_cisco.c
3 */
4
5/*-
6 * Copyright (c) 1996-1999 Whistle Communications, Inc.
7 * All rights reserved.
8 *
9 * Subject to the following obligations and disclaimer of warranty, use and
10 * redistribution of this software, in source or object code forms, with or
11 * without modifications are expressly permitted by Whistle Communications;
12 * provided, however, that:
13 * 1. Any and all reproductions of the source or object code must include the
14 * copyright notice above and the following disclaimer of warranties; and
15 * 2. No rights are granted, in any manner or form, to use Whistle
16 * Communications, Inc. trademarks, including the mark "WHISTLE
17 * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
18 * such appears in the above copyright notice or in the software.
19 *
20 * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
21 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
22 * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
23 * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
24 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
25 * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
26 * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
27 * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
28 * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
29 * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
30 * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
31 * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
32 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
35 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
36 * OF SUCH DAMAGE.
37 *
38 * Author: Julian Elischer <julian@freebsd.org>
39 *
40 * $FreeBSD$
41 * $Whistle: ng_cisco.c,v 1.25 1999/11/01 09:24:51 julian Exp $
42 */
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/errno.h>
47#include <sys/kernel.h>
48#include <sys/socket.h>
49#include <sys/malloc.h>
50#include <sys/mbuf.h>
51#include <sys/syslog.h>
52
53#include <net/if.h>
54
55#include <netinet/in.h>
56#include <netinet/if_ether.h>
57
58#include <netgraph/ng_message.h>
59#include <netgraph/netgraph.h>
60#include <netgraph/ng_parse.h>
61#include <netgraph/ng_cisco.h>
62
63#define CISCO_MULTICAST 0x8f /* Cisco multicast address */
64#define CISCO_UNICAST 0x0f /* Cisco unicast address */
65#define CISCO_KEEPALIVE 0x8035 /* Cisco keepalive protocol */
66#define CISCO_ADDR_REQ 0 /* Cisco address request */
67#define CISCO_ADDR_REPLY 1 /* Cisco address reply */
68#define CISCO_KEEPALIVE_REQ 2 /* Cisco keepalive request */
69
70#define KEEPALIVE_SECS 10
71
73 uint8_t address;
74 uint8_t control;
75 uint16_t protocol;
77
78#define CISCO_HEADER_LEN sizeof (struct cisco_header)
79
81 uint32_t type;
82 uint32_t par1;
83 uint32_t par2;
84 uint16_t rel;
85 uint16_t time0;
86 uint16_t time1;
87} __packed;
88
89#define CISCO_PACKET_LEN (sizeof(struct cisco_packet))
90
91struct protoent {
92 hook_p hook; /* the hook for this proto */
93 uint16_t af; /* address family, -1 = downstream */
94};
95
96struct cisco_priv {
97 uint32_t local_seq;
98 uint32_t remote_seq;
99 uint32_t seqRetries; /* how many times we've been here throwing out
100 * the same sequence number without ack */
102 struct callout handle;
104 struct protoent inet; /* IP information */
105 struct in_addr localip;
106 struct in_addr localmask;
107 struct protoent inet6; /* IPv6 information */
108 struct protoent atalk; /* AppleTalk information */
109 struct protoent ipx; /* IPX information */
110};
111typedef struct cisco_priv *sc_p;
112
113/* Netgraph methods */
120
121/* Other functions */
122static int cisco_input(sc_p sc, item_p item);
123static void cisco_keepalive(node_p node, hook_p hook, void *arg1, int arg2);
124static int cisco_send(sc_p sc, int type, long par1, long par2);
125static void cisco_notify(sc_p sc, uint32_t cmd);
126
127/* Parse type for struct ng_cisco_ipaddr */
130static const struct ng_parse_type ng_cisco_ipaddr_type = {
133};
134
135/* Parse type for struct ng_async_stat */
138static const struct ng_parse_type ng_cisco_stats_type = {
141};
142
143/* List of commands and how to convert arguments to/from ASCII */
144static const struct ng_cmdlist ng_cisco_cmdlist[] = {
145 {
148 "setipaddr",
150 NULL
151 },
152 {
155 "getipaddr",
156 NULL,
158 },
159 {
162 "getstats",
163 NULL,
165 },
166 { 0 }
167};
168
169/* Node type */
170static struct ng_type typestruct = {
172 .name = NG_CISCO_NODE_TYPE,
173 .constructor = cisco_constructor,
174 .rcvmsg = cisco_rcvmsg,
175 .shutdown = cisco_shutdown,
176 .newhook = cisco_newhook,
177 .rcvdata = cisco_rcvdata,
178 .disconnect = cisco_disconnect,
179 .cmdlist = ng_cisco_cmdlist,
180};
182
183/*
184 * Node constructor
185 */
186static int
188{
189 sc_p sc;
190
191 sc = malloc(sizeof(*sc), M_NETGRAPH, M_WAITOK | M_ZERO);
192
193 ng_callout_init(&sc->handle);
194 NG_NODE_SET_PRIVATE(node, sc);
195 sc->node = node;
196
197 /* Initialise the varous protocol hook holders */
198 sc->downstream.af = 0xffff;
199 sc->inet.af = AF_INET;
200 sc->inet6.af = AF_INET6;
201 sc->atalk.af = AF_APPLETALK;
202 sc->ipx.af = AF_IPX;
203 return (0);
204}
205
206/*
207 * Check new hook
208 */
209static int
210cisco_newhook(node_p node, hook_p hook, const char *name)
211{
212 const sc_p sc = NG_NODE_PRIVATE(node);
213
214 if (strcmp(name, NG_CISCO_HOOK_DOWNSTREAM) == 0) {
215 sc->downstream.hook = hook;
216 NG_HOOK_SET_PRIVATE(hook, &sc->downstream);
217
218 /* Start keepalives */
219 ng_callout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
220 &cisco_keepalive, (void *)sc, 0);
221 } else if (strcmp(name, NG_CISCO_HOOK_INET) == 0) {
222 sc->inet.hook = hook;
223 NG_HOOK_SET_PRIVATE(hook, &sc->inet);
224 } else if (strcmp(name, NG_CISCO_HOOK_INET6) == 0) {
225 sc->inet6.hook = hook;
226 NG_HOOK_SET_PRIVATE(hook, &sc->inet6);
227 } else if (strcmp(name, NG_CISCO_HOOK_APPLETALK) == 0) {
228 sc->atalk.hook = hook;
229 NG_HOOK_SET_PRIVATE(hook, &sc->atalk);
230 } else if (strcmp(name, NG_CISCO_HOOK_IPX) == 0) {
231 sc->ipx.hook = hook;
232 NG_HOOK_SET_PRIVATE(hook, &sc->ipx);
233 } else if (strcmp(name, NG_CISCO_HOOK_DEBUG) == 0) {
234 NG_HOOK_SET_PRIVATE(hook, NULL); /* unimplemented */
235 } else
236 return (EINVAL);
237 return 0;
238}
239
240/*
241 * Receive control message.
242 */
243static int
244cisco_rcvmsg(node_p node, item_p item, hook_p lasthook)
245{
246 struct ng_mesg *msg;
247 const sc_p sc = NG_NODE_PRIVATE(node);
248 struct ng_mesg *resp = NULL;
249 int error = 0;
250
251 NGI_GET_MSG(item, msg);
252 switch (msg->header.typecookie) {
254 switch (msg->header.cmd) {
255 case NGM_TEXT_STATUS:
256 {
257 char *arg;
258 int pos;
259
260 NG_MKRESPONSE(resp, msg, NG_TEXTRESPONSE, M_NOWAIT);
261 if (resp == NULL) {
262 error = ENOMEM;
263 break;
264 }
265 arg = (char *) resp->data;
266 pos = sprintf(arg,
267 "keepalive period: %d sec; ", KEEPALIVE_SECS);
268 pos += sprintf(arg + pos,
269 "unacknowledged keepalives: %d", sc->seqRetries);
270 resp->header.arglen = pos + 1;
271 break;
272 }
273 default:
274 error = EINVAL;
275 break;
276 }
277 break;
278 case NGM_CISCO_COOKIE:
279 switch (msg->header.cmd) {
280 case NGM_CISCO_GET_IPADDR: /* could be a late reply! */
281 if ((msg->header.flags & NGF_RESP) == 0) {
282 struct in_addr *ips;
283
284 NG_MKRESPONSE(resp, msg,
285 2 * sizeof(*ips), M_NOWAIT);
286 if (!resp) {
287 error = ENOMEM;
288 break;
289 }
290 ips = (struct in_addr *) resp->data;
291 ips[0] = sc->localip;
292 ips[1] = sc->localmask;
293 break;
294 }
295 /* FALLTHROUGH */ /* ...if it's a reply */
297 {
298 struct in_addr *const ips = (struct in_addr *)msg->data;
299
300 if (msg->header.arglen < 2 * sizeof(*ips)) {
301 error = EINVAL;
302 break;
303 }
304 sc->localip = ips[0];
305 sc->localmask = ips[1];
306 break;
307 }
309 {
310 struct ng_cisco_stats *stat;
311
312 NG_MKRESPONSE(resp, msg, sizeof(*stat), M_NOWAIT);
313 if (!resp) {
314 error = ENOMEM;
315 break;
316 }
317 stat = (struct ng_cisco_stats *)resp->data;
318 stat->seqRetries = sc->seqRetries;
320 break;
321 }
322 default:
323 error = EINVAL;
324 break;
325 }
326 break;
327 default:
328 error = EINVAL;
329 break;
330 }
331 NG_RESPOND_MSG(error, node, item, resp);
332 NG_FREE_MSG(msg);
333 return (error);
334}
335
336/*
337 * Receive data
338 */
339static int
341{
342 const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
343 struct protoent *pep;
344 struct cisco_header *h;
345 struct mbuf *m;
346 int error = 0;
347
348 if ((pep = NG_HOOK_PRIVATE(hook)) == NULL)
349 goto out;
350
351 /* If it came from our downlink, deal with it separately */
352 if (pep->af == 0xffff)
353 return (cisco_input(sc, item));
354
355 /* OK so it came from a protocol, heading out. Prepend general data
356 packet header. For now, IP,IPX only */
357 NGI_GET_M(item, m);
358 M_PREPEND(m, CISCO_HEADER_LEN, M_NOWAIT);
359 if (!m) {
360 error = ENOBUFS;
361 goto out;
362 }
363 NGI_M(item) = m;
364 h = mtod(m, struct cisco_header *);
366 h->control = 0;
367
368 switch (pep->af) {
369 case AF_INET: /* Internet Protocol */
370 h->protocol = htons(ETHERTYPE_IP);
371 break;
372 case AF_INET6:
373 h->protocol = htons(ETHERTYPE_IPV6);
374 break;
375 case AF_APPLETALK: /* AppleTalk Protocol */
376 h->protocol = htons(ETHERTYPE_AT);
377 break;
378 case AF_IPX: /* Novell IPX Protocol */
379 h->protocol = htons(ETHERTYPE_IPX);
380 break;
381 default:
382 error = EAFNOSUPPORT;
383 goto out;
384 }
385
386 /* Send it */
387 NG_FWD_NEW_DATA(error, item, sc->downstream.hook, m);
388 return (error);
389
390out:
391 NG_FREE_ITEM(item);
392 return (error);
393}
394
395/*
396 * Shutdown node
397 */
398static int
400{
401 const sc_p sc = NG_NODE_PRIVATE(node);
402
403 NG_NODE_SET_PRIVATE(node, NULL);
404 NG_NODE_UNREF(sc->node);
405 free(sc, M_NETGRAPH);
406 return (0);
407}
408
409/*
410 * Disconnection of a hook
411 *
412 * For this type, removal of the last link destroys the node
413 */
414static int
416{
417 const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
418 struct protoent *pep;
419
420 /* Check it's not the debug hook */
421 if ((pep = NG_HOOK_PRIVATE(hook))) {
422 pep->hook = NULL;
423 if (pep->af == 0xffff)
424 /* If it is the downstream hook, stop the timers */
425 ng_uncallout(&sc->handle, NG_HOOK_NODE(hook));
426 }
427
428 /* If no more hooks, remove the node */
432 return (0);
433}
434
435/*
436 * Receive data
437 */
438static int
440{
441 const struct cisco_header *h;
442 struct cisco_header hdrbuf;
443 struct protoent *pep;
444 struct mbuf *m;
445 int error = 0;
446
447 /* Get data */
448 m = NGI_M(item);
449
450 /* Sanity check header length */
451 if (m->m_pkthdr.len < sizeof(*h)) {
452 error = EINVAL;
453 goto drop;
454 }
455
456 /* Get cisco header */
457 if (m->m_len >= sizeof(*h)) /* the common case */
458 h = mtod(m, const struct cisco_header *);
459 else {
460 m_copydata(m, 0, sizeof(*h), (caddr_t)&hdrbuf);
461 h = &hdrbuf;
462 }
463 m_adj(m, sizeof(*h));
464
465 /* Check header address */
466 switch (h->address) {
467 default: /* Invalid Cisco packet. */
468 goto drop;
469 case CISCO_UNICAST:
470 case CISCO_MULTICAST:
471 /* Don't check the control field here (RFC 1547). */
472 switch (ntohs(h->protocol)) {
473 default:
474 goto drop;
475 case CISCO_KEEPALIVE:
476 {
477 const struct cisco_packet *p;
478 struct cisco_packet pktbuf;
479
480 /* Sanity check packet length */
481 if (m->m_pkthdr.len < sizeof(*p)) {
482 error = EINVAL;
483 goto drop;
484 }
485
486 /* Get cisco packet */
487 if (m->m_len >= sizeof(*p)) /* the common case */
488 p = mtod(m, const struct cisco_packet *);
489 else {
490 m_copydata(m, 0, sizeof(*p), (caddr_t)&pktbuf);
491 p = &pktbuf;
492 }
493
494 /* Check packet type */
495 switch (ntohl(p->type)) {
496 default:
497 log(LOG_WARNING,
498 "cisco: unknown cisco packet type: 0x%lx\n",
499 (long)ntohl(p->type));
500 break;
501 case CISCO_ADDR_REPLY:
502 /* Reply on address request, ignore */
503 break;
505 sc->remote_seq = ntohl(p->par1);
506 if (sc->local_seq == ntohl(p->par2)) {
507 sc->local_seq++;
508 if (sc->seqRetries > 1)
510 sc->seqRetries = 0;
511 }
512 break;
513 case CISCO_ADDR_REQ:
514 {
515 struct ng_mesg *msg;
516 int dummy_error = 0;
517
518 /* Ask inet peer for IP address information */
519 if (sc->inet.hook == NULL)
520 goto nomsg;
522 NGM_CISCO_GET_IPADDR, 0, M_NOWAIT);
523 if (msg == NULL)
524 goto nomsg;
525 NG_SEND_MSG_HOOK(dummy_error,
526 sc->node, msg, sc->inet.hook, 0);
527 /*
528 * XXX Now maybe we should set a flag telling
529 * our receiver to send this message when the response comes in
530 * instead of now when the data may be bad.
531 */
532 nomsg:
533 /* Send reply to peer device */
534 error = cisco_send(sc, CISCO_ADDR_REPLY,
535 ntohl(sc->localip.s_addr),
536 ntohl(sc->localmask.s_addr));
537 break;
538 }
539 }
540 goto drop;
541 }
542 case ETHERTYPE_IP:
543 pep = &sc->inet;
544 break;
545 case ETHERTYPE_IPV6:
546 pep = &sc->inet6;
547 break;
548 case ETHERTYPE_AT:
549 pep = &sc->atalk;
550 break;
551 case ETHERTYPE_IPX:
552 pep = &sc->ipx;
553 break;
554 }
555 break;
556 }
557
558 /* Drop if payload is empty */
559 if (m->m_pkthdr.len == 0) {
560 error = EINVAL;
561 goto drop;
562 }
563
564 /* Send it on */
565 if (pep->hook == NULL)
566 goto drop;
567 NG_FWD_NEW_DATA(error, item, pep->hook, m);
568 return (error);
569
570drop:
571 NG_FREE_ITEM(item);
572 return (error);
573}
574
575/*
576 * Send keepalive packets, every 10 seconds.
577 */
578static void
579cisco_keepalive(node_p node, hook_p hook, void *arg1, int arg2)
580{
581 const sc_p sc = arg1;
582
583 cisco_send(sc, CISCO_KEEPALIVE_REQ, sc->local_seq, sc->remote_seq);
584 if (sc->seqRetries++ > 1)
586 ng_callout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
587 &cisco_keepalive, (void *)sc, 0);
588}
589
590/*
591 * Send Cisco keepalive packet.
592 */
593static int
594cisco_send(sc_p sc, int type, long par1, long par2)
595{
596 struct cisco_header *h;
597 struct cisco_packet *ch;
598 struct mbuf *m;
599 struct timeval time;
600 uint32_t t;
601 int error = 0;
602
603 getmicrouptime(&time);
604
605 MGETHDR(m, M_NOWAIT, MT_DATA);
606 if (!m)
607 return (ENOBUFS);
608
609 t = time.tv_sec * 1000 + time.tv_usec / 1000;
610 m->m_pkthdr.len = m->m_len = CISCO_HEADER_LEN + CISCO_PACKET_LEN;
611 m->m_pkthdr.rcvif = 0;
612
613 h = mtod(m, struct cisco_header *);
615 h->control = 0;
616 h->protocol = htons(CISCO_KEEPALIVE);
617
618 ch = (struct cisco_packet *) (h + 1);
619 ch->type = htonl(type);
620 ch->par1 = htonl(par1);
621 ch->par2 = htonl(par2);
622 ch->rel = -1;
623 ch->time0 = htons((uint16_t) (t >> 16));
624 ch->time1 = htons((uint16_t) t);
625
626 NG_SEND_DATA_ONLY(error, sc->downstream.hook, m);
627 return (error);
628}
629
630/*
631 * Send linkstate to upstream node.
632 */
633static void
634cisco_notify(sc_p sc, uint32_t cmd)
635{
636 struct ng_mesg *msg;
637 int dummy_error = 0;
638
639 if (sc->inet.hook == NULL) /* nothing to notify */
640 return;
641
642 NG_MKMESSAGE(msg, NGM_FLOW_COOKIE, cmd, 0, M_NOWAIT);
643 if (msg != NULL)
644 NG_SEND_MSG_HOOK(dummy_error, sc->node, msg, sc->inet.hook, 0);
645}
#define NGI_M(i)
Definition: netgraph.h:833
#define NG_HOOK_NODE(hook)
Definition: netgraph.h:339
int ng_rcvmsg_t(node_p node, item_p item, hook_p lasthook)
Definition: netgraph.h:105
int ng_disconnect_t(hook_p hook)
Definition: netgraph.h:107
#define NG_NODE_SET_PRIVATE(node, val)
Definition: netgraph.h:608
#define NG_RESPOND_MSG(error, here, item, resp)
Definition: netgraph.h:1025
#define NG_NODE_IS_VALID(node)
Definition: netgraph.h:610
#define NG_NODE_UNREF(node)
Definition: netgraph.h:607
#define NG_HOOK_SET_PRIVATE(hook, val)
Definition: netgraph.h:333
int ng_rmnode_self(node_p here)
Definition: ng_base.c:1609
#define ng_callout_init(c)
Definition: netgraph.h:1168
#define NG_FWD_NEW_DATA(error, item, hook, m)
Definition: netgraph.h:914
#define NG_SEND_DATA_ONLY(error, hook, m)
Definition: netgraph.h:932
int ng_rcvdata_t(hook_p hook, item_p item)
Definition: netgraph.h:106
int ng_shutdown_t(node_p node)
Definition: netgraph.h:101
int ng_uncallout(struct callout *c, node_p node)
Definition: ng_base.c:3840
#define NG_FREE_ITEM(item)
Definition: netgraph.h:847
int ng_constructor_t(node_p node)
Definition: netgraph.h:99
#define NGI_GET_M(i, m)
Definition: netgraph.h:852
#define NG_FREE_MSG(msg)
Definition: netgraph.h:938
#define NG_ABI_VERSION
Definition: netgraph.h:77
#define NG_NODE_NUMHOOKS(node)
Definition: netgraph.h:615
#define NGI_GET_MSG(i, m)
Definition: netgraph.h:858
#define NG_NODE_PRIVATE(node)
Definition: netgraph.h:609
#define NG_SEND_MSG_HOOK(error, here, msg, hook, retaddr)
Definition: netgraph.h:958
int ng_callout(struct callout *c, node_p node, hook_p hook, int ticks, ng_item_fn *fn, void *arg1, int arg2)
Definition: ng_base.c:3789
int ng_newhook_t(node_p node, hook_p hook, const char *name)
Definition: netgraph.h:102
#define NG_HOOK_PRIVATE(hook)
Definition: netgraph.h:336
u_int8_t type
struct cisco_header __packed
static const struct ng_parse_struct_field ng_cisco_stats_type_fields[]
Definition: ng_cisco.c:137
static void cisco_keepalive(node_p node, hook_p hook, void *arg1, int arg2)
Definition: ng_cisco.c:579
#define CISCO_PACKET_LEN
Definition: ng_cisco.c:89
static const struct ng_parse_type ng_cisco_stats_type
Definition: ng_cisco.c:138
static int cisco_input(sc_p sc, item_p item)
Definition: ng_cisco.c:439
#define CISCO_ADDR_REPLY
Definition: ng_cisco.c:67
static const struct ng_cmdlist ng_cisco_cmdlist[]
Definition: ng_cisco.c:144
#define CISCO_KEEPALIVE_REQ
Definition: ng_cisco.c:68
static ng_shutdown_t cisco_shutdown
Definition: ng_cisco.c:116
#define KEEPALIVE_SECS
Definition: ng_cisco.c:70
static const struct ng_parse_struct_field ng_cisco_ipaddr_type_fields[]
Definition: ng_cisco.c:129
#define CISCO_MULTICAST
Definition: ng_cisco.c:63
static ng_newhook_t cisco_newhook
Definition: ng_cisco.c:117
static ng_rcvdata_t cisco_rcvdata
Definition: ng_cisco.c:118
static ng_constructor_t cisco_constructor
Definition: ng_cisco.c:114
static struct ng_type typestruct
Definition: ng_cisco.c:170
static int cisco_send(sc_p sc, int type, long par1, long par2)
Definition: ng_cisco.c:594
#define CISCO_HEADER_LEN
Definition: ng_cisco.c:78
static ng_disconnect_t cisco_disconnect
Definition: ng_cisco.c:119
NETGRAPH_INIT(cisco, &typestruct)
#define CISCO_UNICAST
Definition: ng_cisco.c:64
#define CISCO_KEEPALIVE
Definition: ng_cisco.c:65
#define CISCO_ADDR_REQ
Definition: ng_cisco.c:66
static const struct ng_parse_type ng_cisco_ipaddr_type
Definition: ng_cisco.c:130
static ng_rcvmsg_t cisco_rcvmsg
Definition: ng_cisco.c:115
static void cisco_notify(sc_p sc, uint32_t cmd)
Definition: ng_cisco.c:634
struct cisco_priv * sc_p
Definition: ng_cisco.c:111
#define NG_CISCO_HOOK_DOWNSTREAM
Definition: ng_cisco.h:52
#define NGM_CISCO_COOKIE
Definition: ng_cisco.h:49
#define NG_CISCO_HOOK_DEBUG
Definition: ng_cisco.h:57
#define NG_CISCO_HOOK_INET6
Definition: ng_cisco.h:54
#define NG_CISCO_IPADDR_TYPE_INFO
Definition: ng_cisco.h:72
#define NG_CISCO_HOOK_INET
Definition: ng_cisco.h:53
@ NGM_CISCO_GET_IPADDR
Definition: ng_cisco.h:62
@ NGM_CISCO_SET_IPADDR
Definition: ng_cisco.h:61
@ NGM_CISCO_GET_STATUS
Definition: ng_cisco.h:63
#define NG_CISCO_HOOK_APPLETALK
Definition: ng_cisco.h:55
#define NG_CISCO_HOOK_IPX
Definition: ng_cisco.h:56
#define NG_CISCO_NODE_TYPE
Definition: ng_cisco.h:48
#define NG_CISCO_STATS_TYPE_INFO
Definition: ng_cisco.h:84
#define NG_MKRESPONSE(rsp, msg, len, how)
Definition: ng_message.h:396
#define NGM_LINK_IS_DOWN
Definition: ng_message.h:156
#define NG_TEXTRESPONSE
Definition: ng_message.h:54
#define NGM_GENERIC_COOKIE
Definition: ng_message.h:113
#define NGF_RESP
Definition: ng_message.h:101
#define NGM_FLOW_COOKIE
Definition: ng_message.h:152
#define NGM_LINK_IS_UP
Definition: ng_message.h:155
#define NG_MKMESSAGE(msg, cookie, cmdid, len, how)
Definition: ng_message.h:378
@ NGM_TEXT_STATUS
Definition: ng_message.h:134
const struct ng_parse_type ng_parse_struct_type
Definition: ng_parse.c:222
char *const name
Definition: ng_ppp.c:261
cmd
Definition: ng_pppoe.h:74
uint8_t address
Definition: ng_cisco.c:73
uint8_t control
Definition: ng_cisco.c:74
uint16_t protocol
Definition: ng_cisco.c:75
uint32_t par2
Definition: ng_cisco.c:83
uint16_t rel
Definition: ng_cisco.c:84
uint16_t time0
Definition: ng_cisco.c:85
uint32_t par1
Definition: ng_cisco.c:82
uint16_t time1
Definition: ng_cisco.c:86
uint32_t type
Definition: ng_cisco.c:81
struct protoent inet
Definition: ng_cisco.c:104
uint32_t local_seq
Definition: ng_cisco.c:97
uint32_t remote_seq
Definition: ng_cisco.c:98
struct in_addr localmask
Definition: ng_cisco.c:106
struct protoent inet6
Definition: ng_cisco.c:107
struct protoent atalk
Definition: ng_cisco.c:108
struct protoent downstream
Definition: ng_cisco.c:103
struct protoent ipx
Definition: ng_cisco.c:109
node_p node
Definition: ng_cisco.c:101
struct in_addr localip
Definition: ng_cisco.c:105
uint32_t seqRetries
Definition: ng_cisco.c:99
struct callout handle
Definition: ng_cisco.c:102
uint32_t seqRetries
Definition: ng_cisco.h:79
uint32_t keepAlivePeriod
Definition: ng_cisco.h:80
u_int32_t arglen
Definition: ng_message.h:62
u_int32_t typecookie
Definition: ng_message.h:66
u_int32_t flags
Definition: ng_message.h:64
struct ng_mesg::ng_msghdr header
char data[]
Definition: ng_message.h:69
u_int32_t version
Definition: netgraph.h:1077
hook_p hook
Definition: ng_cisco.c:92
uint16_t af
Definition: ng_cisco.c:93