From fcf5a4f4b3e1a984f65d873e7a5a8c830b1ad9bf Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Wed, 3 Nov 2010 10:02:24 +0100 Subject: [PATCH] Change default for BGP IPv6 socket to V6ONLY. Also add a new option 'dual' for the old behavior. --- doc/bird.sgml | 9 +++++---- nest/config.Y | 5 +++-- proto/bgp/bgp.c | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index a760b9db..53d9fcd0 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -270,14 +270,15 @@ protocol rip { router id Set BIRD's router ID. It's a world-wide unique identification of your router, usually one of router's IPv4 addresses. Default: in IPv4 version, the lowest IP address of a non-loopback interface. In IPv6 version, this option is mandatory. - listen bgp [address + listen bgp [address This option allows to specify address and port where BGP protocol should listen. It is global option as listening socket is common to all BGP instances. Default is to listen on all addresses (0.0.0.0) and port 179. In IPv6 mode, option - timeformat route|protocol|base|log " This option allows to specify a format of date/time used by diff --git a/nest/config.Y b/nest/config.Y index 39cd9015..920a3054 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -44,7 +44,7 @@ CF_KEYWORDS(ROUTER, ID, PROTOCOL, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT) CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS) CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES) CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE) -CF_KEYWORDS(LISTEN, BGP, V6ONLY, ADDRESS, PORT, PASSWORDS, DESCRIPTION) +CF_KEYWORDS(LISTEN, BGP, V6ONLY, DUAL, ADDRESS, PORT, PASSWORDS, DESCRIPTION) CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC) CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT, @@ -97,7 +97,8 @@ listen_opts: listen_opt: ADDRESS ipa { new_config->listen_bgp_addr = $2; } | PORT expr { new_config->listen_bgp_port = $2; } - | V6ONLY { new_config->listen_bgp_flags |= SKF_V6ONLY; } + | V6ONLY { new_config->listen_bgp_flags = 0; } + | DUAL { new_config->listen_bgp_flags = 1; } ; diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index ba5d755d..327292a3 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -658,7 +658,7 @@ bgp_setup_listen_sk(ip_addr addr, unsigned port, u32 flags) s->type = SK_TCP_PASSIVE; s->saddr = addr; s->sport = port ? port : BGP_PORT; - s->flags = flags; + s->flags = flags ? 0 : SKF_V6ONLY; s->tos = IP_PREC_INTERNET_CONTROL; s->rbsize = BGP_RX_BUFFER_SIZE; s->tbsize = BGP_TX_BUFFER_SIZE;