Commit 8df02847 authored by Ondřej Zajíček's avatar Ondřej Zajíček
Browse files

Fixes a compatibility issue in OSPFv2 PtP links.

BIRD used zero netmask in hello packets on all PtP links, not just on
unnumbered ones. This patch fixes it and adds option 'ptp netmask'
for overriding the default behavior.

Thanks to Alexander V. Chernikov for the original patch.
parent cd3b02d1
...@@ -1940,6 +1940,7 @@ protocol ospf <name> { ...@@ -1940,6 +1940,7 @@ protocol ospf <name> {
nonbroadcast|nbma|pointomultipoint|ptmp]; nonbroadcast|nbma|pointomultipoint|ptmp];
strict nonbroadcast <switch>; strict nonbroadcast <switch>;
real broadcast <switch>; real broadcast <switch>;
ptp netmask <switch>;
check link <switch>; check link <switch>;
ecmp weight <num>; ecmp weight <num>;
authentication [none|simple|cryptographic]; authentication [none|simple|cryptographic];
...@@ -2183,6 +2184,18 @@ protocol ospf <name> { ...@@ -2183,6 +2184,18 @@ protocol ospf <name> {
probably is not interoperable with other OSPF probably is not interoperable with other OSPF
implementations. Default value is no. implementations. Default value is no.
<tag>ptp netmask <m/switch/</tag>
In <cf/type ptp/ network configurations, OSPFv2
implementations should ignore received netmask field in hello
packets and should send hello packets with zero netmask field
on unnumbered PtP links. But some OSPFv2 implementations
perform netmask checking even for PtP links. This option
specifies whether real netmask will be used in hello packets
on <cf/type ptp/ interfaces. You should ignore this option
unless you meet some compatibility problems related to this
issue. Default value is no for unnumbered PtP links, yes
otherwise.
<tag>check link <M>switch</M></tag> <tag>check link <M>switch</M></tag>
If set, a hardware link state (reported by OS) is taken into If set, a hardware link state (reported by OS) is taken into
consideration. When a link disappears (e.g. an ethernet cable is consideration. When a link disappears (e.g. an ethernet cable is
......
...@@ -131,7 +131,7 @@ CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC) ...@@ -131,7 +131,7 @@ CF_KEYWORDS(NONE, SIMPLE, AUTHENTICATION, STRICT, CRYPTOGRAPHIC)
CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK) CF_KEYWORDS(ELIGIBLE, POLL, NETWORKS, HIDDEN, VIRTUAL, CHECK, LINK)
CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL) CF_KEYWORDS(RX, BUFFER, LARGE, NORMAL, STUBNET, HIDDEN, SUMMARY, TAG, EXTERNAL)
CF_KEYWORDS(WAIT, DELAY, LSADB, ECMP, LIMIT, WEIGHT, NSSA, TRANSLATOR, STABILITY) 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 <t> opttext
%type <ld> lsadb_args %type <ld> lsadb_args
...@@ -290,6 +290,7 @@ ospf_iface_item: ...@@ -290,6 +290,7 @@ ospf_iface_item:
| TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; } | TYPE POINTOMULTIPOINT { OSPF_PATT->type = OSPF_IT_PTMP ; }
| TYPE PTMP { 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 BROADCAST bool { OSPF_PATT->real_bcast = $3; if (OSPF_VERSION != 2) cf_error("Real broadcast option requires OSPFv2"); }
| PTP NETMASK bool { OSPF_PATT->ptp_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"); } | 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"); } | 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 ; } | STRICT NONBROADCAST bool { OSPF_PATT->strictnbma = $3 ; }
...@@ -364,6 +365,7 @@ ospf_iface_start: ...@@ -364,6 +365,7 @@ ospf_iface_start:
OSPF_PATT->type = OSPF_IT_UNDEF; OSPF_PATT->type = OSPF_IT_UNDEF;
init_list(&OSPF_PATT->nbma_list); init_list(&OSPF_PATT->nbma_list);
OSPF_PATT->autype = OSPF_AUTH_NONE; OSPF_PATT->autype = OSPF_AUTH_NONE;
OSPF_PATT->ptp_netmask = 2; /* not specified */
reset_passwords(); reset_passwords();
} }
; ;
......
...@@ -253,7 +253,8 @@ ospf_hello_send(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn) ...@@ -253,7 +253,8 @@ ospf_hello_send(struct ospf_iface *ifa, int kind, struct ospf_neighbor *dirn)
#ifdef OSPFv2 #ifdef OSPFv2
pkt->netmask = ipa_mkmask(ifa->addr->pxlen); pkt->netmask = ipa_mkmask(ifa->addr->pxlen);
ipa_hton(pkt->netmask); 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->ptp_netmask))
pkt->netmask = IPA_NONE; pkt->netmask = IPA_NONE;
#endif #endif
......
...@@ -537,6 +537,9 @@ ospf_iface_new(struct ospf_area *oa, struct ifa *addr, struct ospf_iface_patt *i ...@@ -537,6 +537,9 @@ ospf_iface_new(struct ospf_area *oa, struct ifa *addr, struct ospf_iface_patt *i
#ifdef OSPFv2 #ifdef OSPFv2
ifa->autype = ip->autype; ifa->autype = ip->autype;
ifa->passwords = ip->passwords; ifa->passwords = ip->passwords;
ifa->ptp_netmask = !(addr->flags & IA_PEER);
if (ip->ptp_netmask < 2)
ifa->ptp_netmask = ip->ptp_netmask;
#endif #endif
#ifdef OSPFv3 #ifdef OSPFv3
......
...@@ -273,6 +273,7 @@ struct ospf_iface ...@@ -273,6 +273,7 @@ struct ospf_iface
u16 rxbuf; /* Buffer size */ u16 rxbuf; /* Buffer size */
u8 check_link; /* Whether iface link change is used */ u8 check_link; /* Whether iface link change is used */
u8 ecmp_weight; /* Weight used for ECMP */ u8 ecmp_weight; /* Weight used for ECMP */
u8 ptp_netmask; /* Send real netmask for P2P */
}; };
struct ospf_md5 struct ospf_md5
...@@ -810,6 +811,7 @@ struct ospf_iface_patt ...@@ -810,6 +811,7 @@ struct ospf_iface_patt
u8 check_link; u8 check_link;
u8 ecmp_weight; u8 ecmp_weight;
u8 real_bcast; /* Not really used in OSPFv3 */ u8 real_bcast; /* Not really used in OSPFv3 */
u8 ptp_netmask; /* bool but 2 for unspecified */
#ifdef OSPFv2 #ifdef OSPFv2
list *passwords; list *passwords;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment