diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-03-05 11:52:47 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-03-05 11:52:47 +0100 |
commit | e3299ab14877de6ce688050e550c44cd4e85b212 (patch) | |
tree | 7c54570a3b010051e2e957667bfb7121af346447 /proto/bgp/packets.c | |
parent | 82a79586e5810af2f0338cb4c5982e085b5c5292 (diff) |
Added Cisco and Quagga capability workaround option.
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r-- | proto/bgp/packets.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 42564896..dc3748f0 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -47,6 +47,20 @@ bgp_put_cap_ipv6(struct bgp_conn *conn UNUSED, byte *buf) *buf++ = 1; /* and SAFI 1 */ return buf; } + +#else + +static byte * +bgp_put_cap_ipv4(struct bgp_conn *conn UNUSED, byte *buf) +{ + *buf++ = 1; /* Capability 1: Multiprotocol extensions */ + *buf++ = 4; /* Capability data length */ + *buf++ = 0; /* We support AF IPv4 */ + *buf++ = BGP_AF_IPV4; + *buf++ = 0; /* RFU */ + *buf++ = 1; /* and SAFI 1 */ + return buf; +} #endif static byte * @@ -82,6 +96,11 @@ bgp_create_open(struct bgp_conn *conn, byte *buf) /* Skipped 3 B for length field and Capabilities parameter header */ cap = buf + 12; +#ifndef IPV6 + if (p->cf->advertise_ipv4) + cap = bgp_put_cap_ipv4(conn, cap); +#endif + #ifdef IPV6 cap = bgp_put_cap_ipv6(conn, cap); #endif @@ -940,6 +959,9 @@ bgp_rx_notification(struct bgp_conn *conn, byte *pkt, int len) unsigned subcode = pkt[20]; int delay = 1; + bgp_log_error(conn->bgp, "Received error notification", code, subcode, pkt+21, len-21); + bgp_store_error(conn->bgp, conn, BE_BGP_RX, (code << 16) | subcode); + #ifndef IPV6 if ((code == 2) && ((subcode == 4) || (subcode == 7))) { @@ -948,14 +970,12 @@ bgp_rx_notification(struct bgp_conn *conn, byte *pkt, int len) * 7 - Peer request some capability. Strange unless it is IPv6 only peer. * We try connect without capabilities */ - BGP_TRACE(D_EVENTS, "Capability related error received, capabilities disabled"); + log(L_WARN "%s: Capability related error received, capabilities disabled", p->p.name); conn->bgp->start_state = BSS_CONNECT_NOCAP; delay = 0; } #endif - bgp_log_error(conn->bgp, "Received error notification", code, subcode, pkt+21, len-21); - bgp_store_error(conn->bgp, conn, BE_BGP_RX, (code << 16) | subcode); if (delay) bgp_update_startup_delay(conn->bgp, conn, code, subcode); bgp_conn_enter_close_state(conn); bgp_schedule_packet(conn, PKT_SCHEDULE_CLOSE); |