From 02dcf3888c643fcbd6b7f01d92eec2f9b5dc5955 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 24 Jul 2014 08:51:24 -0500 Subject: Fix #3772 - 'Broken openbgpd config generation logic in 2.2'. Change logic guiding generation of local-address statements in neighbor configs so that only one local-address is generated when a 'Local address X' parameter is defined for a neighbor. --- config/openbgpd/openbgpd.inc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'config/openbgpd/openbgpd.inc') diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc index 76aeb54f..897d83d1 100644 --- a/config/openbgpd/openbgpd.inc +++ b/config/openbgpd/openbgpd.inc @@ -129,10 +129,11 @@ function openbgpd_install_conf() { $conffile .= "\t\t{$row['parameters']} {$row['parmvalue']} \n"; } } - if ($setlocaladdr == true && !empty($openbgpd_conf['listenip'])) - $conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n"; - else - $conffile .= "\t\tlocal-address 0.0.0.0\n"; + if ($setlocaladdr == true) + if (!empty($openbgpd_conf['listenip'])) + $conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n"; + else + $conffile .= "\t\tlocal-address 0.0.0.0\n"; $conffile .= "}\n"; } -- cgit v1.2.3 From fbbc57ece0730657f2e5c6ba7026ebb827c03e53 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 24 Jul 2014 10:30:33 -0500 Subject: put brackets around nested ifs to clarify where the else belongs. --- config/openbgpd/openbgpd.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'config/openbgpd/openbgpd.inc') diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc index 897d83d1..12be4ce1 100644 --- a/config/openbgpd/openbgpd.inc +++ b/config/openbgpd/openbgpd.inc @@ -129,11 +129,12 @@ function openbgpd_install_conf() { $conffile .= "\t\t{$row['parameters']} {$row['parmvalue']} \n"; } } - if ($setlocaladdr == true) + if ($setlocaladdr == true) { if (!empty($openbgpd_conf['listenip'])) $conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n"; else $conffile .= "\t\tlocal-address 0.0.0.0\n"; + } $conffile .= "}\n"; } -- cgit v1.2.3 From dedf19ffada8dac78ceb491a0b1f7ebb12ed7864 Mon Sep 17 00:00:00 2001 From: Matt Smith Date: Thu, 24 Jul 2014 10:57:26 -0500 Subject: More formatting/braces --- config/openbgpd/openbgpd.inc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'config/openbgpd/openbgpd.inc') diff --git a/config/openbgpd/openbgpd.inc b/config/openbgpd/openbgpd.inc index 12be4ce1..907f6b8c 100644 --- a/config/openbgpd/openbgpd.inc +++ b/config/openbgpd/openbgpd.inc @@ -130,10 +130,11 @@ function openbgpd_install_conf() { } } if ($setlocaladdr == true) { - if (!empty($openbgpd_conf['listenip'])) + if (!empty($openbgpd_conf['listenip'])) { $conffile .= "\t\tlocal-address {$openbgpd_conf['listenip']}\n"; - else + } else { $conffile .= "\t\tlocal-address 0.0.0.0\n"; + } } $conffile .= "}\n"; -- cgit v1.2.3