summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaul <paul>2003-05-30 20:25:10 +0000
committerpaul <paul>2003-05-30 20:25:10 +0000
commit2e6dcf096e3bb95a26cb6ba42aae95f0ee43fea4 (patch)
tree68e52d0fa7260d3c9048d0889ae0abe341e69e4b
parent3abac072c9ed27d211a540e8d41c62ac4f520af7 (diff)
downloadquagga-2e6dcf096e3bb95a26cb6ba42aae95f0ee43fea4.tar.bz2
quagga-2e6dcf096e3bb95a26cb6ba42aae95f0ee43fea4.tar.xz
Sync to HEAD
-rwxr-xr-xconfig.sub2
-rw-r--r--lib/table.c4
-rw-r--r--ospfd/ospf_packet.c44
-rw-r--r--ospfd/ospfd.h6
-rw-r--r--ripngd/ripng_nexthop.h5
-rw-r--r--zebra/zebra_vty.c139
6 files changed, 176 insertions, 24 deletions
diff --git a/config.sub b/config.sub
index 8c16a0ed..c0942312 100755
--- a/config.sub
+++ b/config.sub
@@ -262,7 +262,7 @@ case $basic_machine in
| f301-* | armv*-* | s390-* | sv1-* | t3e-* \
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
- | bs2000-* | tic54x-* | c54x-* | x86_64-*)
+ | bs2000-* | tic54x-* | c54x-* | x86_64-* | cobalt-*)
;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
diff --git a/lib/table.c b/lib/table.c
index 00ba58d9..281dfb64 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -185,8 +185,8 @@ check_bit (u_char *prefix, u_char prefixlen)
}
/* Macro version of set_link (). */
-#define SET_LINK(X,Y) (X)->link[CHECK_BIT(&(Y)->prefix,(X)->prefixlen)] = (Y);\
- (Y)->parent = (X)
+#define SET_LINK(X,Y) do { (X)->link[CHECK_BIT(&(Y)->p.u.prefix,(X)->p.prefixlen)] = (Y);\
+ (Y)->parent = (X); } while (0)
static void
set_link (struct route_node *node, struct route_node *new)
diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c
index 90782174..2b1033ba 100644
--- a/ospfd/ospf_packet.c
+++ b/ospfd/ospf_packet.c
@@ -326,6 +326,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op)
struct md5_ctx ctx;
void *ibuf;
unsigned long oldputp;
+ u_int32_t t;
struct crypt_key *ck;
char *auth_key;
@@ -337,7 +338,9 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op)
/* We do this here so when we dup a packet, we don't have to
waste CPU rewriting other headers. */
- ospfh->u.crypt.crypt_seqnum = htonl (oi->crypt_seqnum++);
+ t = (time(NULL) & 0xFFFFFFFF);
+ oi->crypt_seqnum = ( t > oi->crypt_seqnum ? t : oi->crypt_seqnum++);
+ ospfh->u.crypt.crypt_seqnum = htonl (oi->crypt_seqnum);
/* Get MD5 Authentication key from auth_key list. */
if (list_isempty (OSPF_IF_PARAM (oi, auth_crypt)))
@@ -617,8 +620,11 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh,
return;
/* If incoming interface is passive one, ignore Hello. */
- if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_PASSIVE)
+ if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_PASSIVE) {
+ zlog_info ("Packet %s [HELLO:RECV]: oi is passive",
+ inet_ntoa (ospfh->router_id));
return;
+ }
/* get neighbor prefix. */
p.family = AF_INET;
@@ -1012,7 +1018,17 @@ ospf_db_desc (struct ip *iph, struct ospf_header *ospfh,
oi->db_desc_in++;
dd = (struct ospf_db_desc *) STREAM_PNT (s);
-
+#ifdef HAVE_NSSA
+ /*
+ * XXX HACK by Hasso Tepper. Setting P bit in NSSA area DD packets is not
+ * required. In fact at least JunOS sends DD packets with P bit clear.
+ * Until proper solution is developped, this hack should help.
+ */
+ if (oi->area->external_routing == OSPF_AREA_NSSA)
+ {
+ dd->options = (dd->options | ((short)(8)));
+ }
+#endif /* HAVE_NSSA */
nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &iph->ip_src);
if (nbr == NULL)
{
@@ -1784,6 +1800,7 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh,
ospf_opaque_self_originated_lsa_received (nbr, mylsa_upds);
list_delete (mylsa_upds);
+ list_delete (mylsa_acks);
#endif /* HAVE_OPAQUE_LSA */
assert (listcount (lsas) == 0);
@@ -2211,10 +2228,9 @@ ospf_read (struct thread *thread)
ospf->t_read = thread_add_read (master, ospf_read, ospf, ospf->fd);
/* IP Header dump. */
- /*
- if (ospf_debug_packet & OSPF_DEBUG_RECV)
- ospf_ip_header_dump (ibuf);
- */
+ if (IS_DEBUG_OSPF_PACKET(0, RECV))
+ ospf_ip_header_dump (ibuf);
+
/* Self-originated packet should be discarded silently. */
if (ospf_if_lookup_by_local_addr (ospf, NULL, iph->ip_src))
{
@@ -2263,20 +2279,20 @@ ospf_read (struct thread *thread)
if (IS_DEBUG_OSPF_PACKET (ospfh->type - 1, RECV))
{
if (IS_DEBUG_OSPF_PACKET (ospfh->type - 1, DETAIL))
- {
- zlog_info ("-----------------------------------------------------");
- ospf_packet_dump (ibuf);
- }
+ {
+ zlog_info ("-----------------------------------------------------");
+ ospf_packet_dump (ibuf);
+ }
zlog_info ("%s received from [%s] via [%s]",
- ospf_packet_type_str[ospfh->type],
- inet_ntoa (ospfh->router_id), IF_NAME (oi));
+ ospf_packet_type_str[ospfh->type],
+ inet_ntoa (ospfh->router_id), IF_NAME (oi));
zlog_info (" src [%s],", inet_ntoa (iph->ip_src));
zlog_info (" dst [%s]", inet_ntoa (iph->ip_dst));
if (IS_DEBUG_OSPF_PACKET (ospfh->type - 1, DETAIL))
zlog_info ("-----------------------------------------------------");
- }
+ }
/* Some header verification. */
ret = ospf_verify_header (ibuf, oi, iph, ospfh);
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index e960b83e..72a1f150 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -39,7 +39,6 @@
/* VTY port number. */
#define OSPF_VTY_PORT 2604
-#define OSPF_VTYSH_PATH "/tmp/.ospfd"
/* IP TTL for OSPF protocol. */
#define OSPF_IP_TTL 1
@@ -87,8 +86,8 @@
#define OSPF_AUTH_CMD_NOTSEEN -2
/* OSPF SPF timer values. */
-#define OSPF_SPF_DELAY_DEFAULT 5
-#define OSPF_SPF_HOLDTIME_DEFAULT 10
+#define OSPF_SPF_DELAY_DEFAULT 1
+#define OSPF_SPF_HOLDTIME_DEFAULT 1
/* OSPF interface default values. */
#define OSPF_OUTPUT_COST_DEFAULT 10
@@ -529,6 +528,7 @@ struct ospf *ospf_get ();
void ospf_finish (struct ospf *);
int ospf_router_id_update_timer (struct thread *);
void ospf_router_id_update ();
+int ospf_network_match_iface (struct connected *, struct prefix *);
int ospf_network_set (struct ospf *, struct prefix_ipv4 *, struct in_addr);
int ospf_network_unset (struct ospf *, struct prefix_ipv4 *, struct in_addr);
int ospf_area_stub_set (struct ospf *, struct in_addr);
diff --git a/ripngd/ripng_nexthop.h b/ripngd/ripng_nexthop.h
index 5c778f5e..2213fc2a 100644
--- a/ripngd/ripng_nexthop.h
+++ b/ripngd/ripng_nexthop.h
@@ -41,6 +41,11 @@ void ripng_rte_send(struct list *ripng_rte_list, struct interface *ifp,
**/
static inline int
addr6_cmp(struct in6_addr *A, struct in6_addr *B) {
+
+#ifndef s6_addr32
+#define s6_addr32 __u6_addr.__u6_addr32
+#endif /*s6_addr32*/
+
#define a(i) A->s6_addr32[i]
#define b(i) B->s6_addr32[i]
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index c8168c90..19ec3ae8 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -128,7 +128,7 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
distance = ZEBRA_STATIC_DISTANCE_DEFAULT;
/* Null0 static route. */
- if (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0)
+ if ((gate_str != NULL) && (strncasecmp (gate_str, "Null0", strlen (gate_str)) == 0))
{
if (flag_str)
{
@@ -159,6 +159,16 @@ zebra_static_ipv4 (struct vty *vty, int add_cmd,
}
}
+ if (gate_str == NULL)
+ {
+ if (add_cmd)
+ static_add_ipv4 (&p, NULL, NULL, flag, distance, 0);
+ else
+ static_delete_ipv4 (&p, NULL, NULL, distance, 0);
+
+ return CMD_SUCCESS;
+ }
+
/* When gateway is A.B.C.D format, gate is treated as nexthop
address other case gate is treated as interface name. */
ret = inet_aton (gate_str, &gate);
@@ -203,6 +213,18 @@ DEFUN (ip_route_flags,
return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], NULL);
}
+DEFUN (ip_route_flags2,
+ ip_route_flags2_cmd,
+ "ip route A.B.C.D/M (reject|blackhole)",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], NULL);
+}
+
/* Mask as A.B.C.D format. */
DEFUN (ip_route_mask,
ip_route_mask_cmd,
@@ -233,6 +255,19 @@ DEFUN (ip_route_mask_flags,
return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], NULL);
}
+DEFUN (ip_route_mask_flags2,
+ ip_route_mask_flags2_cmd,
+ "ip route A.B.C.D A.B.C.D (reject|blackhole)",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], NULL);
+}
+
/* Distance option value. */
DEFUN (ip_route_distance,
ip_route_distance_cmd,
@@ -263,6 +298,19 @@ DEFUN (ip_route_flags_distance,
return zebra_static_ipv4 (vty, 1, argv[0], NULL, argv[1], argv[2], argv[3]);
}
+DEFUN (ip_route_flags_distance2,
+ ip_route_flags_distance2_cmd,
+ "ip route A.B.C.D/M (reject|blackhole) <1-255>",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], NULL, NULL, argv[1], argv[2]);
+}
+
DEFUN (ip_route_mask_distance,
ip_route_mask_distance_cmd,
"ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
@@ -294,6 +342,20 @@ DEFUN (ip_route_mask_flags_distance,
return zebra_static_ipv4 (vty, 1, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
+DEFUN (ip_route_mask_flags_distance2,
+ ip_route_mask_flags_distance2_cmd,
+ "ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "Distance value for this route\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 1, argv[0], argv[1], NULL, argv[2], argv[3]);
+}
+
DEFUN (no_ip_route,
no_ip_route_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0)",
@@ -320,6 +382,19 @@ ALIAS (no_ip_route,
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n")
+DEFUN (no_ip_route_flags2,
+ no_ip_route_flags2_cmd,
+ "no ip route A.B.C.D/M (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, NULL, NULL);
+}
+
DEFUN (no_ip_route_mask,
no_ip_route_mask_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0)",
@@ -348,6 +423,20 @@ ALIAS (no_ip_route_mask,
"Emit an ICMP unreachable when matched\n"
"Silently discard pkts when matched\n")
+DEFUN (no_ip_route_mask_flags2,
+ no_ip_route_mask_flags2_cmd,
+ "no ip route A.B.C.D A.B.C.D (reject|blackhole)",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, NULL, NULL);
+}
+
DEFUN (no_ip_route_distance,
no_ip_route_distance_cmd,
"no ip route A.B.C.D/M (A.B.C.D|INTERFACE|null0) <1-255>",
@@ -379,6 +468,20 @@ DEFUN (no_ip_route_flags_distance,
return zebra_static_ipv4 (vty, 0, argv[0], NULL, argv[1], argv[2], argv[3]);
}
+DEFUN (no_ip_route_flags_distance2,
+ no_ip_route_flags_distance2_cmd,
+ "no ip route A.B.C.D/M (reject|blackhole) <1-255>",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix (e.g. 10.0.0.0/8)\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], NULL, NULL, argv[1], argv[2]);
+}
+
DEFUN (no_ip_route_mask_distance,
no_ip_route_mask_distance_cmd,
"no ip route A.B.C.D A.B.C.D (A.B.C.D|INTERFACE|null0) <1-255>",
@@ -412,6 +515,21 @@ DEFUN (no_ip_route_mask_flags_distance,
return zebra_static_ipv4 (vty, 0, argv[0], argv[1], argv[2], argv[3], argv[4]);
}
+DEFUN (no_ip_route_mask_flags_distance2,
+ no_ip_route_mask_flags_distance2_cmd,
+ "no ip route A.B.C.D A.B.C.D (reject|blackhole) <1-255>",
+ NO_STR
+ IP_STR
+ "Establish static routes\n"
+ "IP destination prefix\n"
+ "IP destination prefix mask\n"
+ "Emit an ICMP unreachable when matched\n"
+ "Silently discard pkts when matched\n"
+ "Distance value for this route\n")
+{
+ return zebra_static_ipv4 (vty, 0, argv[0], argv[1], NULL, argv[2], argv[3]);
+}
+
/* New RIB. Detailed information for IPv4 route. */
void
vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
@@ -485,7 +603,9 @@ vty_show_ip_route_detail (struct vty *vty, struct route_node *rn)
vty_out (vty, " directly connected, %s", nexthop->ifname);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " directly connected, via Null0");
+ vty_out (vty, " directly connected");
+ if (!rib->flags)
+ vty_out (vty, ", Null0");
break;
default:
break;
@@ -568,7 +688,9 @@ vty_show_ip_route (struct vty *vty, struct route_node *rn, struct rib *rib)
vty_out (vty, " is directly connected, %s", nexthop->ifname);
break;
case NEXTHOP_TYPE_BLACKHOLE:
- vty_out (vty, " is directly connected, Null0");
+ vty_out (vty, " is directly connected");
+ if (!rib->flags)
+ vty_out (vty, ", Null0");
break;
default:
break;
@@ -960,7 +1082,8 @@ static_config_ipv4 (struct vty *vty)
vty_out (vty, " %s", si->gate.ifname);
break;
case STATIC_IPV4_BLACKHOLE:
- vty_out (vty, " Null0");
+ if (!si->flags)
+ vty_out (vty, " Null0");
break;
}
@@ -1805,19 +1928,27 @@ zebra_vty_route_init ()
install_element (CONFIG_NODE, &ip_route_cmd);
install_element (CONFIG_NODE, &ip_route_flags_cmd);
+ install_element (CONFIG_NODE, &ip_route_flags2_cmd);
install_element (CONFIG_NODE, &ip_route_mask_cmd);
install_element (CONFIG_NODE, &ip_route_mask_flags_cmd);
+ install_element (CONFIG_NODE, &ip_route_mask_flags2_cmd);
install_element (CONFIG_NODE, &no_ip_route_cmd);
install_element (CONFIG_NODE, &no_ip_route_flags_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_flags2_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_flags_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_mask_flags2_cmd);
install_element (CONFIG_NODE, &ip_route_distance_cmd);
install_element (CONFIG_NODE, &ip_route_flags_distance_cmd);
+ install_element (CONFIG_NODE, &ip_route_flags_distance2_cmd);
install_element (CONFIG_NODE, &ip_route_mask_distance_cmd);
install_element (CONFIG_NODE, &ip_route_mask_flags_distance_cmd);
+ install_element (CONFIG_NODE, &ip_route_mask_flags_distance2_cmd);
install_element (CONFIG_NODE, &no_ip_route_distance_cmd);
install_element (CONFIG_NODE, &no_ip_route_flags_distance_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_flags_distance2_cmd);
install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance_cmd);
+ install_element (CONFIG_NODE, &no_ip_route_mask_flags_distance2_cmd);
install_element (VIEW_NODE, &show_ip_route_cmd);
install_element (VIEW_NODE, &show_ip_route_addr_cmd);