+// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* Copyright (C) 1997, 2000
*
* Thanks to Jens Laas at Swedish University of Agricultural Sciences
* for reviewing and tests.
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "prefix.h"
#include "command.h"
#include "memory.h"
-#include "zebra_memory.h"
#include "stream.h"
#include "ioctl.h"
#include "connected.h"
extern int irdp_sock;
-DEFINE_MTYPE_STATIC(ZEBRA, IRDP_IF, "IRDP interface data")
+DEFINE_MTYPE_STATIC(ZEBRA, IRDP_IF, "IRDP interface data");
#define IRDP_CONFIGED \
do { \
return 0;
}
-static const char *inet_2a(uint32_t a, char *b)
+static const char *inet_2a(uint32_t a, char *b, size_t b_len)
{
- sprintf(b, "%u.%u.%u.%u", (a)&0xFF, (a >> 8) & 0xFF, (a >> 16) & 0xFF,
- (a >> 24) & 0xFF);
+ snprintf(b, b_len, "%u.%u.%u.%u", (a)&0xFF, (a >> 8) & 0xFF,
+ (a >> 16) & 0xFF, (a >> 24) & 0xFF);
return b;
}
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));
+ inet_2a(group, b1, sizeof(b1)),
+ safe_strerror(errno));
return ret;
}
if (irdp->flags & IF_DEBUG_MISC)
zlog_debug("IRDP: Adding group %s for %s",
- inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1), ifp->name);
+ inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1, sizeof(b1)),
+ ifp->name);
return 0;
}
if (irdp->flags & IF_DEBUG_MISC)
zlog_debug("IRDP: Leaving group %s for %s",
- inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1), ifp->name);
+ inet_2a(htonl(INADDR_ALLRTRS_GROUP), b1, sizeof(b1)),
+ ifp->name);
return 0;
}
static struct Adv *Adv_new(void)
{
- return XCALLOC(MTYPE_TMP, sizeof(struct Adv));
+ return XCALLOC(MTYPE_IRDP_IF, sizeof(struct Adv));
}
static void Adv_free(struct Adv *adv)
{
- XFREE(MTYPE_TMP, adv);
+ XFREE(MTYPE_IRDP_IF, adv);
}
static void irdp_if_start(struct interface *ifp, int multicast,
}
if ((irdp_sock < 0) && ((irdp_sock = irdp_sock_init()) < 0)) {
flog_warn(EC_ZEBRA_IRDP_CANNOT_ACTIVATE_IFACE,
- "IRDP: Cannot activate interface %s (cannot create "
- "IRDP socket)",
+ "IRDP: Cannot activate interface %s (cannot create IRDP socket)",
ifp->name);
return;
}
for (ALL_LIST_ELEMENTS_RO(irdp->AdvPrefList, node, adv))
vty_out(vty, " ip irdp address %s preference %d\n",
- inet_2a(adv->ip.s_addr, b1), adv->pref);
+ inet_2a(adv->ip.s_addr, b1, sizeof(b1)),
+ adv->pref);
vty_out(vty, " ip irdp holdtime %d\n", irdp->Lifetime);
return CMD_SUCCESS;
} else {
vty_out(vty,
- "%% MinAdvertInterval must be less than or equal to "
- "MaxAdvertInterval\n");
+ "%% MinAdvertInterval must be less than or equal to MaxAdvertInterval\n");
return CMD_WARNING_CONFIG_FAILED;
}
}
return CMD_SUCCESS;
} else {
vty_out(vty,
- "%% MaxAdvertInterval must be greater than or equal to "
- "MinAdvertInterval\n");
+ "%% MaxAdvertInterval must be greater than or equal to MinAdvertInterval\n");
return CMD_WARNING_CONFIG_FAILED;
}
}