int state = STATE_START;
int colons = 0, nums = 0, double_colon = 0;
char *sp = NULL;
+ struct sockaddr_in6 sin6_dummy;
+ int ret;
if (str == NULL)
return partly_match;
if (strspn (str, IPV6_ADDR_STR) != strlen (str))
return no_match;
+ /* use inet_pton that has a better support,
+ * for example inet_pton can support the automatic addresses:
+ * ::1.2.3.4
+ */
+ ret = inet_pton(AF_INET6, str, &sin6_dummy.sin6_addr);
+
+ if (ret == 1)
+ return exact_match;
+
while (*str != '\0')
{
switch (state)
{
#ifdef HAVE_SIN6_SCOPE_ID
/* su.sin6.sin6_scope_id = ifindex; */
+#ifdef MUSICA
+ su.sin6.sin6_scope_id = ifindex;
+#endif
#endif /* HAVE_SIN6_SCOPE_ID */
+#ifndef MUSICA
SET_IN6_LINKLOCAL_IFINDEX (su.sin6.sin6_addr, ifindex);
+#endif
}
#endif /* KAME */
break;
#include <netinet/in_var.h>
#endif /* HAVE_NETINET_IN_VAR_H */
+#ifdef HAVE_NETINET6_IN6_VAR_H
+#include <netinet6/in6_var.h>
+#endif /* HAVE_NETINET6_IN6_VAR_H */
+
#ifdef HAVE_NETINET_IN6_VAR_H
#include <netinet/in6_var.h>
#endif /* HAVE_NETINET_IN6_VAR_H */
/* Apply mask to the network. */
apply_mask_ipv6 (&p);
+#if ! defined (MUSICA) && ! defined (LINUX)
+ /* XXX: It is already done by rib_bogus_ipv6 within rib_add_ipv6 */
if (IN6_IS_ADDR_UNSPECIFIED (&p.prefix))
return;
+#endif
rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0);
/* Router advertisement feature. */
#if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME)
-#define RTADV
+ #ifdef HAVE_RTADV
+ #define RTADV
+ #endif
#endif
#ifdef RTADV
#endif
memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
+#ifdef HAVE_IFRA_LIFETIME
addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
+#endif
ret = if_ioctl_ipv6 (SIOCAIFADDR_IN6, (caddr_t) &addreq);
if (ret < 0)
#endif
memcpy (&addreq.ifra_prefixmask, &mask, sizeof (struct sockaddr_in6));
+#ifdef HAVE_IFRA_LIFETIME
addreq.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
addreq.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
+#endif
ret = if_ioctl_ipv6 (SIOCDIFADDR_IN6, (caddr_t) &addreq);
if (ret < 0)
thread_add_read (master, kernel_read, NULL, sock);
-#ifdef DEBUG
- rtmsg_debug (&buf.r.rtm);
-#endif /* DEBUG */
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ rtmsg_debug (&buf.r.rtm);
rtm = &buf.r.rtm;
break;
#endif /* RTM_IFANNOUNCE */
default:
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_info("Unprocessed RTM_type: %d", rtm->rtm_type);
break;
}
return 0;
rib_bogus_ipv6 (int type, struct prefix_ipv6 *p,
struct in6_addr *gate, unsigned int ifindex, int table)
{
- if (type == ZEBRA_ROUTE_CONNECT && IN6_IS_ADDR_UNSPECIFIED (&p->prefix))
+ if (type == ZEBRA_ROUTE_CONNECT && IN6_IS_ADDR_UNSPECIFIED (&p->prefix)) {
+#if defined (MUSICA) || defined (LINUX)
+ /* IN6_IS_ADDR_V4COMPAT(&p->prefix) */
+ if (p->prefixlen == 96)
+ return 0;
+#endif /* MUSICA */
return 1;
+ }
if (type == ZEBRA_ROUTE_KERNEL && IN6_IS_ADDR_UNSPECIFIED (&p->prefix)
&& p->prefixlen == 96 && gate && IN6_IS_ADDR_UNSPECIFIED (gate))
{
{
stream_putc (s, 1);
+ /* XXX: Waht's about NEXTHOP_TYPE_IPV4_IFNAME ? */
if (nexthop->type == NEXTHOP_TYPE_IPV4
|| nexthop->type == NEXTHOP_TYPE_IPV4_IFINDEX)
stream_put_in_addr (s, &nexthop->gate.ipv4);
return 0;
}
+#if 0
+#warning oldies
int
zsend_ipv4_add (struct zserv *client, int type, int flags,
struct prefix_ipv4 *p, struct in_addr *nexthop,
return 0;
}
+#endif /* oldies */
#ifdef HAVE_IPV6
+#if 0
+#warning oldies
int
zsend_ipv6_add (struct zserv *client, int type, int flags,
struct prefix_ipv6 *p, struct in6_addr *nexthop,
return 0;
}
+#endif /* oldies */
int
zsend_ipv6_add_multipath (struct zserv *client, struct prefix *p,
{
stream_putc (s, 1);
- if (nexthop->type == NEXTHOP_TYPE_IPV6)
+ if (nexthop->type == NEXTHOP_TYPE_IPV6
+ || nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
+ || nexthop->type == NEXTHOP_TYPE_IPV6_IFNAME)
stream_write (s, (u_char *) &nexthop->gate.ipv6, 16);
else
stream_write (s, (u_char *) &empty, 16);
return 0;
}
+#if 0
+#warning oldies
int
zsend_ipv6_delete (struct zserv *client, int type, int flags,
struct prefix_ipv6 *p, struct in6_addr *nexthop,
return 0;
}
+#endif /* oldies */
int
zsend_ipv6_delete_multipath (struct zserv *client, struct prefix *p,
int
zsend_interface_down (struct zserv *, struct interface *);
+#if 0
+#warning oldies
int
zsend_ipv4_add (struct zserv *client, int type, int flags,
struct prefix_ipv4 *p, struct in_addr *nexthop,
zsend_ipv4_delete (struct zserv *client, int type, int flags,
struct prefix_ipv4 *p, struct in_addr *nexthop,
unsigned int ifindex);
+#endif
int
zsend_ipv4_add_multipath (struct zserv *, struct prefix *, struct rib *);
zsend_ipv4_delete_multipath (struct zserv *, struct prefix *, struct rib *);
#ifdef HAVE_IPV6
+#if 0
+#warning oldies
int
zsend_ipv6_add (struct zserv *client, int type, int flags,
struct prefix_ipv6 *p, struct in6_addr *nexthop,
zsend_ipv6_delete (struct zserv *client, int type, int flags,
struct prefix_ipv6 *p, struct in6_addr *nexthop,
unsigned int ifindex);
+#endif
int
zsend_ipv6_add_multipath (struct zserv *, struct prefix *, struct rib *);