#include "zebra/rtadv.h"
#include "zebra/zebra_mpls.h"
#include "zebra/debug.h"
+#include "zebra/zebra_errors.h"
/* communicate the withdrawal of a connected address */
static void connected_withdraw(struct connected *ifc)
#endif
break;
default:
- zlog_warn("Received unknown AFI: %s", afi2str(afi));
+ flog_warn(EC_ZEBRA_CONNECTED_AFI_UNKNOWN,
+ "Received unknown AFI: %s", afi2str(afi));
return;
break;
}
/* Add connected IPv4 route to the interface. */
void connected_add_ipv4(struct interface *ifp, int flags, struct in_addr *addr,
- u_char prefixlen, struct in_addr *broad,
+ uint8_t prefixlen, struct in_addr *broad,
const char *label)
{
struct prefix_ipv4 *p;
/* validate the destination address */
if (CONNECTED_PEER(ifc)) {
if (IPV4_ADDR_SAME(addr, broad))
- zlog_warn(
+ flog_warn(
+ EC_ZEBRA_IFACE_SAME_LOCAL_AS_PEER,
"warning: interface %s has same local and peer "
"address %s, routing protocols may malfunction",
ifp->name, inet_ntoa(*addr));
struct in_addr bcalc;
bcalc.s_addr = ipv4_broadcast_addr(addr->s_addr,
prefixlen);
- zlog_warn(
+ flog_warn(
+ EC_ZEBRA_BCAST_ADDR_MISMATCH,
"warning: interface %s broadcast addr %s/%d != "
"calculated %s, routing protocols may malfunction",
ifp->name,
} else {
if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
- zlog_warn(
+ zlog_debug(
"warning: %s called for interface %s "
"with peer flag set, but no peer address supplied",
__func__, ifp->name);
/* no broadcast or destination address was supplied */
if ((prefixlen == IPV4_MAX_PREFIXLEN) && if_is_pointopoint(ifp))
- zlog_warn(
+ zlog_debug(
"warning: PtP interface %s with addr %s/%d needs a "
"peer address",
ifp->name, inet_ntoa(*addr), prefixlen);
* head.
*/
rib_delete(afi, SAFI_UNICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0,
- &p, NULL, &nh, 0, 0, false, NULL);
+ &p, NULL, &nh, 0, 0, 0, false);
rib_delete(afi, SAFI_MULTICAST, ifp->vrf_id, ZEBRA_ROUTE_CONNECT, 0, 0,
- &p, NULL, &nh, 0, 0, false, NULL);
+ &p, NULL, &nh, 0, 0, 0, false);
if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
char buf[PREFIX_STRLEN];
/* Delete connected IPv4 route to the interface. */
void connected_delete_ipv4(struct interface *ifp, int flags,
- struct in_addr *addr, u_char prefixlen,
+ struct in_addr *addr, uint8_t prefixlen,
struct in_addr *broad)
{
struct prefix p, d;
/* Add connected IPv6 route to the interface. */
void connected_add_ipv6(struct interface *ifp, int flags, struct in6_addr *addr,
- u_char prefixlen, const char *label)
+ struct in6_addr *broad, uint8_t prefixlen,
+ const char *label)
{
struct prefix_ipv6 *p;
struct connected *ifc;
p->prefixlen = prefixlen;
ifc->address = (struct prefix *)p;
+ if (broad) {
+ p = prefix_ipv6_new();
+ p->family = AF_INET6;
+ IPV6_ADDR_COPY(&p->prefix, broad);
+ p->prefixlen = prefixlen;
+ ifc->destination = (struct prefix *)p;
+ } else {
+ if (CHECK_FLAG(ifc->flags, ZEBRA_IFA_PEER)) {
+ zlog_debug(
+ "warning: %s called for interface %s with peer flag set, but no peer address supplied",
+ __func__, ifp->name);
+ UNSET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
+ }
+ }
+
/* Label of this address. */
if (label)
ifc->label = XSTRDUP(MTYPE_CONNECTED_LABEL, label);
}
void connected_delete_ipv6(struct interface *ifp, struct in6_addr *address,
- u_char prefixlen)
+ struct in6_addr *broad, uint8_t prefixlen)
{
- struct prefix p;
+ struct prefix p, d;
struct connected *ifc;
memset(&p, 0, sizeof(struct prefix));
memcpy(&p.u.prefix6, address, sizeof(struct in6_addr));
p.prefixlen = prefixlen;
- ifc = connected_check(ifp, &p);
+ if (broad) {
+ memset(&d, 0, sizeof(struct prefix));
+ d.family = AF_INET6;
+ IPV6_ADDR_COPY(&d.u.prefix6, broad);
+ d.prefixlen = prefixlen;
+ ifc = connected_check_ptp(ifp, &p, &d);
+ } else
+ ifc = connected_check_ptp(ifp, &p, NULL);
connected_delete_helper(ifc, &p);
}