[PATCH 1/1] Add 'real netmask' OSPF option improving interoperability.

Alexander V. Chernikov melifaro at ipfw.ru
Fri Mar 1 03:04:14 CET 2013


---
 doc/bird.sgml       |    8 ++++++++
 proto/ospf/config.Y |    3 ++-
 proto/ospf/hello.c  |    3 ++-
 proto/ospf/iface.c  |    1 +
 proto/ospf/ospf.h   |    2 ++
 5 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/doc/bird.sgml b/doc/bird.sgml
index e83cf0e..4d6212d 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -1935,6 +1935,7 @@ protocol ospf <name> {
 				nonbroadcast|nbma|pointomultipoint|ptmp];
 			strict nonbroadcast <switch>;
 			real broadcast <switch>;
+			real netmask <switch>;
 			check link <switch>;
 			ecmp weight <num>;
 			authentication [none|simple|cryptographic];
@@ -2178,6 +2179,13 @@ protocol ospf <name> {
 	 probably is not interoperable with other OSPF
 	 implementations. Default value is no.
 
+	<tag>real netmask<m/switch/</tag>
+	 In <cf/type ptp/ network configuration, hello packets are sent
+	 with netmask of 0.0.0.0. Some OSPF implementations perform
+	 strict netmask checking even for point-to-point links. This
+	 option enables sending real network mask for <cf/type ptp/
+	 interfaces. Default value is no.
+
 	<tag>check link <M>switch</M></tag>
 	 If set, a hardware link state (reported by OS) is taken into
 	 consideration. When a link disappears (e.g. an ethernet cable is
diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y
index 3f09afb..8078f99 100644
--- a/proto/ospf/config.Y
+++ b/proto/ospf/config.Y
@@ -131,7 +131,7 @@ CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
 CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
 CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
 CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY)
-CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL)
+CF_KEYWORDS(GLOBAL, LSID, ROUTER, SELF, INSTANCE, REAL, NETMASK)
 
 %type <t> opttext
 %type <ld> lsadb_args
@@ -289,6 +289,7 @@ ospf_iface_item:
  | TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; }
  | TYPE PTMP { OSPF_PATT->type = OSPF_IT_PTMP ; }
  | REAL BROADCAST bool { OSPF_PATT->real_bcast = $3; if (OSPF_VERSION != 2) cf_error("Real broadcast option requires OSPFv2"); }
+ | REAL NETMASK bool { OSPF_PATT->real_netmask = $3; if (OSPF_VERSION != 2) cf_error("Real netmask option requires OSPFv2"); }
  | TRANSMIT DELAY expr { OSPF_PATT->inftransdelay = $3 ; if (($3<=0) || ($3>65535)) cf_error("Transmit delay must be in range 1-65535"); }
  | PRIORITY expr { OSPF_PATT->priority = $2 ; if (($2<0) || ($2>255)) cf_error("Priority must be in range 0-255"); }
  | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c
index 6ec5c51..cc82a2d 100644
--- a/proto/ospf/hello.c
+++ b/proto/ospf/hello.c
@@ -253,7 +253,8 @@ ospf_hello_send(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn)
 #ifdef OSPFv2
   pkt->netmask = ipa_mkmask(ifa->addr->pxlen);
   ipa_hton(pkt->netmask);
-  if ((ifa->type == OSPF_IT_VLINK) || (ifa->type == OSPF_IT_PTP))
+  if ((ifa->type == OSPF_IT_VLINK) ||
+      ((ifa->type == OSPF_IT_PTP) && !ifa->real_netmask))
     pkt->netmask = IPA_NONE;
 #endif
 
diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c
index 290a863..e439d61 100644
--- a/proto/ospf/iface.c
+++ b/proto/ospf/iface.c
@@ -537,6 +537,7 @@ ospf_iface_new(struct ospf_area *oa, struct ifa *addr, struct ospf_iface_patt *i
 #ifdef OSPFv2
   ifa->autype = ip->autype;
   ifa->passwords = ip->passwords;
+  ifa->real_netmask = ip->real_netmask;
 #endif
 
 #ifdef OSPFv3
diff --git a/proto/ospf/ospf.h b/proto/ospf/ospf.h
index 7111a13..0bba301 100644
--- a/proto/ospf/ospf.h
+++ b/proto/ospf/ospf.h
@@ -273,6 +273,7 @@ struct ospf_iface
   u16 rxbuf;			/* Buffer size */
   u8 check_link;		/* Whether iface link change is used */
   u8 ecmp_weight;		/* Weight used for ECMP */
+  u8 real_netmask;		/* Send real netmask for P2P */
 };
 
 struct ospf_md5
@@ -810,6 +811,7 @@ struct ospf_iface_patt
   u8 check_link;
   u8 ecmp_weight;
   u8 real_bcast;		/* Not really used in OSPFv3 */
+  u8 real_netmask;		/* Not really used in OSPFv3 */
 
 #ifdef OSPFv2
   list *passwords;
-- 
1.7.3.2


--------------040401090006070400080809--



More information about the Bird-users mailing list