diff options
Diffstat (limited to 'sys/netccitt/llc_input.c')
-rw-r--r-- | sys/netccitt/llc_input.c | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/sys/netccitt/llc_input.c b/sys/netccitt/llc_input.c index 1ee073b03dc..7bc5ea257a9 100644 --- a/sys/netccitt/llc_input.c +++ b/sys/netccitt/llc_input.c @@ -1,4 +1,5 @@ -/* $NetBSD: llc_input.c,v 1.2 1994/06/29 06:37:21 cgd Exp $ */ +/* $OpenBSD: llc_input.c,v 1.2 1996/03/04 07:36:30 niklas Exp $ */ +/* $NetBSD: llc_input.c,v 1.3 1996/02/13 22:04:44 christos Exp $ */ /* * Copyright (C) Dirk Husemann, Computer Science Department IV, @@ -59,6 +60,8 @@ #include <netccitt/dll.h> #include <netccitt/llc_var.h> +#include <machine/stdarg.h> + /* * This module implements LLC as specified by ISO 8802-2. */ @@ -76,11 +79,9 @@ llcintr() register int frame_kind; register u_char cmdrsp; struct llc_linkcb *linkp; - struct rtentry *sirt; - struct npaidbentry *sapinfo; + struct npaidbentry *sapinfo = NULL; struct sdl_hdr *sdlhdr; struct llc *frame; - char *c; long expected_len; struct ifnet *ifp; @@ -180,10 +181,12 @@ llcintr() */ cmdrsp = (frame->llc_ssap & 0x01); frame->llc_ssap &= ~0x01; - if (llrt = rtalloc1((struct sockaddr *)&sdlhdr->sdlhdr_src, 0)) + llrt = rtalloc1((struct sockaddr *)&sdlhdr->sdlhdr_src, 0); + if (llrt) llrt->rt_refcnt--; #ifdef notyet - else llrt = npaidb_enter(&sdlhdr->sdlhdr_src, 0, 0, 0); + else + llrt = npaidb_enter(&sdlhdr->sdlhdr_src, 0, 0, 0); #endif /* notyet */ else { /* @@ -283,7 +286,7 @@ llcintr() /* * Pass it on thru the elements of procedure */ - llc_input(linkp, m, cmdrsp); + llc_input(m, linkp, cmdrsp); } return; } @@ -302,13 +305,28 @@ llcintr() * o ... * are then enacted accordingly. */ -llc_input(struct llc_linkcb *linkp, struct mbuf *m, u_char cmdrsp) +int +#if __STDC__ +llc_input(struct mbuf *m, ...) +#else +llc_input(m, va_alist) + struct mbuf *m; + va_dcl +#endif { int frame_kind; int pollfinal; int action = 0; struct llc *frame; - struct ifnet *ifp = linkp->llcl_if; + struct llc_linkcb *linkp; + u_int cmdrsp; + va_list ap; + + va_start(ap, m); + linkp = va_arg(ap, struct llc_linkcb *); + cmdrsp = va_arg(ap, u_int); + va_end(ap); + if ((frame = mtod(m, struct llc *)) == (struct llc *) 0) { m_freem(m); @@ -327,9 +345,9 @@ llc_input(struct llc_linkcb *linkp, struct mbuf *m, u_char cmdrsp) pollfinal)) { case LLC_DATA_INDICATION: m_adj(m, LLC_ISFRAMELEN); - if (m = m_pullup(m, NLHDRSIZEGUESS)) { + if ((m = m_pullup(m, NLHDRSIZEGUESS)) != NULL) { m->m_pkthdr.rcvif = (struct ifnet *)linkp->llcl_nlnext; - (*linkp->llcl_sapinfo->si_input)(m); + (*linkp->llcl_sapinfo->si_input)(m, NULL, NULL, NULL); } break; } @@ -348,18 +366,21 @@ llc_input(struct llc_linkcb *linkp, struct mbuf *m, u_char cmdrsp) * This routine is called by configuration setup. It sets up a station control * block and notifies all registered upper level protocols. */ -caddr_t -llc_ctlinput(int prc, struct sockaddr *addr, caddr_t info) +void * +llc_ctlinput(prc, addr, info) + int prc; + struct sockaddr *addr; + void *info; { - struct ifnet *ifp; + struct ifnet *ifp = NULL; struct ifaddr *ifa; struct dll_ctlinfo *ctlinfo = (struct dll_ctlinfo *)info; u_char sap; struct dllconfig *config; caddr_t pcb; struct rtentry *nlrt; - struct rtentry *llrt; - struct llc_linkcb *linkp; + struct rtentry *llrt = NULL; + struct llc_linkcb *linkp = NULL; register int i; /* info must point to something valid at all times */ @@ -412,7 +433,7 @@ llc_ctlinput(int prc, struct sockaddr *addr, caddr_t info) linkp = LQFIRST; while (LQVALID(linkp)) { nlinkp = LQNEXT(linkp); - if (linkp->llcl_if = ifp) { + if ((linkp->llcl_if = ifp) != NULL) { i = splimp(); (void)llc_statehandler(linkp, (struct llc *)0, NL_DISCONNECT_REQUEST, |