diff options
Diffstat (limited to 'sys/netccitt/pk_llcsubr.c')
-rw-r--r-- | sys/netccitt/pk_llcsubr.c | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/sys/netccitt/pk_llcsubr.c b/sys/netccitt/pk_llcsubr.c index a1e18ade97c1..be18dafbcc72 100644 --- a/sys/netccitt/pk_llcsubr.c +++ b/sys/netccitt/pk_llcsubr.c @@ -1,9 +1,9 @@ -/* - * Copyright (C) Dirk Husemann, Computer Science Department IV, +/* + * Copyright (C) Dirk Husemann, Computer Science Department IV, * University of Erlangen-Nuremberg, Germany, 1990, 1991, 1992 * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. - * + * * This code is derived from software contributed to Berkeley by * Dirk Husemann and the Computer Science Department (IV) of * the University of Erlangen-Nuremberg, Germany. @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * @(#)pk_llcsubr.c 8.1 (Berkeley) 6/10/93 - * $Id: pk_llcsubr.c,v 1.2 1994/08/02 07:47:36 davidg Exp $ + * $Id: pk_llcsubr.c,v 1.3 1994/12/13 22:32:16 wollman Exp $ */ #include <sys/param.h> @@ -84,7 +84,7 @@ * * HDLC uses the DTE-DCE model of X.25, therefore we need a many-to-one * relationship, i.e.: - * + * * {X.121_a, X.121_b, X.121_c, ..., X.121_i} -> pkcb_0 * * LLC2 utilizes the DTE-DTE model of X.25, resulting effectively in a @@ -94,18 +94,18 @@ * {X.121_k} -> pkcb_1b * ... * {X.121_q} -> pkcb_1q - * + * * It might make sense to allow a many-to-one relation for LLC2 also, - * + * * {X.121_r, X.121_s, X.121_t, X.121_u} -> pkcb_2a * * This would make addresses X.121_[r-u] essentially aliases of one * address ({X.121_[r-u]} would constitute a representative set). * * Each one-to-one relation must obviously be entered individually with - * a route add command, whereas a many-to-one relationship can be + * a route add command, whereas a many-to-one relationship can be * either entered individually or generated by using a netmask. - * + * * To facilitate dealings the many-to-one case for LLC2 can only be * established via a netmask. * @@ -137,7 +137,7 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) switch(cmd) { case RTM_RESOLVE: case RTM_ADD: - if (pkp) + if (pkp) return(EEXIST); if (rt->rt_flags & RTF_GATEWAY) { @@ -149,21 +149,21 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) } /* * Assumptions: (1) ifnet structure is filled in - * (2) at least the pkcb created via - * x25config (ifconfig?) has been + * (2) at least the pkcb created via + * x25config (ifconfig?) has been * set up already. - * (3) HDLC interfaces have an if_type of - * IFT_X25{,DDN}, LLC2 interfaces - * anything else (any better way to + * (3) HDLC interfaces have an if_type of + * IFT_X25{,DDN}, LLC2 interfaces + * anything else (any better way to * do this?) * */ if (!rt->rt_ifa) return (ENETDOWN); - - /* + + /* * We differentiate between dealing with a many-to-one - * (HDLC: DTE-DCE) and a one-to-one (LLC2: DTE-DTE) + * (HDLC: DTE-DCE) and a one-to-one (LLC2: DTE-DTE) * relationship (by looking at the if type). * * Only in case of the many-to-one relationship (HDLC) @@ -172,19 +172,19 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) * future route additions (the rtentry->rt_llinfo pointer * points to the pkcb allocated for that route). * - * In case of the one-to-one relationship (LLC2) we + * In case of the one-to-one relationship (LLC2) we * create a new pkcb (via pk_newlink()) for each new rtentry. - * + * * NOTE: Only in case of HDLC does ia->ia_pkcb point - * to a pkcb, in the LLC2 case it doesn't (as we don't + * to a pkcb, in the LLC2 case it doesn't (as we don't * need it here)! */ one_to_one = ISISO8802(rt->rt_ifp); - if (!(pkp = XIFA(rt)->ia_pkcb) && !one_to_one) - XIFA(rt)->ia_pkcb = pkp = + if (!(pkp = XIFA(rt)->ia_pkcb) && !one_to_one) + XIFA(rt)->ia_pkcb = pkp = pk_newlink(XIFA(rt), (caddr_t) 0); - else if (one_to_one && + else if (one_to_one && !equal(rt->rt_gateway, rt->rt_ifa->ifa_addr)) { pkp = pk_newlink(XIFA(rt), (caddr_t) 0); /* @@ -206,7 +206,7 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) { /* * The pkp might be empty if we are dealing - * with an interface route entry for LLC2, in this + * with an interface route entry for LLC2, in this * case we don't need to do anything ... */ if (pkp) { @@ -215,12 +215,12 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) RTFREE((struct rtentry *)rt->rt_llinfo); return(0); } - + if (pkp->pk_llrt) npaidb_destroy(pkp->pk_llrt); pk_dellink (pkp); - + return(0); } } @@ -228,33 +228,33 @@ cons_rtrequest(int cmd, struct rtentry *rt, struct sockaddr *dst) } /* - * Network Protocol Addressing Information DataBase (npaidb) - * - * To speed up locating the entity dealing with an LLC packet use is made - * of a routing tree. This npaidb routing tree is handled - * by the normal rn_*() routines just like (almost) any other routing tree. - * - * The mapping being done by the npaidb_*() routines is as follows: - * - * Key: MAC,LSAP (enhancing struct sockaddr_dl) - * Gateway: sockaddr_x25 (i.e. X.25 address - X.121 or NSAP) - * Llinfo: npaidbentry { - * struct llc_linkcb *npaidb_linkp; - * struct rtentry *npaidb_rt; - * } - * - * Using the npaidbentry provided by llinfo we can then access - * + * Network Protocol Addressing Information DataBase (npaidb) + * + * To speed up locating the entity dealing with an LLC packet use is made + * of a routing tree. This npaidb routing tree is handled + * by the normal rn_*() routines just like (almost) any other routing tree. + * + * The mapping being done by the npaidb_*() routines is as follows: + * + * Key: MAC,LSAP (enhancing struct sockaddr_dl) + * Gateway: sockaddr_x25 (i.e. X.25 address - X.121 or NSAP) + * Llinfo: npaidbentry { + * struct llc_linkcb *npaidb_linkp; + * struct rtentry *npaidb_rt; + * } + * + * Using the npaidbentry provided by llinfo we can then access + * * o the pkcb by using (struct pkcb *) (npaidb_rt->rt_llinfo) - * o the linkcb via npaidb_linkp - * - * The following functions are provided - * - * o npaidb_enter(struct sockaddr_dl *sdl, struct sockaddr_x25 *sx25, - * struct struct llc_linkcb *link, struct rtentry *rt) - * - * o npaidb_enrich(short type, caddr_t info) - * + * o the linkcb via npaidb_linkp + * + * The following functions are provided + * + * o npaidb_enter(struct sockaddr_dl *sdl, struct sockaddr_x25 *sx25, + * struct struct llc_linkcb *link, struct rtentry *rt) + * + * o npaidb_enrich(short type, caddr_t info) + * */ struct sockaddr_dl npdl_netmask = { @@ -266,7 +266,7 @@ struct sockaddr_dl npdl_netmask = { -1, /* _alen */ -1, /* _slen */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, /* _data */ -}; +}; struct sockaddr npdl_dummy; int npdl_datasize = sizeof(struct sockaddr_dl)- @@ -284,15 +284,15 @@ npaidb_enter(struct sockaddr_dl *key, struct sockaddr *value, register u_int size = sizeof(struct npaidbentry); register u_char saploc = LLSAPLOC(key, rt->rt_ifp); - /* + /* * set up netmask: LLC2 packets have the lowest bit set in * response packets (e.g. 0x7e for command packets, 0x7f for * response packets), to facilitate the lookup we use a netmask - * of 11111110 for the SAP position. The remaining positions + * of 11111110 for the SAP position. The remaining positions * are zeroed out. */ npdl_netmask.sdl_data[saploc] = NPDL_SAPNETMASK; - bzero((caddr_t)&npdl_netmask.sdl_data[saploc+1], + bzero((caddr_t)&npdl_netmask.sdl_data[saploc+1], npdl_datasize-saploc-1); if (value == 0) @@ -326,12 +326,12 @@ npaidb_enrich(short type, caddr_t info, struct sockaddr_dl *sdl) rt->rt_refcnt--; switch (type) { case NPAIDB_LINK: - ((struct npaidbentry *)(rt->rt_llinfo))->np_link = + ((struct npaidbentry *)(rt->rt_llinfo))->np_link = (struct llc_linkcb *) info; break; } return rt; - } + } return ((struct rtentry *) 0); @@ -341,9 +341,9 @@ npaidb_destroy(struct rtentry *rt) { USES_AF_LINK_RTS; - if (rt->rt_llinfo) + if (rt->rt_llinfo) free((caddr_t) rt->rt_llinfo, M_PCB); - return(rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), + return(rtrequest(RTM_DELETE, rt_key(rt), rt->rt_gateway, rt_mask(rt), 0, 0)); } @@ -358,7 +358,7 @@ x25_llcglue(int prc, struct sockaddr *addr) register struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)addr; register struct x25_ifaddr *x25ifa; struct dll_ctlinfo ctlinfo; - + if((x25ifa = (struct x25_ifaddr *)ifa_ifwithaddr(addr)) == 0) return 0; |