summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_main.c
diff options
context:
space:
mode:
authorkishiguro <ishi@hash-set.com>2018-04-06 23:01:05 +0200
committerkishiguro <ishi@hash-set.com>2018-04-06 23:01:05 +0200
commit580f8636be44e2c07679f4a5f6d919cb9de29258 (patch)
tree8249195fdcb837d685766bca955a8a985144ddbf /bgpd/bgp_main.c
parentMerge pull request #2027 from qlyoung/fix-vrf-static-holdem-display (diff)
downloadfrr-580f8636be44e2c07679f4a5f6d919cb9de29258.tar.xz
frr-580f8636be44e2c07679f4a5f6d919cb9de29258.zip
bgpd option '-p 0' means do not listen BGP port.
Signed-off-by: Kunihiro Ishiguro <ishi@coreswitch.io>
Diffstat (limited to 'bgpd/bgp_main.c')
-rw-r--r--bgpd/bgp_main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c
index bf60f9c11..5158717b5 100644
--- a/bgpd/bgp_main.c
+++ b/bgpd/bgp_main.c
@@ -337,7 +337,7 @@ int main(int argc, char **argv)
frr_preinit(&bgpd_di, argc, argv);
frr_opt_add(
"p:l:rSne:", longopts,
- " -p, --bgp_port Set bgp protocol's port number\n"
+ " -p, --bgp_port Set BGP listen port number (0 means do not listen).\n"
" -l, --listenon Listen on specified address (implies -n)\n"
" -r, --retain When program terminates, retain added route by bgpd.\n"
" -n, --no_kernel Do not install route to kernel.\n"
@@ -356,7 +356,7 @@ int main(int argc, char **argv)
break;
case 'p':
tmp_port = atoi(optarg);
- if (tmp_port <= 0 || tmp_port > 0xffff)
+ if (tmp_port < 0 || tmp_port > 0xffff)
bgp_port = BGP_PORT_DEFAULT;
else
bgp_port = tmp_port;
@@ -395,6 +395,8 @@ int main(int argc, char **argv)
/* BGP master init. */
bgp_master_init(frr_init());
bm->port = bgp_port;
+ if (bgp_port == 0)
+ bgp_option_set(BGP_OPT_NO_LISTEN);
bm->address = bgp_address;
if (no_fib_flag)
bgp_option_set(BGP_OPT_NO_FIB);