/*
*
- * Copyright (C) 2000 Robert Olsson.
- * Swedish University of Agricultural Sciences
+ * Copyright (C) 1997, 2000
+ * Portions:
+ * Swedish University of Agricultural Sciences
+ * Robert Olsson
+ * Kunihiro Ishiguro
+ *
+ * Thanks to Jens Laas at Swedish University of Agricultural Sciences
+ * for reviewing and tests.
*
* This file is part of GNU Zebra.
*
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/*
- * This work includes work with the following copywrite:
- *
- * Copyright (C) 1997, 2000 Kunihiro Ishiguro
- *
- */
-
-/*
- * Thanks to Jens Låås at Swedish University of Agricultural Sciences
- * for reviewing and tests.
- */
-
-
#include <zebra.h>
#include "if.h"
#include "log.h"
#include "zclient.h"
#include "thread.h"
+#include "lib_errors.h"
#include "zebra/interface.h"
#include "zebra/rtadv.h"
#include "zebra/rib.h"
-#include "zebra/zserv.h"
+#include "zebra/zebra_router.h"
#include "zebra/redistribute.h"
#include "zebra/irdp.h"
+#include "zebra/zebra_errors.h"
#include <netinet/ip_icmp.h>
#include "if.h"
#include "sockunion.h"
p = irdp_get_prefix(ifp);
if (!p) {
- zlog_warn("IRDP: can't get address for %s", ifp->name);
+ flog_warn(EC_ZEBRA_NO_IFACE_ADDR,
+ "IRDP: can't get address for %s", ifp->name);
return 1;
}
ret = setsockopt(sock, IPPROTO_IP, add_leave, (char *)&m,
sizeof(struct ip_mreq));
if (ret < 0)
- zlog_warn("IRDP: %s can't setsockopt %s: %s",
- add_leave == IP_ADD_MEMBERSHIP ? "join group"
- : "leave group",
- inet_2a(group, b1), safe_strerror(errno));
+ flog_err_sys(EC_LIB_SOCKET, "IRDP: %s can't setsockopt %s: %s",
+ add_leave == IP_ADD_MEMBERSHIP ? "join group"
+ : "leave group",
+ inet_2a(group, b1), safe_strerror(errno));
return ret;
}
irdp->started = true;
if (irdp->flags & IF_ACTIVE) {
- zlog_warn("IRDP: Interface is already active %s", ifp->name);
+ zlog_debug("IRDP: Interface is already active %s", ifp->name);
return;
}
if ((irdp_sock < 0) && ((irdp_sock = irdp_sock_init()) < 0)) {
- zlog_warn(
- "IRDP: Cannot activate interface %s (cannot create "
- "IRDP socket)",
- ifp->name);
+ flog_warn(EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
+ "IRDP: Cannot activate interface %s (cannot create "
+ "IRDP socket)",
+ ifp->name);
return;
}
irdp->flags |= IF_ACTIVE;
if_add_update(ifp);
if (!(ifp->flags & IFF_UP)) {
- zlog_warn("IRDP: Interface is down %s", ifp->name);
+ flog_warn(EC_ZEBRA_IRDP_IFACE_DOWN,
+ "IRDP: Interface is down %s", ifp->name);
}
/* Shall we cancel if_start if if_add_group fails? */
if_add_group(ifp);
if (!(ifp->flags & (IFF_MULTICAST | IFF_ALLMULTI))) {
- zlog_warn("IRDP: Interface not multicast enabled %s",
+ flog_warn(EC_ZEBRA_IRDP_IFACE_MCAST_DISABLED,
+ "IRDP: Interface not multicast enabled %s",
ifp->name);
}
}
timer);
irdp->t_advertise = NULL;
- thread_add_timer(zebrad.master, irdp_send_thread, ifp, timer,
+ thread_add_timer(zrouter.master, irdp_send_thread, ifp, timer,
&irdp->t_advertise);
}
struct irdp_interface *irdp = zi->irdp;
if (irdp == NULL) {
- zlog_warn("Interface %s structure is NULL", ifp->name);
+ zlog_debug("Interface %s structure is NULL", ifp->name);
return;
}
if (!(irdp->flags & IF_ACTIVE)) {
- zlog_warn("Interface is not active %s", ifp->name);
+ zlog_debug("Interface is not active %s", ifp->name);
return;
}
irdp_advert_off(ifp);
- list_delete_and_null(&irdp->AdvPrefList);
+ list_delete(&irdp->AdvPrefList);
irdp->flags = 0;
}
return;
if (irdp->flags & IF_SHUTDOWN) {
- zlog_warn("IRDP: Interface is already shutdown %s", ifp->name);
+ zlog_debug("IRDP: Interface is already shutdown %s", ifp->name);
return;
}
return;
if (!(irdp->flags & IF_SHUTDOWN)) {
- zlog_warn("IRDP: Interface is not shutdown %s", ifp->name);
+ zlog_debug("IRDP: Interface is not shutdown %s", ifp->name);
return;
}
irdp->flags &= ~IF_SHUTDOWN;
- irdp_if_start(ifp, irdp->flags & IF_BROADCAST ? FALSE : TRUE, FALSE);
+ irdp_if_start(ifp, irdp->flags & IF_BROADCAST ? false : true, false);
}
VTY_DECLVAR_CONTEXT(interface, ifp);
irdp_if_get(ifp);
- irdp_if_start(ifp, TRUE, TRUE);
+ irdp_if_start(ifp, true, true);
return CMD_SUCCESS;
}
VTY_DECLVAR_CONTEXT(interface, ifp);
irdp_if_get(ifp);
- irdp_if_start(ifp, FALSE, TRUE);
+ irdp_if_start(ifp, false, true);
return CMD_SUCCESS;
}
return CMD_SUCCESS;
}
-void irdp_if_init()
+void irdp_if_init(void)
{
hook_register(zebra_if_config_wr, irdp_config_write);
hook_register(if_del, irdp_if_delete);