summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
Diffstat (limited to 'zebra')
-rw-r--r--zebra/Makefile.am2
-rw-r--r--zebra/connected.c105
-rw-r--r--zebra/connected.h11
-rw-r--r--zebra/if_ioctl.c6
-rw-r--r--zebra/if_ioctl_solaris.c4
-rw-r--r--zebra/if_proc.c2
-rw-r--r--zebra/interface.c310
-rw-r--r--zebra/ioctl.c65
-rw-r--r--zebra/irdp.h7
-rw-r--r--zebra/irdp_interface.c25
-rw-r--r--zebra/irdp_main.c20
-rw-r--r--zebra/irdp_packet.c6
-rw-r--r--zebra/kernel_null.c2
-rw-r--r--zebra/kernel_socket.c36
-rw-r--r--zebra/main.c22
-rw-r--r--zebra/redistribute.c46
-rw-r--r--zebra/router-id.c16
-rw-r--r--zebra/rt_netlink.c23
-rw-r--r--zebra/rtadv.c13
-rw-r--r--zebra/test_main.c11
-rw-r--r--zebra/zebra_rib.c104
-rw-r--r--zebra/zebra_vty.c78
-rw-r--r--zebra/zserv.c3
-rw-r--r--zebra/zserv.h4
24 files changed, 592 insertions, 329 deletions
diff --git a/zebra/Makefile.am b/zebra/Makefile.am
index 542f36f4..828e88ff 100644
--- a/zebra/Makefile.am
+++ b/zebra/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in.
INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib @SNMP_INCLUDES@
-DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\" -DMULTIPATH_NUM=@MULTIPATH_NUM@
+DEFS = @DEFS@ -DMULTIPATH_NUM=@MULTIPATH_NUM@
INSTALL_SDATA=@INSTALL@ -m 600
LIB_IPV6 = @LIB_IPV6@
diff --git a/zebra/connected.c b/zebra/connected.c
index 95399fa1..0c22582d 100644
--- a/zebra/connected.c
+++ b/zebra/connected.c
@@ -36,6 +36,53 @@
#include "zebra/interface.h"
#include "zebra/connected.h"
extern struct zebra_t zebrad;
+
+#ifdef HAVE_NETLINK
+static const struct message rtscope_str[] = {
+ {RT_SCOPE_UNIVERSE, "global"},
+ {RT_SCOPE_SITE, "site"},
+ {RT_SCOPE_LINK, "link"},
+ {RT_SCOPE_HOST, "host"},
+ {RT_SCOPE_NOWHERE, "nowhere"},
+ {0, NULL}
+};
+
+/* for use in show interface */
+const char *
+connected_scope_name(unsigned value)
+{
+ const char *str;
+ static char buf[16];
+
+ str = lookup (rtscope_str, value);
+ if (!str || !*str) {
+ snprintf (buf, sizeof(buf), "%d", value);
+ str = buf;
+ }
+ return str;
+}
+
+int
+connected_scope_number(const char *name)
+{
+ const struct message *m;
+ char *errptr;
+ unsigned value;
+
+ if (!name || !*name)
+ return -1;
+
+ for (m = rtscope_str; m->str; m++)
+ if (!strcmp (m->str, name))
+ return m->key;
+
+ value = strtoul (name, &errptr, 0);
+ if (*errptr || value > 255)
+ return -1;
+
+ return value;
+}
+#endif /* HAVE_NETLINK */
/* withdraw a connected address */
static void
@@ -112,6 +159,30 @@ connected_check (struct interface *ifp, struct prefix *p)
return NULL;
}
+/* same, but with peer address */
+struct connected *
+connected_check_ptp (struct interface *ifp, struct prefix *p, struct prefix *d)
+{
+ struct connected *ifc;
+ struct listnode *node;
+
+ /* ignore broadcast addresses */
+ if (p->prefixlen != IPV4_MAX_PREFIXLEN)
+ d = NULL;
+
+ for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, ifc))
+ {
+ if (!prefix_same (ifc->address, p))
+ continue;
+ if (!CONNECTED_PEER(ifc) && !d)
+ return ifc;
+ if (CONNECTED_PEER(ifc) && d && prefix_same (ifc->destination, d))
+ return ifc;
+ }
+
+ return NULL;
+}
+
/* Check if two ifc's describe the same address */
static int
connected_same (struct connected *ifc1, struct connected *ifc2)
@@ -148,7 +219,7 @@ connected_implicit_withdraw (struct interface *ifp, struct connected *ifc)
struct connected *current;
/* Check same connected route. */
- if ((current = connected_check (ifp, (struct prefix *) ifc->address)))
+ if ((current = connected_check_ptp (ifp, ifc->address, ifc->destination)))
{
if (CHECK_FLAG(current->conf, ZEBRA_IFC_CONFIGURED))
SET_FLAG(ifc->conf, ZEBRA_IFC_CONFIGURED);
@@ -198,7 +269,7 @@ connected_up_ipv4 (struct interface *ifp, struct connected *ifc)
void
connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
u_char prefixlen, struct in_addr *broad,
- const char *label)
+ const char *label, unsigned scope, int preference)
{
struct prefix_ipv4 *p;
struct connected *ifc;
@@ -212,7 +283,8 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
p = prefix_ipv4_new ();
p->family = AF_INET;
p->prefix = *addr;
- p->prefixlen = prefixlen;
+ p->prefixlen = CHECK_FLAG(flags, ZEBRA_IFA_PEER)
+ ? IPV4_MAX_PREFIXLEN : prefixlen;
ifc->address = (struct prefix *) p;
/* If there is broadcast or peer address. */
@@ -269,6 +341,9 @@ connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
if (label)
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
+ ifc->scope = scope;
+ ifc->preference = preference;
+
/* nothing to do? */
if ((ifc = connected_implicit_withdraw (ifp, ifc)) == NULL)
return;
@@ -305,15 +380,27 @@ void
connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
u_char prefixlen, struct in_addr *broad)
{
- struct prefix_ipv4 p;
+ struct prefix_ipv4 p, d;
struct connected *ifc;
memset (&p, 0, sizeof (struct prefix_ipv4));
p.family = AF_INET;
p.prefix = *addr;
- p.prefixlen = prefixlen;
+ p.prefixlen = CHECK_FLAG(flags, ZEBRA_IFA_PEER)
+ ? IPV4_MAX_PREFIXLEN : prefixlen;
+
+ if (broad)
+ {
+ memset (&d, 0, sizeof (struct prefix_ipv4));
+ d.family = AF_INET;
+ d.prefix = *broad;
+ d.prefixlen = prefixlen;
+ ifc = connected_check_ptp (ifp, (struct prefix *) &p,
+ (struct prefix *) &d);
+ }
+ else
+ ifc = connected_check_ptp (ifp, (struct prefix *) &p, NULL);
- ifc = connected_check (ifp, (struct prefix *) &p);
if (! ifc)
return;
@@ -352,7 +439,7 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc)
void
connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr,
u_char prefixlen, struct in6_addr *broad,
- const char *label)
+ const char *label, unsigned scope)
{
struct prefix_ipv6 *p;
struct connected *ifc;
@@ -395,7 +482,9 @@ connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *addr,
/* Label of this address. */
if (label)
ifc->label = XSTRDUP (MTYPE_CONNECTED_LABEL, label);
-
+
+ ifc->scope = scope;
+
if ((ifc = connected_implicit_withdraw (ifp, ifc)) == NULL)
return;
diff --git a/zebra/connected.h b/zebra/connected.h
index 9595ddb1..ede75120 100644
--- a/zebra/connected.h
+++ b/zebra/connected.h
@@ -25,11 +25,13 @@
extern struct connected *
connected_check (struct interface *ifp, struct prefix *p);
+extern struct connected *
+connected_check_ptp (struct interface *ifp, struct prefix *p, struct prefix *d);
extern void
connected_add_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
u_char prefixlen, struct in_addr *broad,
- const char *label);
+ const char *label, unsigned scope, int preference);
extern void
connected_delete_ipv4 (struct interface *ifp, int flags, struct in_addr *addr,
@@ -42,7 +44,7 @@ extern void connected_down_ipv4 (struct interface *, struct connected *);
extern void
connected_add_ipv6 (struct interface *ifp, int flags, struct in6_addr *address,
u_char prefixlen, struct in6_addr *broad,
- const char *label);
+ const char *label, unsigned scope);
extern void
connected_delete_ipv6 (struct interface *ifp, struct in6_addr *address,
u_char prefixlen, struct in6_addr *broad);
@@ -52,4 +54,9 @@ extern void connected_down_ipv6 (struct interface *ifp, struct connected *);
#endif /* HAVE_IPV6 */
+#ifdef HAVE_NETLINK
+extern const char *connected_scope_name (unsigned value);
+extern int connected_scope_number (const char *name);
+#endif /* HAVE_NETLINK */
+
#endif /*_ZEBRA_CONNECTED_H */
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index f357e154..36732704 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -276,7 +276,7 @@ if_getaddrs (void)
}
connected_add_ipv4 (ifp, flags, &addr->sin_addr,
- prefixlen, dest_pnt, NULL);
+ prefixlen, dest_pnt, NULL, 0, 0);
}
#ifdef HAVE_IPV6
if (ifap->ifa_addr->sa_family == AF_INET6)
@@ -321,7 +321,7 @@ if_getaddrs (void)
#endif
connected_add_ipv6 (ifp, flags, &addr->sin6_addr, prefixlen,
- dest_pnt, NULL);
+ dest_pnt, NULL, 0);
}
#endif /* HAVE_IPV6 */
}
@@ -412,7 +412,7 @@ if_get_addr (struct interface *ifp)
/* Set address to the interface. */
- connected_add_ipv4 (ifp, flags, &addr.sin_addr, prefixlen, dest_pnt, NULL);
+ connected_add_ipv4 (ifp, flags, &addr.sin_addr, prefixlen, dest_pnt, NULL, 0, 0);
return 0;
}
diff --git a/zebra/if_ioctl_solaris.c b/zebra/if_ioctl_solaris.c
index fc384ea2..736232e8 100644
--- a/zebra/if_ioctl_solaris.c
+++ b/zebra/if_ioctl_solaris.c
@@ -327,11 +327,11 @@ if_get_addr (struct interface *ifp, struct sockaddr *addr, const char *label)
/* Set address to the interface. */
if (af == AF_INET)
connected_add_ipv4 (ifp, flags, &SIN (addr)->sin_addr, prefixlen,
- (struct in_addr *) dest_pnt, label);
+ (struct in_addr *) dest_pnt, label, 0, 0);
#ifdef HAVE_IPV6
else if (af == AF_INET6)
connected_add_ipv6 (ifp, flags, &SIN6 (addr)->sin6_addr, prefixlen,
- (struct in6_addr *) dest_pnt, label);
+ (struct in6_addr *) dest_pnt, label, 0);
#endif /* HAVE_IPV6 */
return 0;
diff --git a/zebra/if_proc.c b/zebra/if_proc.c
index 3aec530b..6c538116 100644
--- a/zebra/if_proc.c
+++ b/zebra/if_proc.c
@@ -240,7 +240,7 @@ ifaddr_proc_ipv6 ()
str2in6_addr (addr, &p.prefix);
p.prefixlen = plen;
- connected_add_ipv6 (ifp, 0, &p.prefix, p.prefixlen, NULL, ifname);
+ connected_add_ipv6 (ifp, 0, &p.prefix, p.prefixlen, NULL, ifname, 0);
}
fclose (fp);
return 0;
diff --git a/zebra/interface.c b/zebra/interface.c
index 9dfb6d50..e09ca41f 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -127,7 +127,7 @@ if_subnet_add (struct interface *ifp, struct connected *ifc)
/* Get address derived subnet node and associated address list, while marking
address secondary attribute appropriately. */
- cp = *ifc->address;
+ cp = *CONNECTED_PREFIX(ifc);
apply_mask (&cp);
rn = route_node_get (zebra_if->ipv4_subnets, &cp);
@@ -154,12 +154,16 @@ if_subnet_delete (struct interface *ifp, struct connected *ifc)
struct route_node *rn;
struct zebra_if *zebra_if;
struct list *addr_list;
+ struct prefix cp;
assert (ifp && ifp->info && ifc);
zebra_if = ifp->info;
+ cp = *CONNECTED_PREFIX(ifc);
+ apply_mask (&cp);
+
/* Get address derived subnet node. */
- rn = route_node_lookup (zebra_if->ipv4_subnets, ifc->address);
+ rn = route_node_lookup (zebra_if->ipv4_subnets, &cp);
if (! (rn && rn->info))
return -1;
route_unlock_node (rn);
@@ -588,8 +592,18 @@ connected_dump_vty (struct vty *vty, struct connected *connected)
{
vty_out (vty, (CONNECTED_PEER(connected) ? " peer " : " broadcast "));
prefix_vty_out (vty, connected->destination);
+ vty_out (vty, "/%d", connected->destination->prefixlen);
}
+#ifdef HAVE_NETLINK
+ if (connected->scope != 0)
+ vty_out (vty, " scope %s", connected_scope_name (connected->scope));
+#endif
+#ifdef SIOCSIFADDRPREF
+ if (connected->preference != 0)
+ vty_out (vty, " preference %d", connected->preference);
+#endif
+
if (CHECK_FLAG (connected->flags, ZEBRA_IFA_SECONDARY))
vty_out (vty, " secondary");
@@ -830,19 +844,6 @@ if_dump_vty (struct vty *vty, struct interface *ifp)
#endif /* HAVE_NET_RT_IFLIST */
}
-/* Check supported address family. */
-static int
-if_supported_family (int family)
-{
- if (family == AF_INET)
- return 1;
-#ifdef HAVE_IPV6
- if (family == AF_INET6)
- return 1;
-#endif /* HAVE_IPV6 */
- return 0;
-}
-
/* Wrapper hook point for zebra daemon so that ifindex can be set
* DEFUN macro not used as extract.pl HAS to ignore this
* See also interface_cmd in lib/if.c
@@ -1162,21 +1163,62 @@ ALIAS (no_bandwidth_if,
static int
ip_address_install (struct vty *vty, struct interface *ifp,
const char *addr_str, const char *peer_str,
- const char *label)
+ const char *label, const char *scope,
+ const char *preference)
{
- struct prefix_ipv4 cp;
+ struct prefix_ipv4 lp, pp;
struct connected *ifc;
struct prefix_ipv4 *p;
int ret;
+ int scopev = 0, preferencev = 0;
- ret = str2prefix_ipv4 (addr_str, &cp);
+ ret = str2prefix_ipv4 (addr_str, &lp);
if (ret <= 0)
+ {
+ vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ if (peer_str)
{
- vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
- return CMD_WARNING;
+ if (lp.prefixlen != 32)
+ {
+ vty_out (vty, "%% Local prefix length for P-t-P address "
+ "must be /32%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ret = str2prefix_ipv4 (peer_str, &pp);
+ if (ret <= 0)
+ {
+ vty_out (vty, "%% Malformed peer address %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
}
- ifc = connected_check (ifp, (struct prefix *) &cp);
+#ifdef HAVE_NETLINK
+ if (scope)
+ {
+ scopev = connected_scope_number (scope);
+ if (scopev < 0)
+ {
+ vty_out (vty, "%% Malformed scope %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
+#endif
+ if (preference)
+ {
+ preferencev = atoi (preference);
+ if (preferencev < -32768 || preferencev > 32767)
+ {
+ vty_out (vty, "%% Invalid preference %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
+
+ ifc = connected_check_ptp (ifp, (struct prefix *) &lp,
+ (struct prefix *)(peer_str ? &pp : NULL));
if (! ifc)
{
ifc = connected_new ();
@@ -1184,14 +1226,23 @@ ip_address_install (struct vty *vty, struct interface *ifp,
/* Address. */
p = prefix_ipv4_new ();
- *p = cp;
+ *p = lp;
ifc->address = (struct prefix *) p;
+ ifc->scope = scopev;
+ ifc->preference = preferencev;
- /* Broadcast. */
- if (p->prefixlen <= IPV4_MAX_PREFIXLEN-2)
+ if (peer_str)
{
+ SET_FLAG(ifc->flags, ZEBRA_IFA_PEER);
p = prefix_ipv4_new ();
- *p = cp;
+ *p = pp;
+ ifc->destination = (struct prefix *) p;
+ }
+ else if (p->prefixlen <= IPV4_MAX_PREFIXLEN-2)
+ {
+ /* Broadcast. */
+ p = prefix_ipv4_new ();
+ *p = lp;
p->prefix.s_addr = ipv4_broadcast_addr(p->prefix.s_addr,p->prefixlen);
ifc->destination = (struct prefix *) p;
}
@@ -1246,23 +1297,40 @@ ip_address_install (struct vty *vty, struct interface *ifp,
static int
ip_address_uninstall (struct vty *vty, struct interface *ifp,
- const char *addr_str, const char *peer_str,
- const char *label)
+ const char *addr_str, const char *peer_str)
{
- struct prefix_ipv4 cp;
+ struct prefix_ipv4 lp, pp;
struct connected *ifc;
int ret;
/* Convert to prefix structure. */
- ret = str2prefix_ipv4 (addr_str, &cp);
+ ret = str2prefix_ipv4 (addr_str, &lp);
if (ret <= 0)
{
vty_out (vty, "%% Malformed address %s", VTY_NEWLINE);
return CMD_WARNING;
}
+ if (peer_str)
+ {
+ if (lp.prefixlen != 32)
+ {
+ vty_out (vty, "%% Local prefix length for P-t-P address "
+ "must be /32%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ret = str2prefix_ipv4 (peer_str, &pp);
+ if (ret <= 0)
+ {
+ vty_out (vty, "%% Malformed peer address %s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ }
+
/* Check current interface address. */
- ifc = connected_check (ifp, (struct prefix *) &cp);
+ ifc = connected_check_ptp (ifp, (struct prefix *) &lp,
+ (struct prefix *)(peer_str ? &pp : NULL));
if (! ifc)
{
vty_out (vty, "%% Can't find address%s", VTY_NEWLINE);
@@ -1292,70 +1360,169 @@ ip_address_uninstall (struct vty *vty, struct interface *ifp,
safe_strerror(errno), VTY_NEWLINE);
return CMD_WARNING;
}
+ /* success! now update all internal state... */
+
+ /* Remove connected route. */
+ connected_down_ipv4 (ifp, ifc);
-#if 0
/* Redistribute this information. */
zebra_interface_address_delete_update (ifp, ifc);
- /* Remove connected route. */
- connected_down_ipv4 (ifp, ifc);
+ /* IP address propery set. */
+ UNSET_FLAG (ifc->conf, ZEBRA_IFC_REAL);
+
+ /* remove from interface, remark secondaries */
+ if_subnet_delete (ifp, ifc);
/* Free address information. */
listnode_delete (ifp->connected, ifc);
connected_free (ifc);
-#endif
return CMD_SUCCESS;
}
+#define IP_ADDR_STR \
+ "Interface Internet Protocol config commands\n" \
+ "Set the IP address of an interface\n" \
+ "IP address (e.g. 10.0.0.1/8)\n"
+#define IP_ADDR_PEER_STR \
+ "Interface Internet Protocol config commands\n" \
+ "Set the IP address of an interface\n" \
+ "Local IP (e.g. 10.0.0.1) for P-t-P address\n" \
+ "Specify P-t-P address\n" \
+ "Peer IP address (e.g. 10.0.0.1/8)\n"
+
DEFUN (ip_address,
ip_address_cmd,
"ip address A.B.C.D/M",
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "IP address (e.g. 10.0.0.1/8)\n")
+ IP_ADDR_STR)
{
- return ip_address_install (vty, vty->index, argv[0], NULL, NULL);
+ return ip_address_install (vty, vty->index, argv[0], NULL,
+ NULL, NULL, NULL);
}
DEFUN (no_ip_address,
no_ip_address_cmd,
"no ip address A.B.C.D/M",
- NO_STR
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "IP Address (e.g. 10.0.0.1/8)")
+ NO_STR IP_ADDR_STR)
+{
+ return ip_address_uninstall (vty, vty->index, argv[0], NULL);
+}
+
+DEFUN (ip_address_peer,
+ ip_address_peer_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M",
+ IP_ADDR_PEER_STR)
+{
+ return ip_address_install (vty, vty->index, argv[0], argv[1],
+ NULL, NULL, NULL);
+}
+
+DEFUN (no_ip_address_peer,
+ no_ip_address_peer_cmd,
+ "no ip address A.B.C.D peer A.B.C.D/M",
+ NO_STR IP_ADDR_PEER_STR)
{
- return ip_address_uninstall (vty, vty->index, argv[0], NULL, NULL);
+ return ip_address_uninstall (vty, vty->index, argv[0], argv[1]);
}
#ifdef HAVE_NETLINK
DEFUN (ip_address_label,
ip_address_label_cmd,
"ip address A.B.C.D/M label LINE",
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "IP address (e.g. 10.0.0.1/8)\n"
+ IP_ADDR_STR
"Label of this address\n"
"Label\n")
{
- return ip_address_install (vty, vty->index, argv[0], NULL, argv[1]);
+ return ip_address_install (vty, vty->index, argv[0], NULL,
+ argv[1], NULL, NULL);
}
-DEFUN (no_ip_address_label,
- no_ip_address_label_cmd,
- "no ip address A.B.C.D/M label LINE",
- NO_STR
- "Interface Internet Protocol config commands\n"
- "Set the IP address of an interface\n"
- "IP address (e.g. 10.0.0.1/8)\n"
+DEFUN (ip_address_peer_label,
+ ip_address_peer_label_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M label LINE",
+ IP_ADDR_PEER_STR
"Label of this address\n"
"Label\n")
{
- return ip_address_uninstall (vty, vty->index, argv[0], NULL, argv[1]);
+ return ip_address_install (vty, vty->index, argv[0], argv[1],
+ argv[2], NULL, NULL);
+}
+
+DEFUN (ip_address_scope,
+ ip_address_scope_cmd,
+ "ip address A.B.C.D/M scope WORD",
+ IP_ADDR_STR
+ "Scope of this address\n"
+ "Scope (e.g. 0-255 or global,site,link,host,nowhere)\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], NULL,
+ NULL, argv[1], NULL);
}
+
+DEFUN (ip_address_peer_scope,
+ ip_address_peer_scope_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M scope WORD",
+ IP_ADDR_PEER_STR
+ "Scope of this address\n"
+ "Scope (e.g. 0-255 or global,site,link,host,nowhere)\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], argv[1],
+ NULL, argv[2], NULL);
+}
+
+DEFUN (ip_address_scope_label,
+ ip_address_scope_label_cmd,
+ "ip address A.B.C.D/M scope WORD label LINE",
+ IP_ADDR_STR
+ "Scope of this address\n"
+ "Scope (e.g. 0-255 or global,site,link,host,nowhere)\n"
+ "Label of this address\n"
+ "Label\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], NULL,
+ argv[2], argv[1], NULL);
+}
+
+DEFUN (ip_address_peer_scope_label,
+ ip_address_peer_scope_label_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M scope WORD label LINE",
+ IP_ADDR_PEER_STR
+ "Scope of this address\n"
+ "Scope (e.g. 0-255 or global,site,link,host,nowhere)\n"
+ "Label of this address\n"
+ "Label\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], argv[1],
+ argv[3], argv[2], NULL);
+}
+
#endif /* HAVE_NETLINK */
+#ifdef SIOCSIFADDRPREF
+DEFUN (ip_address_pref,
+ ip_address_pref_cmd,
+ "ip address A.B.C.D/M preference WORD",
+ IP_ADDR_STR
+ "specify IPSRCSEL preference\n"
+ "preference value, higher is preferred\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], NULL,
+ NULL, NULL, argv[1]);
+}
+
+DEFUN (ip_address_peer_pref,
+ ip_address_peer_pref_cmd,
+ "ip address A.B.C.D peer A.B.C.D/M preference WORD",
+ IP_ADDR_PEER_STR
+ "specify IPSRCSEL preference\n"
+ "preference value, higher is preferred\n")
+{
+ return ip_address_install (vty, vty->index, argv[0], argv[1],
+ NULL, NULL, argv[2]);
+}
+#endif
+
#ifdef HAVE_IPV6
static int
ipv6_address_install (struct vty *vty, struct interface *ifp,
@@ -1553,14 +1720,27 @@ if_config_write (struct vty *vty)
{
char buf[INET6_ADDRSTRLEN];
p = ifc->address;
- vty_out (vty, " ip%s address %s/%d",
+ vty_out (vty, " ip%s address %s",
p->family == AF_INET ? "" : "v6",
- inet_ntop (p->family, &p->u.prefix, buf, sizeof(buf)),
- p->prefixlen);
+ inet_ntop (p->family, &p->u.prefix, buf, sizeof(buf)));
+ if (CONNECTED_PEER (ifc))
+ {
+ p = ifc->destination;
+ vty_out (vty, " peer %s",
+ inet_ntop (p->family, &p->u.prefix, buf, sizeof(buf)));
+ }
+ vty_out (vty, "/%d", p->prefixlen);
+#ifdef HAVE_NETLINK
+ if (ifc->scope)
+ vty_out (vty, " scope %s", connected_scope_name (ifc->scope));
if (ifc->label)
vty_out (vty, " label %s", ifc->label);
-
+#endif
+#ifdef SIOCSIFADDRPREF
+ if (ifc->preference)
+ vty_out (vty, " preference %d", ifc->preference);
+#endif
vty_out (vty, "%s", VTY_NEWLINE);
}
}
@@ -1620,12 +1800,22 @@ zebra_if_init (void)
install_element (INTERFACE_NODE, &no_bandwidth_if_val_cmd);
install_element (INTERFACE_NODE, &ip_address_cmd);
install_element (INTERFACE_NODE, &no_ip_address_cmd);
+ install_element (INTERFACE_NODE, &ip_address_peer_cmd);
+ install_element (INTERFACE_NODE, &no_ip_address_peer_cmd);
#ifdef HAVE_IPV6
install_element (INTERFACE_NODE, &ipv6_address_cmd);
install_element (INTERFACE_NODE, &no_ipv6_address_cmd);
#endif /* HAVE_IPV6 */
#ifdef HAVE_NETLINK
install_element (INTERFACE_NODE, &ip_address_label_cmd);
- install_element (INTERFACE_NODE, &no_ip_address_label_cmd);
+ install_element (INTERFACE_NODE, &ip_address_scope_cmd);
+ install_element (INTERFACE_NODE, &ip_address_scope_label_cmd);
+ install_element (INTERFACE_NODE, &ip_address_peer_label_cmd);
+ install_element (INTERFACE_NODE, &ip_address_peer_scope_cmd);
+ install_element (INTERFACE_NODE, &ip_address_peer_scope_label_cmd);
#endif /* HAVE_NETLINK */
+#ifdef SIOCSIFADDRPREF
+ install_element (INTERFACE_NODE, &ip_address_pref_cmd);
+ install_element (INTERFACE_NODE, &ip_address_peer_pref_cmd);
+#endif
}
diff --git a/zebra/ioctl.c b/zebra/ioctl.c
index 5cf9e7b0..6cb428a7 100644
--- a/zebra/ioctl.c
+++ b/zebra/ioctl.c
@@ -191,10 +191,16 @@ if_set_prefix (struct interface *ifp, struct connected *ifc)
{
int ret;
struct ifaliasreq addreq;
- struct sockaddr_in addr;
- struct sockaddr_in mask;
+ struct sockaddr_in addr, mask, peer;
struct prefix_ipv4 *p;
+ /* don't configure PtP addresses on broadcast ifs or reverse */
+ if (!(ifp->flags & IFF_POINTOPOINT) != !CONNECTED_PEER (ifc))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
p = (struct prefix_ipv4 *) ifc->address;
rib_lookup_and_pushup (p);
@@ -209,6 +215,18 @@ if_set_prefix (struct interface *ifp, struct connected *ifc)
#endif
memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in));
+ if (CONNECTED_PEER (ifc))
+ {
+ p = (struct prefix_ipv4 *) ifc->destination;
+ memset (&mask, 0, sizeof (struct sockaddr_in));
+ peer.sin_addr = p->prefix;
+ peer.sin_family = p->family;
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ peer.sin_len = sizeof (struct sockaddr_in);
+#endif
+ memcpy (&addreq.ifra_broadaddr, &peer, sizeof (struct sockaddr_in));
+ }
+
memset (&mask, 0, sizeof (struct sockaddr_in));
masklen2ip (p->prefixlen, &mask.sin_addr);
mask.sin_family = p->family;
@@ -216,10 +234,27 @@ if_set_prefix (struct interface *ifp, struct connected *ifc)
mask.sin_len = sizeof (struct sockaddr_in);
#endif
memcpy (&addreq.ifra_mask, &mask, sizeof (struct sockaddr_in));
-
+
ret = if_ioctl (SIOCAIFADDR, (caddr_t) &addreq);
if (ret < 0)
return ret;
+
+#ifdef SIOCSIFADDRPREF
+ if (ifc->preference != 0)
+ {
+ struct if_addrprefreq ifapr;
+
+ memset (&ifapr, 0, sizeof ifapr);
+ strncpy ((char *)&ifapr.ifap_name, ifp->name, sizeof ifapr.ifap_name);
+ ifapr.ifap_preference = ifc->preference;
+ memcpy (&ifapr.ifap_addr, &addr, sizeof (struct sockaddr_in));
+
+ ret = if_ioctl (SIOCSIFADDRPREF, (caddr_t) &ifapr);
+ if (ret < 0)
+ zlog_err("if_ioctl(SIOCSIFADDRPREF) failed: %s",
+ safe_strerror(errno));
+ }
+#endif
return 0;
}
@@ -230,10 +265,16 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
{
int ret;
struct ifaliasreq addreq;
- struct sockaddr_in addr;
- struct sockaddr_in mask;
+ struct sockaddr_in addr, mask, peer;
struct prefix_ipv4 *p;
+ /* this would probably wreak havoc */
+ if (!(ifp->flags & IFF_POINTOPOINT) != !CONNECTED_PEER (ifc))
+ {
+ errno = EINVAL;
+ return -1;
+ }
+
p = (struct prefix_ipv4 *)ifc->address;
memset (&addreq, 0, sizeof addreq);
@@ -247,6 +288,18 @@ if_unset_prefix (struct interface *ifp, struct connected *ifc)
#endif
memcpy (&addreq.ifra_addr, &addr, sizeof (struct sockaddr_in));
+ if (CONNECTED_PEER (ifc))
+ {
+ p = (struct prefix_ipv4 *) ifc->destination;
+ memset (&mask, 0, sizeof (struct sockaddr_in));
+ peer.sin_addr = p->prefix;
+ peer.sin_family = p->family;
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+ peer.sin_len = sizeof (struct sockaddr_in);
+#endif
+ memcpy (&addreq.ifra_broadaddr, &peer, sizeof (struct sockaddr_in));
+ }
+
memset (&mask, 0, sizeof (struct sockaddr_in));
masklen2ip (p->prefixlen, &mask.sin_addr);
mask.sin_family = p->family;
@@ -372,7 +425,7 @@ if_get_flags (struct interface *ifp)
if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_LINKDETECTION))
{
(void) memset(&ifmr, 0, sizeof(ifmr));
- strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ);
+ strncpy (ifmr.ifm_name, ifp->name, IFNAMSIZ);
/* Seems not all interfaces implement this ioctl */
if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0)
diff --git a/zebra/irdp.h b/zebra/irdp.h
index 1f0c1ecd..9ce55e58 100644
--- a/zebra/irdp.h
+++ b/zebra/irdp.h
@@ -146,5 +146,12 @@ extern void irdp_init(void);
extern int irdp_sock_init(void);
extern void irdp_finish(void);
extern void irdp_config_write (struct vty *, struct interface *);
+extern int irdp_send_thread(struct thread *t_advert);
+extern void irdp_advert_off(struct interface *ifp);
+extern void process_solicit (struct interface *ifp);
+extern int irdp_read_raw(struct thread *r);
+extern void send_packet(struct interface *ifp, struct stream *s,
+ u_int32_t dst, struct prefix *p, u_int32_t ttl);
+
#endif /* _IRDP_H */
diff --git a/zebra/irdp_interface.c b/zebra/irdp_interface.c
index d982c23c..8742b62b 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -65,14 +65,19 @@
/* Master of threads. */
extern struct zebra_t zebrad;
-int in_cksum (void *ptr, int nbytes);
extern int irdp_sock;
-int irdp_send_thread(struct thread *t_advert);
-char *inet_2a(u_int32_t a, char *b);
-void irdp_advert_off(struct interface *ifp);
+static const char *
+inet_2a(u_int32_t a, char *b)
+{
+ sprintf(b, "%u.%u.%u.%u",
+ (a ) & 0xFF,
+ (a>> 8) & 0xFF,
+ (a>>16) & 0xFF,
+ (a>>24) & 0xFF);
+ return b;
+}
-char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */
static struct prefix *
irdp_get_prefix(struct interface *ifp)
@@ -98,6 +103,7 @@ if_group (struct interface *ifp,
struct ip_mreq m;
struct prefix *p;
int ret;
+ char b1[INET_ADDRSTRLEN];
zi = ifp->info;
@@ -117,8 +123,8 @@ if_group (struct interface *ifp,
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));
+ inet_2a(group, b1),
+ safe_strerror (errno));
return ret;
}
@@ -129,6 +135,7 @@ if_add_group (struct interface *ifp)
struct zebra_if *zi= ifp->info;
struct irdp_interface *irdp = &zi->irdp;
int ret;
+ char b1[INET_ADDRSTRLEN];
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_ADD_MEMBERSHIP);
if (ret < 0) {
@@ -148,6 +155,7 @@ if_drop_group (struct interface *ifp)
struct zebra_if *zi= ifp->info;
struct irdp_interface *irdp = &zi->irdp;
int ret;
+ char b1[INET_ADDRSTRLEN];
ret = if_group (ifp, irdp_sock, INADDR_ALLRTRS_GROUP, IP_DROP_MEMBERSHIP);
if (ret < 0)
@@ -173,7 +181,7 @@ if_set_defaults(struct interface *ifp)
}
-struct Adv *Adv_new (void)
+static struct Adv *Adv_new (void)
{
return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
}
@@ -338,6 +346,7 @@ void irdp_config_write (struct vty *vty, struct interface *ifp)
struct irdp_interface *irdp=&zi->irdp;
struct Adv *adv;
struct listnode *node;
+ char b1[INET_ADDRSTRLEN];
if(irdp->flags & IF_ACTIVE || irdp->flags & IF_SHUTDOWN) {
diff --git a/zebra/irdp_main.c b/zebra/irdp_main.c
index 55106699..c297979c 100644
--- a/zebra/irdp_main.c
+++ b/zebra/irdp_main.c
@@ -60,6 +60,7 @@
#include "zebra/irdp.h"
#include <netinet/ip_icmp.h>
+#include "checksum.h"
#include "if.h"
#include "sockunion.h"
#include "log.h"
@@ -75,25 +76,6 @@ struct thread *t_irdp_raw;
/* Timer interval of irdp. */
int irdp_timer_interval = IRDP_DEFAULT_INTERVAL;
-int irdp_read_raw(struct thread *r);
-int in_cksum (void *ptr, int nbytes);
-void send_packet(struct interface *ifp,
- struct stream *s,
- u_int32_t dst,
- struct prefix *p,
- u_int32_t ttl);
-
-char *
-inet_2a(u_int32_t a, char *b)
-{
- sprintf(b, "%u.%u.%u.%u",
- (a ) & 0xFF,
- (a>> 8) & 0xFF,
- (a>>16) & 0xFF,
- (a>>24) & 0xFF);
- return b;
-}
-
int
irdp_sock_init (void)
{
diff --git a/zebra/irdp_packet.c b/zebra/irdp_packet.c
index 60038372..28dc171e 100644
--- a/zebra/irdp_packet.c
+++ b/zebra/irdp_packet.c
@@ -59,6 +59,7 @@
#include "zebra/irdp.h"
#include <netinet/ip_icmp.h>
#include "if.h"
+#include "checksum.h"
#include "sockunion.h"
#include "log.h"
#include "sockopt.h"
@@ -67,12 +68,9 @@
/* GLOBAL VARS */
int irdp_sock = -1;
-char b1[16], b2[16], b3[16], b4[16]; /* For inet_2a */
extern struct zebra_t zebrad;
extern struct thread *t_irdp_raw;
-int in_cksum (void *ptr, int nbytes);
-void process_solicit (struct interface *ifp);
static void
parse_irdp_packet(char *p,
@@ -231,7 +229,7 @@ int irdp_read_raw(struct thread *r)
struct zebra_if *zi;
struct irdp_interface *irdp;
char buf[IRDP_RX_BUF];
- int ret, ifindex;
+ int ret, ifindex = 0;
int irdp_sock = THREAD_FD (r);
t_irdp_raw = thread_add_read (zebrad.master, irdp_read_raw, NULL, irdp_sock);
diff --git a/zebra/kernel_null.c b/zebra/kernel_null.c
index 6b96c6df..f83c2345 100644
--- a/zebra/kernel_null.c
+++ b/zebra/kernel_null.c
@@ -25,7 +25,7 @@ int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
SET_FLAG (b->conf, ZEBRA_IFC_REAL);
connected_add_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
(b->destination ? &b->destination->u.prefix4 : NULL),
- NULL);
+ NULL, 0, 0);
return 0;
}
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 8beac71d..aa962a35 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -173,7 +173,9 @@ static const struct message rtm_flag_str[] =
#ifdef RTF_MASK
{RTF_MASK, "MASK"},
#endif /* RTF_MASK */
+#ifdef RTF_CLONING
{RTF_CLONING, "CLONING"},
+#endif /* RTF_CLONING */
{RTF_XRESOLVE, "XRESOLVE"},
{RTF_LLINFO, "LLINFO"},
{RTF_STATIC, "STATIC"},
@@ -236,7 +238,7 @@ af_check (int family)
static void
rtm_flag_dump (int flag)
{
- struct message *mes;
+ const struct message *mes;
static char buf[BUFSIZ];
buf[0] = '\0';
@@ -251,6 +253,25 @@ rtm_flag_dump (int flag)
zlog_debug ("Kernel: %s", buf);
}
+/* NetBSD IPSRCSEL preference readback */
+static int
+if_get_addrpref (const char *ifname, struct sockaddr_in *addr)
+{
+#ifdef SIOCSIFADDRPREF
+ int ret;
+ struct if_addrprefreq ifapr;
+
+ memset (&ifapr, 0, sizeof ifapr);
+ strncpy ((char *)&ifapr.ifap_name, ifname, sizeof ifapr.ifap_name);
+ memcpy (&ifapr.ifap_addr, addr, sizeof (struct sockaddr_in));
+
+ ret = if_ioctl (SIOCGIFADDRPREF, (caddr_t) &ifapr);
+ if (ret == 0)
+ return ifapr.ifap_preference;
+#endif
+ return 0;
+}
+
#ifdef RTM_IFANNOUNCE
/* Interface adding function */
static int
@@ -617,6 +638,7 @@ ifam_read (struct ifa_msghdr *ifam)
short ifnlen = 0;
char isalias = 0;
int flags = 0;
+ int preference = 0;
ifname[0] = ifname[INTERFACE_NAMSIZ - 1] = '\0';
@@ -647,6 +669,9 @@ ifam_read (struct ifa_msghdr *ifam)
*/
ifp->metric = ifam->ifam_metric;
#endif
+ if (sockunion_family (&addr) == AF_INET
+ && ifam->ifam_type == RTM_NEWADDR)
+ preference = if_get_addrpref (ifp->name, &addr.sin);
/* Add connected address. */
switch (sockunion_family (&addr))
@@ -656,7 +681,7 @@ ifam_read (struct ifa_msghdr *ifam)
connected_add_ipv4 (ifp, flags, &addr.sin.sin_addr,
ip_masklen (mask.sin.sin_addr),
&brd.sin.sin_addr,
- (isalias ? ifname : NULL));
+ (isalias ? ifname : NULL), 0, preference);
else
connected_delete_ipv4 (ifp, flags, &addr.sin.sin_addr,
ip_masklen (mask.sin.sin_addr),
@@ -673,7 +698,7 @@ ifam_read (struct ifa_msghdr *ifam)
connected_add_ipv6 (ifp, flags, &addr.sin6.sin6_addr,
ip6_masklen (mask.sin6.sin6_addr),
&brd.sin6.sin6_addr,
- (isalias ? ifname : NULL));
+ (isalias ? ifname : NULL), 0);
else
connected_delete_ipv6 (ifp,
&addr.sin6.sin6_addr,
@@ -999,9 +1024,14 @@ rtm_write (int message,
if (gate && message == RTM_ADD)
msg.rtm.rtm_flags |= RTF_GATEWAY;
+ /* When RTF_CLONING is unavailable on BSD, should we set some
+ * other flag instead?
+ */
+#ifdef RTF_CLONING
if (! gate && message == RTM_ADD && ifp &&
(ifp->flags & IFF_POINTOPOINT) == 0)
msg.rtm.rtm_flags |= RTF_CLONING;
+#endif /* RTF_CLONING */
/* If no protocol specific gateway is specified, use link
address for gateway. */
diff --git a/zebra/main.c b/zebra/main.c
index d829c046..b58fed12 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -32,6 +32,7 @@
#include "plist.h"
#include "privs.h"
#include "sigevent.h"
+#include "paths.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
@@ -68,6 +69,7 @@ struct option longopts[] =
{
{ "batch", no_argument, NULL, 'b'},
{ "daemon", no_argument, NULL, 'd'},
+ { "namespace", required_argument, NULL, 'N'},
{ "keep_kernel", no_argument, NULL, 'k'},
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
@@ -108,10 +110,13 @@ struct zebra_privs_t zserv_privs =
};
/* Default configuration file path. */
-char config_default[] = SYSCONFDIR DEFAULT_CONFIG_FILE;
+char config_default[MAXPATHLEN];
+
+/* pid_file default value */
+static char pid_file_default[MAXPATHLEN];
/* Process ID saved for use by init system */
-const char *pid_file = PATH_ZEBRA_PID;
+const char *pid_file = pid_file_default;
/* Help information display. */
static void
@@ -126,6 +131,7 @@ usage (char *progname, int status)
"redistribution between different routing protocols.\n\n"\
"-b, --batch Runs in batch mode\n"\
"-d, --daemon Runs in daemon mode\n"\
+ "-N, --namespace Insert argument into all paths\n"\
"-f, --config_file Set configuration file name\n"\
"-i, --pid_file Set process identifier file name\n"\
"-k, --keep_kernel Don't delete old routes which installed by "\
@@ -229,9 +235,9 @@ main (int argc, char **argv)
int opt;
#ifdef HAVE_NETLINK
- opt = getopt_long (argc, argv, "bdkf:i:hA:P:ru:g:vs:C", longopts, 0);
+ opt = getopt_long (argc, argv, "bdN:kf:i:hA:P:ru:g:vs:C", longopts, 0);
#else
- opt = getopt_long (argc, argv, "bdkf:i:hA:P:ru:g:vC", longopts, 0);
+ opt = getopt_long (argc, argv, "bdN:kf:i:hA:P:ru:g:vC", longopts, 0);
#endif /* HAVE_NETLINK */
if (opt == EOF)
@@ -246,6 +252,9 @@ main (int argc, char **argv)
case 'd':
daemon_mode = 1;
break;
+ case 'N':
+ path_set_namespace (optarg);
+ break;
case 'k':
keep_kernel_mode = 1;
break;
@@ -300,6 +309,9 @@ main (int argc, char **argv)
}
}
+ strcpy (config_default, path_config (ZEBRA_CONFIG_NAME));
+ strcpy (pid_file_default, path_state (ZEBRA_PID_NAME));
+
/* Make master thread emulator. */
zebrad.master = thread_master_create ();
@@ -389,7 +401,7 @@ main (int argc, char **argv)
zebra_zserv_socket_init ();
/* Make vty server socket. */
- vty_serv_sock (vty_addr, vty_port, ZEBRA_VTYSH_PATH);
+ vty_serv_sock (vty_addr, vty_port, path_state (ZEBRA_VTY_NAME));
/* Print banner. */
zlog_notice ("Zebra %s starting: vty@%d", QUAGGA_VERSION, vty_port);
diff --git a/zebra/redistribute.c b/zebra/redistribute.c
index a8107aeb..4276f1d0 100644
--- a/zebra/redistribute.c
+++ b/zebra/redistribute.c
@@ -245,26 +245,15 @@ zebra_redistribute_add (int command, struct zserv *client, int length)
type = stream_getc (client->ibuf);
- switch (type)
+ if (type == 0 || type >= ZEBRA_ROUTE_MAX)
+ return;
+
+ if (! client->redist[type])
{
- case ZEBRA_ROUTE_KERNEL:
- case ZEBRA_ROUTE_CONNECT:
- case ZEBRA_ROUTE_STATIC:
- case ZEBRA_ROUTE_RIP:
- case ZEBRA_ROUTE_RIPNG:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_BGP:
- if (! client->redist[type])
- {
- client->redist[type] = 1;
- zebra_redistribute (client, type);
- }
- break;
- default:
- break;
+ client->redist[type] = 1;
+ zebra_redistribute (client, type);
}
-}
+}
void
zebra_redistribute_delete (int command, struct zserv *client, int length)
@@ -273,22 +262,11 @@ zebra_redistribute_delete (int command, struct zserv *client, int length)
type = stream_getc (client->ibuf);
- switch (type)
- {
- case ZEBRA_ROUTE_KERNEL:
- case ZEBRA_ROUTE_CONNECT:
- case ZEBRA_ROUTE_STATIC:
- case ZEBRA_ROUTE_RIP:
- case ZEBRA_ROUTE_RIPNG:
- case ZEBRA_ROUTE_OSPF:
- case ZEBRA_ROUTE_OSPF6:
- case ZEBRA_ROUTE_BGP:
- client->redist[type] = 0;
- break;
- default:
- break;
- }
-}
+ if (type == 0 || type >= ZEBRA_ROUTE_MAX)
+ return;
+
+ client->redist[type] = 0;
+}
void
zebra_redistribute_default_add (int command, struct zserv *client, int length)
diff --git a/zebra/router-id.c b/zebra/router-id.c
index 41bab545..3d6b511c 100644
--- a/zebra/router-id.c
+++ b/zebra/router-id.c
@@ -136,7 +136,7 @@ router_id_add_address (struct connected *ifc)
l = &rid_all_sorted_list;
if (!router_id_find_node (l, ifc))
- listnode_add (l, ifc);
+ listnode_add_sort (l, ifc);
router_id_get (&after);
@@ -228,16 +228,12 @@ DEFUN (no_router_id,
static int
router_id_cmp (void *a, void *b)
{
- unsigned int A, B;
+ const struct connected *ifa = (const struct connected *)a;
+ const struct connected *ifb = (const struct connected *)b;
+ unsigned int A = ntohl(ifa->address->u.prefix4.s_addr);
+ unsigned int B = ntohl(ifb->address->u.prefix4.s_addr);
- A = ((struct connected *) a)->address->u.prefix4.s_addr;
- B = ((struct connected *) b)->address->u.prefix4.s_addr;
-
- if (A > B)
- return 1;
- else if (A < B)
- return -1;
- return 0;
+ return (int) (A - B);
}
void
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 7652f80a..d25543ff 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -549,6 +549,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
char buf[BUFSIZ];
zlog_debug ("netlink_interface_addr %s %s:",
lookup (nlmsg_str, h->nlmsg_type), ifp->name);
+ zlog_debug (" ifa_scope %s", connected_scope_name (ifa->ifa_scope));
if (tb[IFA_LOCAL])
zlog_debug (" IFA_LOCAL %s/%d",
inet_ntop (ifa->ifa_family, RTA_DATA (tb[IFA_LOCAL]),
@@ -616,7 +617,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (h->nlmsg_type == RTM_NEWADDR)
connected_add_ipv4 (ifp, flags,
(struct in_addr *) addr, ifa->ifa_prefixlen,
- (struct in_addr *) broad, label);
+ (struct in_addr *) broad, label, ifa->ifa_scope, 0);
else
connected_delete_ipv4 (ifp, flags,
(struct in_addr *) addr, ifa->ifa_prefixlen,
@@ -628,7 +629,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
if (h->nlmsg_type == RTM_NEWADDR)
connected_add_ipv6 (ifp, flags,
(struct in6_addr *) addr, ifa->ifa_prefixlen,
- (struct in6_addr *) broad, label);
+ (struct in6_addr *) broad, label, ifa->ifa_scope);
else
connected_delete_ipv6 (ifp,
(struct in6_addr *) addr, ifa->ifa_prefixlen,
@@ -1778,20 +1779,30 @@ netlink_address (int cmd, int family, struct interface *ifp,
req.ifa.ifa_family = family;
req.ifa.ifa_index = ifp->ifindex;
- req.ifa.ifa_prefixlen = p->prefixlen;
+ req.ifa.ifa_scope = ifc->scope;
addattr_l (&req.n, sizeof req, IFA_LOCAL, &p->u.prefix, bytelen);
- if (family == AF_INET && cmd == RTM_NEWADDR)
+ if (family == AF_INET)
{
- if (!CONNECTED_PEER(ifc) && ifc->destination)
+ if (CONNECTED_PEER(ifc))
{
p = ifc->destination;
- addattr_l (&req.n, sizeof req, IFA_BROADCAST, &p->u.prefix,
+ addattr_l (&req.n, sizeof req, IFA_ADDRESS, &p->u.prefix,
bytelen);
}
+ else
+ if (cmd == RTM_NEWADDR && ifc->destination)
+ {
+ p = ifc->destination;
+ addattr_l (&req.n, sizeof req, IFA_BROADCAST, &p->u.prefix,
+ bytelen);
+ }
}
+ /* p is now either ifc->address or ifc->destination */
+ req.ifa.ifa_prefixlen = p->prefixlen;
+
if (CHECK_FLAG (ifc->flags, ZEBRA_IFA_SECONDARY))
SET_FLAG (req.ifa.ifa_flags, IFA_F_SECONDARY);
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 0bcdafb0..8cc3c4cb 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -87,12 +87,6 @@ rtadv_new (void)
return XCALLOC (MTYPE_TMP, sizeof (struct rtadv));
}
-static void
-rtadv_free (struct rtadv *rtadv)
-{
- XFREE (MTYPE_TMP, rtadv);
-}
-
static int
rtadv_recv_packet (int sock, u_char *buf, int buflen,
struct sockaddr_in6 *from, unsigned int *ifindex,
@@ -138,7 +132,10 @@ rtadv_recv_packet (int sock, u_char *buf, int buflen,
/* Incoming packet's hop limit. */
if (cmsgptr->cmsg_level == IPPROTO_IPV6 &&
cmsgptr->cmsg_type == IPV6_HOPLIMIT)
- *hoplimit = *((int *) CMSG_DATA (cmsgptr));
+ {
+ int *hoptr = (int *) CMSG_DATA (cmsgptr);
+ *hoplimit = *hoptr;
+ }
}
return ret;
}
@@ -467,7 +464,7 @@ rtadv_read (struct thread *thread)
int len;
u_char buf[RTADV_MSG_SIZE];
struct sockaddr_in6 from;
- unsigned int ifindex;
+ unsigned int ifindex = 0;
int hoplimit = -1;
sock = THREAD_FD (thread);
diff --git a/zebra/test_main.c b/zebra/test_main.c
index 70a1a3a6..4e1002e8 100644
--- a/zebra/test_main.c
+++ b/zebra/test_main.c
@@ -29,6 +29,7 @@
#include "log.h"
#include "privs.h"
#include "sigevent.h"
+#include "paths.h"
#include "zebra/rib.h"
#include "zebra/zserv.h"
@@ -73,10 +74,13 @@ zebra_capabilities_t _caps_p [] =
};
/* Default configuration file path. */
-char config_default[] = SYSCONFDIR DEFAULT_CONFIG_FILE;
+char config_default[MAXPATHLEN];
+
+/* pid_file default value */
+static char pid_file_default[MAXPATHLEN];
/* Process ID saved for use by init system */
-const char *pid_file = PATH_ZEBRA_PID;
+const char *pid_file = pid_file_default;
/* Help information display. */
static void
@@ -276,6 +280,9 @@ main (int argc, char **argv)
usage (progname, 1);
}
+ strcpy (config_default, path_config (ZEBRA_CONFIG_NAME));
+ strcpy (pid_file_default, path_state (ZEBRA_PID_NAME));
+
/* Make master thread emulator. */
zebrad.master = thread_master_create ();
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 1c82f9b0..29a8e40b 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -67,6 +67,7 @@ static const struct
{ZEBRA_ROUTE_OSPF6, 110},
{ZEBRA_ROUTE_ISIS, 115},
{ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */}
+ /* no entry/default: 150 */
};
/* Vector for routing table. */
@@ -93,15 +94,6 @@ vrf_alloc (const char *name)
return vrf;
}
-/* Free VRF. */
-static void
-vrf_free (struct vrf *vrf)
-{
- if (vrf->name)
- XFREE (MTYPE_VRF_NAME, vrf->name);
- XFREE (MTYPE_VRF, vrf);
-}
-
/* Lookup VRF by identifier. */
struct vrf *
vrf_lookup (u_int32_t id)
@@ -109,20 +101,6 @@ vrf_lookup (u_int32_t id)
return vector_lookup (vrf_vector, id);
}
-/* Lookup VRF by name. */
-static struct vrf *
-vrf_lookup_by_name (char *name)
-{
- unsigned int i;
- struct vrf *vrf;
-
- for (i = 0; i < vector_active (vrf_vector); i++)
- if ((vrf = vector_slot (vrf_vector, i)) != NULL)
- if (vrf->name && name && strcmp (vrf->name, name) == 0)
- return vrf;
- return NULL;
-}
-
/* Initialize VRF. */
static void
vrf_init (void)
@@ -362,7 +340,7 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
{
route_unlock_node (rn);
- /* If lookup self prefix return immidiately. */
+ /* If lookup self prefix return immediately. */
if (rn == top)
return 0;
@@ -399,7 +377,8 @@ nexthop_active_ipv4 (struct rib *rib, struct nexthop *nexthop, int set,
}
else
{
- if (match->type == ZEBRA_ROUTE_CONNECT)
+ if (match->type == ZEBRA_ROUTE_CONNECT
+ || (match->nexthop && match->nexthop->type == NEXTHOP_TYPE_IFINDEX))
{
/* Directly point connected route. */
newhop = match->nexthop;
@@ -475,7 +454,7 @@ nexthop_active_ipv6 (struct rib *rib, struct nexthop *nexthop, int set,
{
route_unlock_node (rn);
- /* If lookup self prefix return immidiately. */
+ /* If lookup self prefix return immediately. */
if (rn == top)
return 0;
@@ -840,7 +819,7 @@ static void nexthop_dump(struct nexthop *nexthop,
* The return value is the final value of 'ACTIVE' flag.
*/
-static int
+static unsigned
nexthop_active_check (struct route_node *rn, struct rib *rib,
struct nexthop *nexthop, int set)
{
@@ -971,7 +950,7 @@ static int
nexthop_active_update (struct route_node *rn, struct rib *rib, int set)
{
struct nexthop *nexthop;
- int prev_active, prev_index, new_active;
+ unsigned int prev_active, prev_index, new_active;
rib->nexthop_active_num = 0;
UNSET_FLAG (rib->flags, ZEBRA_FLAG_CHANGED);
@@ -1384,49 +1363,28 @@ rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn)
static void
rib_queue_add (struct zebra_t *zebra, struct route_node *rn)
{
- char buf[INET_ADDRSTRLEN];
- assert (zebra && rn);
if (IS_ZEBRA_DEBUG_RIB_Q)
- inet_ntop (AF_INET, &rn->p.u.prefix, buf, INET_ADDRSTRLEN);
-
- /* Pointless to queue a route_node with no RIB entries to add or remove */
- if (!rn->info)
{
- zlog_debug ("%s: called for route_node (%p, %d) with no ribs",
- __func__, rn, rn->lock);
- zlog_backtrace(LOG_DEBUG);
- return;
- }
-
- if (IS_ZEBRA_DEBUG_RIB_Q)
- zlog_info ("%s: %s/%d: work queue added", __func__, buf, rn->p.prefixlen);
+ char buf[INET6_ADDRSTRLEN];
- assert (zebra);
-
- if (zebra->ribq == NULL)
- {
- zlog_err ("%s: work_queue does not exist!", __func__);
- return;
+ zlog_info ("%s: %s/%d: work queue added", __func__,
+ inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN),
+ rn->p.prefixlen);
}
- /* The RIB queue should normally be either empty or holding the only work_queue_item
- * element. In the latter case this element would hold a pointer to the meta queue
- * structure, which must be used to actually queue the route nodes to process. So
- * create the MQ holder, if necessary, then push the work into it in any case.
+ /*
+ * The RIB queue should normally be either empty or holding the only
+ * work_queue_item element. In the latter case this element would
+ * hold a pointer to the meta queue structure, which must be used to
+ * actually queue the route nodes to process. So create the MQ
+ * holder, if necessary, then push the work into it in any case.
* This semantics was introduced after 0.99.9 release.
*/
-
- /* Should I invent work_queue_empty() and use it, or it's Ok to do as follows? */
if (!zebra->ribq->items->count)
work_queue_add (zebra->ribq, zebra->mq);
rib_meta_queue_add (zebra->mq, rn);
-
- if (IS_ZEBRA_DEBUG_RIB_Q)
- zlog_debug ("%s: %s/%d: rn %p queued", __func__, buf, rn->p.prefixlen, rn);
-
- return;
}
/* Create new meta queue.
@@ -1454,8 +1412,6 @@ meta_queue_new (void)
static void
rib_queue_init (struct zebra_t *zebra)
{
- assert (zebra);
-
if (! (zebra->ribq = work_queue_new (zebra->master,
"route_node processing")))
{
@@ -1471,11 +1427,7 @@ rib_queue_init (struct zebra_t *zebra)
zebra->ribq->spec.hold = rib_process_hold_time;
if (!(zebra->mq = meta_queue_new ()))
- {
zlog_err ("%s: could not initialise meta queue!", __func__);
- return;
- }
- return;
}
/* RIB updates are processed via a queue of pointers to route_nodes.
@@ -1651,7 +1603,10 @@ rib_add_ipv4 (int type, int flags, struct prefix_ipv4 *p,
/* Set default distance by route type. */
if (distance == 0)
{
- distance = route_info[type].distance;
+ if ((unsigned)type >= sizeof(route_info) / sizeof(route_info[0]))
+ distance = 150;
+ else
+ distance = route_info[type].distance;
/* iBGP distance is 200. */
if (type == ZEBRA_ROUTE_BGP && CHECK_FLAG (flags, ZEBRA_FLAG_IBGP))
@@ -1743,10 +1698,10 @@ void rib_dump (const char * func, const struct prefix_ipv4 * p, const struct rib
zlog_debug ("%s: dumping RIB entry %p for %s/%d", func, rib, straddr1, p->prefixlen);
zlog_debug
(
- "%s: refcnt == %lu, uptime == %u, type == %u, table == %d",
+ "%s: refcnt == %lu, uptime == %lu, type == %u, table == %d",
func,
rib->refcnt,
- rib->uptime,
+ (unsigned long) rib->uptime,
rib->type,
rib->table
);
@@ -2950,19 +2905,6 @@ rib_update (void)
rib_queue_add (&zebrad, rn);
}
-/* Interface goes up. */
-static void
-rib_if_up (struct interface *ifp)
-{
- rib_update ();
-}
-
-/* Interface goes down. */
-static void
-rib_if_down (struct interface *ifp)
-{
- rib_update ();
-}
/* Remove all routes which comes from non main table. */
static void
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index ecb5d10a..05485a13 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -802,10 +802,6 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
}
}
-#define SHOW_ROUTE_V4_HEADER "Codes: K - kernel route, C - connected, " \
- "S - static, R - RIP, O - OSPF,%s I - ISIS, B - BGP, " \
- "> - selected route, * - FIB route%s%s"
-
DEFUN (show_ip_route,
show_ip_route_cmd,
"show ip route",
@@ -828,8 +824,7 @@ DEFUN (show_ip_route,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE, VTY_NEWLINE,
- VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
vty_show_ip_route (vty, rn, rib);
@@ -871,8 +866,7 @@ DEFUN (show_ip_route_prefix_longer,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
vty_show_ip_route (vty, rn, rib);
@@ -910,8 +904,7 @@ DEFUN (show_ip_route_supernets,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER, VTY_NEWLINE,
- VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
vty_show_ip_route (vty, rn, rib);
@@ -922,17 +915,11 @@ DEFUN (show_ip_route_supernets,
DEFUN (show_ip_route_protocol,
show_ip_route_protocol_cmd,
- "show ip route (bgp|connected|isis|kernel|ospf|rip|static)",
+ "show ip route " QUAGGA_IP_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
"IP routing table\n"
- "Border Gateway Protocol (BGP)\n"
- "Connected\n"
- "ISO IS-IS (ISIS)\n"
- "Kernel\n"
- "Open Shortest Path First (OSPF)\n"
- "Routing Information Protocol (RIP)\n"
- "Static routes\n")
+ QUAGGA_IP_REDIST_HELP_STR_ZEBRA)
{
int type;
struct route_table *table;
@@ -940,21 +927,8 @@ DEFUN (show_ip_route_protocol,
struct rib *rib;
int first = 1;
- if (strncmp (argv[0], "b", 1) == 0)
- type = ZEBRA_ROUTE_BGP;
- else if (strncmp (argv[0], "c", 1) == 0)
- type = ZEBRA_ROUTE_CONNECT;
- else if (strncmp (argv[0], "k", 1) ==0)
- type = ZEBRA_ROUTE_KERNEL;
- else if (strncmp (argv[0], "o", 1) == 0)
- type = ZEBRA_ROUTE_OSPF;
- else if (strncmp (argv[0], "i", 1) == 0)
- type = ZEBRA_ROUTE_ISIS;
- else if (strncmp (argv[0], "r", 1) == 0)
- type = ZEBRA_ROUTE_RIP;
- else if (strncmp (argv[0], "s", 1) == 0)
- type = ZEBRA_ROUTE_STATIC;
- else
+ type = proto_redistnum (AFI_IP, argv[0]);
+ if (type < 0)
{
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -971,8 +945,7 @@ DEFUN (show_ip_route_protocol,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V4_HEADER,
- VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V4_HEADER);
first = 0;
}
vty_show_ip_route (vty, rn, rib);
@@ -1766,8 +1739,6 @@ vty_show_ipv6_route (struct vty *vty, struct route_node *rn,
}
}
-#define SHOW_ROUTE_V6_HEADER "Codes: K - kernel route, C - connected, S - static, R - RIPng, O - OSPFv3,%s I - ISIS, B - BGP, * - FIB route.%s%s"
-
DEFUN (show_ipv6_route,
show_ipv6_route_cmd,
"show ipv6 route",
@@ -1790,7 +1761,7 @@ DEFUN (show_ipv6_route,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
vty_show_ipv6_route (vty, rn, rib);
@@ -1832,7 +1803,7 @@ DEFUN (show_ipv6_route_prefix_longer,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
vty_show_ipv6_route (vty, rn, rib);
@@ -1842,17 +1813,11 @@ DEFUN (show_ipv6_route_prefix_longer,
DEFUN (show_ipv6_route_protocol,
show_ipv6_route_protocol_cmd,
- "show ipv6 route (bgp|connected|isis|kernel|ospf6|ripng|static)",
+ "show ipv6 route " QUAGGA_IP6_REDIST_STR_ZEBRA,
SHOW_STR
IP_STR
"IP routing table\n"
- "Border Gateway Protocol (BGP)\n"
- "Connected\n"
- "ISO IS-IS (ISIS)\n"
- "Kernel\n"
- "Open Shortest Path First (OSPFv3)\n"
- "Routing Information Protocol (RIPng)\n"
- "Static routes\n")
+ QUAGGA_IP6_REDIST_HELP_STR_ZEBRA)
{
int type;
struct route_table *table;
@@ -1860,21 +1825,8 @@ DEFUN (show_ipv6_route_protocol,
struct rib *rib;
int first = 1;
- if (strncmp (argv[0], "b", 1) == 0)
- type = ZEBRA_ROUTE_BGP;
- else if (strncmp (argv[0], "c", 1) == 0)
- type = ZEBRA_ROUTE_CONNECT;
- else if (strncmp (argv[0], "k", 1) ==0)
- type = ZEBRA_ROUTE_KERNEL;
- else if (strncmp (argv[0], "o", 1) == 0)
- type = ZEBRA_ROUTE_OSPF6;
- else if (strncmp (argv[0], "i", 1) == 0)
- type = ZEBRA_ROUTE_ISIS;
- else if (strncmp (argv[0], "r", 1) == 0)
- type = ZEBRA_ROUTE_RIPNG;
- else if (strncmp (argv[0], "s", 1) == 0)
- type = ZEBRA_ROUTE_STATIC;
- else
+ type = proto_redistnum (AFI_IP6, argv[0]);
+ if (type < 0)
{
vty_out (vty, "Unknown route type%s", VTY_NEWLINE);
return CMD_WARNING;
@@ -1891,7 +1843,7 @@ DEFUN (show_ipv6_route_protocol,
{
if (first)
{
- vty_out (vty, SHOW_ROUTE_V6_HEADER, VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, SHOW_ROUTE_V6_HEADER);
first = 0;
}
vty_show_ipv6_route (vty, rn, rib);
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 9e828654..21f24627 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -37,6 +37,7 @@
#include "privs.h"
#include "network.h"
#include "buffer.h"
+#include "paths.h"
#include "zebra/zserv.h"
#include "zebra/router-id.h"
@@ -1823,6 +1824,6 @@ zebra_zserv_socket_init (void)
#ifdef HAVE_TCP_ZEBRA
zebra_serv ();
#else
- zebra_serv_un (ZEBRA_SERV_PATH);
+ zebra_serv_un (path_state (ZEBRA_SERV_NAME));
#endif /* HAVE_TCP_ZEBRA */
}
diff --git a/zebra/zserv.h b/zebra/zserv.h
index a7371830..cccd9be0 100644
--- a/zebra/zserv.h
+++ b/zebra/zserv.h
@@ -30,7 +30,9 @@
#define ZEBRA_VTY_PORT 2601
/* Default configuration filename. */
-#define DEFAULT_CONFIG_FILE "zebra.conf"
+#define ZEBRA_CONFIG_NAME "zebra.conf"
+#define ZEBRA_PID_NAME "zebra.pid"
+#define ZEBRA_VTY_NAME "zebra.vty"
/* Client structure. */
struct zserv