From c5a5a347ac0090b30b4c8e684d1ea86cf5d09388 Mon Sep 17 00:00:00 2001 From: Michele Marchetto Date: Sat, 20 Feb 2010 21:05:01 +0000 Subject: Remove unneeded abstraction in neighbor fsm. ok claudio@ --- usr.sbin/ldpd/ldpe.h | 11 +----- usr.sbin/ldpd/neighbor.c | 94 ++++++++---------------------------------------- 2 files changed, 15 insertions(+), 90 deletions(-) (limited to 'usr.sbin/ldpd') diff --git a/usr.sbin/ldpd/ldpe.h b/usr.sbin/ldpd/ldpe.h index 55dc94e0ad9..63fe9d846af 100644 --- a/usr.sbin/ldpd/ldpe.h +++ b/usr.sbin/ldpd/ldpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldpe.h,v 1.2 2009/06/05 22:34:45 michele Exp $ */ +/* $OpenBSD: ldpe.h,v 1.3 2010/02/20 21:05:00 michele Exp $ */ /* * Copyright (c) 2004, 2005, 2008 Esben Norby @@ -131,7 +131,6 @@ void if_del(struct iface *); void if_init(struct ldpd_conf *, struct iface *); int if_act_start(struct iface *); -int if_act_elect(struct iface *); int if_act_reset(struct iface *); struct ctl_iface *if_to_ctl(struct iface *); @@ -176,14 +175,6 @@ void nbr_stop_idtimer(struct nbr *); void nbr_reset_idtimer(struct nbr *); int nbr_pending_idtimer(struct nbr *); -int nbr_act_reset_itimer(struct nbr *); -int nbr_act_start_itimer(struct nbr *); -int nbr_act_reset_ktimer(struct nbr *); -int nbr_act_start_ktimer(struct nbr *); -int nbr_act_reset_ktimeout(struct nbr *); -int nbr_act_start_ktimeout(struct nbr *); -int nbr_act_reset_idtimer(struct nbr *); -int nbr_act_start_idtimer(struct nbr *); int nbr_act_session_establish(struct nbr *, int); int nbr_close_connection(struct nbr *); diff --git a/usr.sbin/ldpd/neighbor.c b/usr.sbin/ldpd/neighbor.c index 258ebb54609..fd504809ee2 100644 --- a/usr.sbin/ldpd/neighbor.c +++ b/usr.sbin/ldpd/neighbor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: neighbor.c,v 1.8 2010/02/19 14:32:34 claudio Exp $ */ +/* $OpenBSD: neighbor.c,v 1.9 2010/02/20 21:05:00 michele Exp $ */ /* * Copyright (c) 2009 Michele Marchetto @@ -135,23 +135,24 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) return (0); } + ret = 0; + switch (nbr_fsm_tbl[i].action) { case NBR_ACT_RST_ITIMER: - ret = nbr_act_reset_itimer(nbr); + nbr_reset_itimer(nbr); break; case NBR_ACT_STRT_ITIMER: - ret = nbr_act_start_itimer(nbr); + nbr_start_itimer(nbr); break; case NBR_ACT_RST_KTIMEOUT: - ret = nbr_act_reset_ktimeout(nbr); + nbr_reset_ktimeout(nbr); break; case NBR_ACT_RST_KTIMER: - ret = nbr_act_reset_ktimer(nbr); + nbr_reset_ktimer(nbr); break; case NBR_ACT_STRT_KTIMER: - /* XXX */ - ret = nbr_act_start_ktimer(nbr); - nbr_act_start_ktimeout(nbr); + nbr_start_ktimer(nbr); + nbr_start_ktimeout(nbr); send_address(nbr, NULL); nbr_send_labelmappings(nbr); break; @@ -159,21 +160,19 @@ nbr_fsm(struct nbr *nbr, enum nbr_event event) ret = nbr_act_session_establish(nbr, 0); break; case NBR_ACT_INIT_SEND: - /* XXX */ send_init(nbr); - ret = send_keepalive(nbr); + send_keepalive(nbr); break; case NBR_ACT_KEEPALIVE_SEND: - /* XXX */ - ret = nbr_act_start_ktimer(nbr); - nbr_act_start_ktimeout(nbr); + nbr_start_ktimer(nbr); + nbr_start_ktimeout(nbr); send_keepalive(nbr); send_address(nbr, NULL); nbr_send_labelmappings(nbr); break; case NBR_ACT_CLOSE_SESSION: session_close(nbr); - ret = nbr_act_start_idtimer(nbr); + nbr_start_idtimer(nbr); break; case NBR_ACT_NOTHING: /* do nothing */ @@ -536,71 +535,6 @@ nbr_reset_idtimer(struct nbr *nbr) if (evtimer_add(&nbr->initdelay_timer, &tv) == -1) fatal("nbr_reset_idtimer"); } -/* actions */ -int -nbr_act_reset_itimer(struct nbr *nbr) -{ - nbr_reset_itimer(nbr); - - return (0); -} - -int -nbr_act_start_itimer(struct nbr *nbr) -{ - nbr_start_itimer(nbr); - - return (0); -} - -int -nbr_act_reset_ktimer(struct nbr *nbr) -{ - nbr_reset_ktimer(nbr); - - return (0); -} - -int -nbr_act_start_ktimer(struct nbr *nbr) -{ - nbr_start_ktimer(nbr); - - return (0); -} - -int -nbr_act_reset_ktimeout(struct nbr *nbr) -{ - nbr_reset_ktimeout(nbr); - - return (0); -} - -int -nbr_act_start_ktimeout(struct nbr *nbr) -{ - nbr_start_ktimeout(nbr); - - return (0); -} - -int -nbr_act_reset_idtimer(struct nbr *nbr) -{ - nbr_reset_idtimer(nbr); - - return (0); -} - -int -nbr_act_start_idtimer(struct nbr *nbr) -{ - if (nbr->addr.s_addr < nbr->iface->addr.s_addr) - nbr_start_idtimer(nbr); - - return (0); -} int nbr_establish_connection(struct nbr *nbr) @@ -622,7 +556,7 @@ nbr_establish_connection(struct nbr *nbr) if (connect(nbr->fd, (struct sockaddr *)&in, sizeof(in)) == -1) { log_debug("nbr_establish_connection: error while " "connecting to %s", inet_ntoa(nbr->addr)); - nbr_act_start_idtimer(nbr); + nbr_start_idtimer(nbr); close(nbr->fd); return (-1); } -- cgit v1.2.3