From: chas w. <ch...@us...> - 2004-12-11 01:57:25
|
Update of /cvsroot/linux-atm/linux-atm/src/led In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6667 Modified Files: Tag: V2_5_0 conn.c main.c Log Message: dont close the kernel connection -- this will prevent kernel messages about zeppelin not being attached during restarts. Index: conn.c =================================================================== RCS file: /cvsroot/linux-atm/linux-atm/src/led/conn.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -C2 -d -r1.2.2.3 -r1.2.2.4 *** conn.c 19 Jul 2003 22:42:01 -0000 1.2.2.3 --- conn.c 11 Dec 2004 01:57:11 -0000 1.2.2.4 *************** *** 434,438 **** } ! /* Close all connections, important or not. */ void close_connections(void) --- 434,438 ---- } ! /* Close all connections, except the kernel socket. */ void close_connections(void) *************** *** 441,450 **** for(conn = connlist; conn; conn = next) { ! diag(COMPONENT, DIAG_DEBUG, "Destroying:%p fd:%d type:%d", ! conn, conn->fd, conn->type); ! next = conn->next; ! close(conn->fd); ! list_remove_conn(conn); ! free(conn); } --- 441,452 ---- for(conn = connlist; conn; conn = next) { ! next = conn->next; ! if (conn->type != KERNEL_SOCK) { ! diag(COMPONENT, DIAG_DEBUG, "Destroying:%p fd:%d type:%d", ! conn, conn->fd, conn->type); ! close(conn->fd); ! list_remove_conn(conn); ! free(conn); ! } } Index: main.c =================================================================== RCS file: /cvsroot/linux-atm/linux-atm/src/led/main.c,v retrieving revision 1.2.2.5 retrieving revision 1.2.2.6 diff -C2 -d -r1.2.2.5 -r1.2.2.6 *** main.c 10 Dec 2004 21:06:37 -0000 1.2.2.5 --- main.c 11 Dec 2004 01:57:11 -0000 1.2.2.6 *************** *** 370,373 **** --- 370,419 ---- signal(SIGPIPE, SIG_IGN); + if (!esi_set) { + if(addr_getesi(mac_addr, phys_itf) < 0) { + diag(COMPONENT, DIAG_ERROR, "Can't get ESI from kernel!"); + return -1; + } + mac2text(esibuff, mac_addr); + diag(COMPONENT, DIAG_DEBUG, "LEC ESI:%s", esibuff); + + if (itf != 0) + mac_addr[0] = 0x2 | ((itf - 1) << 2); + } + + if ((itf = kernel_init(mac_addr, itf)) < 0 ) { + diag(COMPONENT, DIAG_FATAL, "Kernel interface creation failed, exiting..."); + return -1; + } + + if (daemon_flag == 1) { + daemon_flag = 0; + pid = fork(); + if (pid < 0) { + diag(COMPONENT, DIAG_FATAL, "fork failed, exiting..."); + return -1; + } + if (pid) { + /* parent */ + return 0; + } else { + /* child */ + if (setsid() < 0) { + diag(COMPONENT, DIAG_FATAL, "setsid failed, exiting..."); + return -1; + } + } + } + + sprintf(pidbuf, "/var/run/lec%d.pid", itf); + fd = open(pidbuf, O_CREAT | O_WRONLY, 0600); + if (fd < 0) { + diag(COMPONENT, DIAG_FATAL, "open(%s, ..) failed, %s", pidbuf, strerror(errno)); + return -1; + } + sprintf(pidbuf, "%d\n", getpid()); + write(fd, pidbuf, strlen(pidbuf)); + close(fd); + /* Loop here until the Sun gets cold */ while (1) { *************** *** 385,434 **** diag(COMPONENT, DIAG_INFO, "Our ATM address: %s", atm2textbuff); - if (!esi_set) { - if(addr_getesi(mac_addr, phys_itf) < 0) { - diag(COMPONENT, DIAG_ERROR, "Can't get ESI from kernel!"); - return -1; - } - mac2text(esibuff, mac_addr); - diag(COMPONENT, DIAG_DEBUG, "LEC ESI:%s", esibuff); - - if (itf != 0) - mac_addr[0] = 0x2 | ((itf - 1) << 2); - } - - if ((itf = kernel_init(mac_addr, itf)) < 0 ) { - diag(COMPONENT, DIAG_FATAL, "Kernel interface creation failed, exiting..."); - return -1; - } - - if (daemon_flag == 1) { - daemon_flag = 0; - pid = fork(); - if (pid < 0) { - diag(COMPONENT, DIAG_FATAL, "fork failed, exiting..."); - return -1; - } - if (pid) { - /* parent */ - return 0; - } else { - /* child */ - if (setsid() < 0) { - diag(COMPONENT, DIAG_FATAL, "setsid failed, exiting..."); - return -1; - } - } - } - - sprintf(pidbuf, "/var/run/lec%d.pid", itf); - fd = open(pidbuf, O_CREAT | O_WRONLY, 0600); - if (fd < 0) { - diag(COMPONENT, DIAG_FATAL, "open(%s, ..) failed, %s", pidbuf, strerror(errno)); - return -1; - } - sprintf(pidbuf, "%d\n", getpid()); - write(fd, pidbuf, strlen(pidbuf)); - close(fd); - diag(COMPONENT, DIAG_DEBUG, "initializing lec parameters"); init_lec_params(mac_addr, elan_name, listen_addr.sas_addr.prv, --- 431,434 ---- |