]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_main.c
Merge pull request #2077 from donaldsharp/static_warn
[mirror_frr.git] / bgpd / bgp_main.c
index 82c74e4afa5b971e0531405790096cba255f19d2..5158717b5d97ec2d6bec927b81175248fc25c7e3 100644 (file)
@@ -105,9 +105,8 @@ static struct quagga_signal_t bgp_signals[] = {
 static int retain_mode = 0;
 
 /* privileges */
-static zebra_capabilities_t _caps_p[] = {
-       ZCAP_BIND, ZCAP_NET_RAW, ZCAP_NET_ADMIN,
-};
+static zebra_capabilities_t _caps_p[] = {ZCAP_BIND, ZCAP_NET_RAW,
+                                        ZCAP_NET_ADMIN, ZCAP_SYS_ADMIN};
 
 struct zebra_privs_t bgpd_privs = {
 #if defined(FRR_USER) && defined(FRR_GROUP)
@@ -266,6 +265,8 @@ static int bgp_vrf_enable(struct vrf *vrf)
                if (old_vrf_id != bgp->vrf_id)
                        bgp_update_redist_vrf_bitmaps(bgp, old_vrf_id);
                bgp_instance_up(bgp);
+               vpn_leak_zebra_vrf_label_update(bgp, AFI_IP);
+               vpn_leak_zebra_vrf_label_update(bgp, AFI_IP6);
        }
 
        return 0;
@@ -284,6 +285,10 @@ static int bgp_vrf_disable(struct vrf *vrf)
 
        bgp = bgp_lookup_by_name(vrf->name);
        if (bgp) {
+
+               vpn_leak_zebra_vrf_label_withdraw(bgp, AFI_IP);
+               vpn_leak_zebra_vrf_label_withdraw(bgp, AFI_IP6);
+
                old_vrf_id = bgp->vrf_id;
                bgp_handle_socket(bgp, vrf, VRF_UNKNOWN, false);
                /* We have instance configured, unlink from VRF and make it
@@ -332,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"
@@ -351,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;
@@ -390,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);