From: chas w. <ch...@us...> - 2005-10-06 15:40:06
|
Update of /cvsroot/linux-atm/linux-atm/src/ilmid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26546 Modified Files: Tag: V2_5_0 io.c io.h wait.c Log Message: add lecs address support to ilmid Index: io.c =================================================================== RCS file: /cvsroot/linux-atm/linux-atm/src/ilmid/io.c,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** io.c 19 Jul 2003 21:07:19 -0000 1.2.2.1 --- io.c 6 Oct 2005 15:39:58 -0000 1.2.2.2 *************** *** 90,93 **** --- 90,125 ---- } + + void add_lecs(int itf, char *lecs) + { + int fd; + struct atmif_sioc req; + struct sockaddr_atmsvc addr; + + memset(&addr, 0, sizeof(addr)); + addr.sas_family = AF_ATMSVC; + memcpy(&addr.sas_addr.prv, lecs, 20); + + if ((fd = socket(AF_ATMSVC, SOCK_DGRAM, 0)) < 0){ + diag(COMPONENT, DIAG_ERROR, "socket: %s", strerror(errno)); + return; + } + + req.number = itf; + req.arg = &addr; + req.length = sizeof(addr); + + #ifdef ATM_ADDLECSADDR + if (ioctl(fd, ATM_ADDLECSADDR, &req) < 0) + diag(COMPONENT, DIAG_DEBUG, "ioctl ATM_ADDLECSADDR: %s", strerror(errno)); + #else + diag(COMPONENT, DIAG_DEBUG, "missing ATM_ADDLECSADDR support"); + #endif + + close(fd); + return; + } + + void update_nsap(int itf, AsnOid *netprefix, AsnOid *esi) { Index: io.h =================================================================== RCS file: /cvsroot/linux-atm/linux-atm/src/ilmid/io.h,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** io.h 19 Jul 2003 21:07:19 -0000 1.2.2.1 --- io.h 6 Oct 2005 15:39:58 -0000 1.2.2.2 *************** *** 42,45 **** --- 42,46 ---- int open_ilmi(int itf,const char *qos_spec); int get_ci_range(struct atm_cirange *ci); + void add_lecs(int itf, char *lecs); #endif Index: wait.c =================================================================== RCS file: /cvsroot/linux-atm/linux-atm/src/ilmid/Attic/wait.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** wait.c 19 Jul 2003 21:07:19 -0000 1.1.2.1 --- wait.c 6 Oct 2005 15:39:58 -0000 1.1.2.2 *************** *** 202,205 **** --- 202,207 ---- Message *wait_for_status( int fd, int itf, Msgs *msgs ){ Message *m = NULL; + VarBind *varbind; + VarBindList *vbl; m = wait_for_response( fd, itf, msgs, RESPONSE_TIMEOUT ); *************** *** 211,214 **** --- 213,229 ---- } + /* retrieve the lecs address */ + vbl = m->data->a.get_response->variable_bindings; + FOR_EACH_LIST_ELMT(varbind, vbl) { + if (AsnOidCompare(&atmfSrvcRegATMAddress, + &varbind->name) == AsnOidRoot) { + add_lecs(itf, varbind->value->a.simple->a.string->octs); + } else if (AsnOidCompare(&atmfAddressStatus, + &varbind->name) == AsnOidRoot) { + diag(COMPONENT, DIAG_ERROR, + "address already registered in switch"); + } + } + return m; } |