Deleted Added
full compact
ng_cisco.c (138009) ng_cisco.c (138268)
1
2/*
3 * ng_cisco.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
1
2/*
3 * ng_cisco.c
4 *
5 * Copyright (c) 1996-1999 Whistle Communications, Inc.
6 * All rights reserved.
7 *
8 * Subject to the following obligations and disclaimer of warranty, use and

--- 22 unchanged lines hidden (view full) ---

31 * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
35 * OF SUCH DAMAGE.
36 *
37 * Author: Julian Elischer <julian@freebsd.org>
38 *
39 * $FreeBSD: head/sys/netgraph/ng_cisco.c 138009 2004-11-23 09:30:27Z glebius $
39 * $FreeBSD: head/sys/netgraph/ng_cisco.c 138268 2004-12-01 11:56:32Z glebius $
40 * $Whistle: ng_cisco.c,v 1.25 1999/11/01 09:24:51 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/errno.h>
46#include <sys/kernel.h>
47#include <sys/socket.h>

--- 169 unchanged lines hidden (view full) ---

217{
218 const sc_p sc = NG_NODE_PRIVATE(node);
219
220 if (strcmp(name, NG_CISCO_HOOK_DOWNSTREAM) == 0) {
221 sc->downstream.hook = hook;
222 NG_HOOK_SET_PRIVATE(hook, &sc->downstream);
223
224 /* Start keepalives */
40 * $Whistle: ng_cisco.c,v 1.25 1999/11/01 09:24:51 julian Exp $
41 */
42
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/errno.h>
46#include <sys/kernel.h>
47#include <sys/socket.h>

--- 169 unchanged lines hidden (view full) ---

217{
218 const sc_p sc = NG_NODE_PRIVATE(node);
219
220 if (strcmp(name, NG_CISCO_HOOK_DOWNSTREAM) == 0) {
221 sc->downstream.hook = hook;
222 NG_HOOK_SET_PRIVATE(hook, &sc->downstream);
223
224 /* Start keepalives */
225 ng_timeout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
225 ng_callout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
226 &cisco_keepalive, (void *)sc, 0);
227 } else if (strcmp(name, NG_CISCO_HOOK_INET) == 0) {
228 sc->inet.hook = hook;
229 NG_HOOK_SET_PRIVATE(hook, &sc->inet);
230 } else if (strcmp(name, NG_CISCO_HOOK_APPLETALK) == 0) {
231 sc->atalk.hook = hook;
232 NG_HOOK_SET_PRIVATE(hook, &sc->atalk);
233 } else if (strcmp(name, NG_CISCO_HOOK_IPX) == 0) {

--- 186 unchanged lines hidden (view full) ---

420 const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
421 struct protoent *pep;
422
423 /* Check it's not the debug hook */
424 if ((pep = NG_HOOK_PRIVATE(hook))) {
425 pep->hook = NULL;
426 if (pep->af == 0xffff)
427 /* If it is the downstream hook, stop the timers */
226 &cisco_keepalive, (void *)sc, 0);
227 } else if (strcmp(name, NG_CISCO_HOOK_INET) == 0) {
228 sc->inet.hook = hook;
229 NG_HOOK_SET_PRIVATE(hook, &sc->inet);
230 } else if (strcmp(name, NG_CISCO_HOOK_APPLETALK) == 0) {
231 sc->atalk.hook = hook;
232 NG_HOOK_SET_PRIVATE(hook, &sc->atalk);
233 } else if (strcmp(name, NG_CISCO_HOOK_IPX) == 0) {

--- 186 unchanged lines hidden (view full) ---

420 const sc_p sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
421 struct protoent *pep;
422
423 /* Check it's not the debug hook */
424 if ((pep = NG_HOOK_PRIVATE(hook))) {
425 pep->hook = NULL;
426 if (pep->af == 0xffff)
427 /* If it is the downstream hook, stop the timers */
428 ng_untimeout(&sc->handle, NG_HOOK_NODE(hook));
428 ng_uncallout(&sc->handle, NG_HOOK_NODE(hook));
429 }
430
431 /* If no more hooks, remove the node */
432 if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0)
433 && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook))))
434 ng_rmnode_self(NG_HOOK_NODE(hook));
435 return (0);
436}

--- 145 unchanged lines hidden (view full) ---

582static void
583cisco_keepalive(node_p node, hook_p hook, void *arg1, int arg2)
584{
585 const sc_p sc = arg1;
586
587 cisco_send(sc, CISCO_KEEPALIVE_REQ, sc->local_seq, sc->remote_seq);
588 if (sc->seqRetries++ > 1)
589 cisco_notify(sc, NGM_LINK_IS_DOWN);
429 }
430
431 /* If no more hooks, remove the node */
432 if ((NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0)
433 && (NG_NODE_IS_VALID(NG_HOOK_NODE(hook))))
434 ng_rmnode_self(NG_HOOK_NODE(hook));
435 return (0);
436}

--- 145 unchanged lines hidden (view full) ---

582static void
583cisco_keepalive(node_p node, hook_p hook, void *arg1, int arg2)
584{
585 const sc_p sc = arg1;
586
587 cisco_send(sc, CISCO_KEEPALIVE_REQ, sc->local_seq, sc->remote_seq);
588 if (sc->seqRetries++ > 1)
589 cisco_notify(sc, NGM_LINK_IS_DOWN);
590 ng_timeout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
590 ng_callout(&sc->handle, node, NULL, (hz * KEEPALIVE_SECS),
591 &cisco_keepalive, (void *)sc, 0);
592}
593
594/*
595 * Send Cisco keepalive packet.
596 */
597static int
598cisco_send(sc_p sc, int type, long par1, long par2)

--- 51 unchanged lines hidden ---
591 &cisco_keepalive, (void *)sc, 0);
592}
593
594/*
595 * Send Cisco keepalive packet.
596 */
597static int
598cisco_send(sc_p sc, int type, long par1, long par2)

--- 51 unchanged lines hidden ---