7f7b2c
From 8a9f48c2f146476f1e46da4144b77e38d712673c Mon Sep 17 00:00:00 2001
7f7b2c
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
7f7b2c
Date: Wed, 9 Dec 2020 12:25:31 +0100
7f7b2c
Subject: [PATCH 1/7] northd: add reject action for lb with no backends
7f7b2c
7f7b2c
Introduce the capability to create a load balancer with no backends and
7f7b2c
with --reject option in order to send a TCP reset segment (for tcp) or
7f7b2c
an ICMP port unreachable packet (for all other kind of traffic) whenever
7f7b2c
an incoming packet is received for this load-balancer.
7f7b2c
7f7b2c
Tested-by: Antonio Ojea <aojeagar@redhat.com>
7f7b2c
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
7f7b2c
Acked-by: Mark Michelson <mmichels@redhat.com>
7f7b2c
Signed-off-by: Numan Siddique <numans@ovn.org>
7f7b2c
7f7b2c
(cherry-picked from master commit ebbcd8e8cc5000d50691e72edfde7ede4a906ade)
7f7b2c
7f7b2c
Change-Id: I5676901df564ecf978455319cfcddd24c2efdae4
7f7b2c
---
7f7b2c
 lib/lb.c                  |  2 ++
7f7b2c
 lib/lb.h                  |  1 +
7f7b2c
 northd/ovn-northd.8.xml   | 19 +++++++++++++++++
7f7b2c
 northd/ovn-northd.c       | 44 ++++++++++++++++++++++++++-------------
7f7b2c
 ovn-nb.ovsschema          |  9 ++++++--
7f7b2c
 ovn-nb.xml                | 10 +++++++++
7f7b2c
 tests/ovn-northd.at       | 25 ++++++++++++++++++++++
7f7b2c
 tests/system-ovn.at       | 28 ++++++++++++++++++++++++-
7f7b2c
 utilities/ovn-nbctl.8.xml | 11 +++++++++-
7f7b2c
 utilities/ovn-nbctl.c     |  7 ++++++-
7f7b2c
 10 files changed, 136 insertions(+), 20 deletions(-)
7f7b2c
7f7b2c
diff --git a/lib/lb.c b/lib/lb.c
7f7b2c
index a90042e58..2517c02ef 100644
7f7b2c
--- a/lib/lb.c
7f7b2c
+++ b/lib/lb.c
7f7b2c
@@ -189,6 +189,8 @@ ovn_northd_lb_create(const struct nbrec_load_balancer *nbrec_lb,
7f7b2c
         struct ovn_lb_vip *lb_vip = &lb->vips[n_vips];
7f7b2c
         struct ovn_northd_lb_vip *lb_vip_nb = &lb->vips_nb[n_vips];
7f7b2c
 
7f7b2c
+        lb_vip->empty_backend_rej = smap_get_bool(&nbrec_lb->options,
7f7b2c
+                                                  "reject", false);
7f7b2c
         if (!ovn_lb_vip_init(lb_vip, node->key, node->value)) {
7f7b2c
             continue;
7f7b2c
         }
7f7b2c
diff --git a/lib/lb.h b/lib/lb.h
7f7b2c
index 6644ad0d8..42c580bd1 100644
7f7b2c
--- a/lib/lb.h
7f7b2c
+++ b/lib/lb.h
7f7b2c
@@ -49,6 +49,7 @@ struct ovn_lb_vip {
7f7b2c
 
7f7b2c
     struct ovn_lb_backend *backends;
7f7b2c
     size_t n_backends;
7f7b2c
+    bool empty_backend_rej;
7f7b2c
 };
7f7b2c
 
7f7b2c
 struct ovn_lb_backend {
7f7b2c
diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml
7f7b2c
index a9a3a9f4f..d86f36ea6 100644
7f7b2c
--- a/northd/ovn-northd.8.xml
7f7b2c
+++ b/northd/ovn-northd.8.xml
7f7b2c
@@ -700,6 +700,16 @@
7f7b2c
         ct_lb(args), where args contains comma
7f7b2c
         separated IP addresses of the same address family as VIP.
7f7b2c
       
7f7b2c
+
7f7b2c
+      
  • 7f7b2c
    +        If the load balancer is created with --reject option and
    7f7b2c
    +        it has no active backends, a TCP reset segment (for tcp) or an ICMP
    7f7b2c
    +        port unreachable packet (for all other kind of traffic) will be sent
    7f7b2c
    +        whenever an incoming packet is received for this load-balancer.
    7f7b2c
    +        Please note using --reject option will disable
    7f7b2c
    +        empty_lb SB controller event for this load balancer.
    7f7b2c
    +      
    7f7b2c
    +
    7f7b2c
           
  • 7f7b2c
             A priority-100 flow commits packets to connection tracker using
    7f7b2c
             ct_commit; next; action based on a hint provided by
    7f7b2c
    @@ -2592,6 +2602,15 @@ icmp6 {
    7f7b2c
             packets, the above action will be replaced by
    7f7b2c
             flags.force_snat_for_lb = 1; ct_dnat;.
    7f7b2c
           
    7f7b2c
    +
    7f7b2c
    +      
  • 7f7b2c
    +        If the load balancer is created with --reject option and
    7f7b2c
    +        it has no active backends, a TCP reset segment (for tcp) or an ICMP
    7f7b2c
    +        port unreachable packet (for all other kind of traffic) will be sent
    7f7b2c
    +        whenever an incoming packet is received for this load-balancer.
    7f7b2c
    +        Please note using --reject option will disable
    7f7b2c
    +        empty_lb SB controller event for this load balancer.
    7f7b2c
    +      
    7f7b2c
         
    7f7b2c
     
    7f7b2c
         

    Ingress Table 6: DNAT on Gateway Routers

    7f7b2c
    diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
    7f7b2c
    index 5a3227568..478f1a339 100644
    7f7b2c
    --- a/northd/ovn-northd.c
    7f7b2c
    +++ b/northd/ovn-northd.c
    7f7b2c
    @@ -3436,12 +3436,12 @@ ovn_lb_svc_create(struct northd_context *ctx, struct ovn_northd_lb *lb,
    7f7b2c
     }
    7f7b2c
     
    7f7b2c
     static
    7f7b2c
    -void build_lb_vip_ct_lb_actions(struct ovn_lb_vip *lb_vip,
    7f7b2c
    -                                struct ovn_northd_lb_vip *lb_vip_nb,
    7f7b2c
    -                                struct ds *action,
    7f7b2c
    -                                char *selection_fields)
    7f7b2c
    +void build_lb_vip_actions(struct ovn_lb_vip *lb_vip,
    7f7b2c
    +                          struct ovn_northd_lb_vip *lb_vip_nb,
    7f7b2c
    +                          struct ds *action, char *selection_fields,
    7f7b2c
    +                          bool ls_dp)
    7f7b2c
     {
    7f7b2c
    -    bool skip_hash_fields = false;
    7f7b2c
    +    bool skip_hash_fields = false, reject = false;
    7f7b2c
     
    7f7b2c
         if (lb_vip_nb->lb_health_check) {
    7f7b2c
             ds_put_cstr(action, "ct_lb(backends=");
    7f7b2c
    @@ -3463,18 +3463,30 @@ void build_lb_vip_ct_lb_actions(struct ovn_lb_vip *lb_vip,
    7f7b2c
             }
    7f7b2c
     
    7f7b2c
             if (!n_active_backends) {
    7f7b2c
    -            skip_hash_fields = true;
    7f7b2c
    -            ds_clear(action);
    7f7b2c
    -            ds_put_cstr(action, "drop;");
    7f7b2c
    +            if (!lb_vip->empty_backend_rej) {
    7f7b2c
    +                ds_clear(action);
    7f7b2c
    +                ds_put_cstr(action, "drop;");
    7f7b2c
    +                skip_hash_fields = true;
    7f7b2c
    +            } else {
    7f7b2c
    +                reject = true;
    7f7b2c
    +            }
    7f7b2c
             } else {
    7f7b2c
                 ds_chomp(action, ',');
    7f7b2c
                 ds_put_cstr(action, ");");
    7f7b2c
             }
    7f7b2c
    +    } else if (lb_vip->empty_backend_rej && !lb_vip->n_backends) {
    7f7b2c
    +        reject = true;
    7f7b2c
         } else {
    7f7b2c
             ds_put_format(action, "ct_lb(backends=%s);", lb_vip_nb->backend_ips);
    7f7b2c
         }
    7f7b2c
     
    7f7b2c
    -    if (!skip_hash_fields && selection_fields && selection_fields[0]) {
    7f7b2c
    +    if (reject) {
    7f7b2c
    +        int stage = ls_dp ? ovn_stage_get_table(S_SWITCH_OUT_QOS_MARK)
    7f7b2c
    +                          : ovn_stage_get_table(S_ROUTER_OUT_SNAT);
    7f7b2c
    +        ds_clear(action);
    7f7b2c
    +        ds_put_format(action, "reg0 = 0; reject { outport <-> inport; "
    7f7b2c
    +                      "next(pipeline=egress,table=%d);};", stage);
    7f7b2c
    +    } else if (!skip_hash_fields && selection_fields && selection_fields[0]) {
    7f7b2c
             ds_chomp(action, ';');
    7f7b2c
             ds_chomp(action, ')');
    7f7b2c
             ds_put_format(action, "; hash_fields=\"%s\");", selection_fields);
    7f7b2c
    @@ -5084,7 +5096,8 @@ build_empty_lb_event_flow(struct ovn_datapath *od, struct hmap *lflows,
    7f7b2c
                               struct nbrec_load_balancer *lb,
    7f7b2c
                               int pl, struct shash *meter_groups)
    7f7b2c
     {
    7f7b2c
    -    if (!controller_event_en || lb_vip->n_backends) {
    7f7b2c
    +    if (!controller_event_en || lb_vip->n_backends ||
    7f7b2c
    +        lb_vip->empty_backend_rej) {
    7f7b2c
             return;
    7f7b2c
         }
    7f7b2c
     
    7f7b2c
    @@ -5974,8 +5987,8 @@ build_lb_rules(struct ovn_datapath *od, struct hmap *lflows,
    7f7b2c
     
    7f7b2c
             /* New connections in Ingress table. */
    7f7b2c
             struct ds action = DS_EMPTY_INITIALIZER;
    7f7b2c
    -        build_lb_vip_ct_lb_actions(lb_vip, lb_vip_nb, &action,
    7f7b2c
    -                                   lb->selection_fields);
    7f7b2c
    +        build_lb_vip_actions(lb_vip, lb_vip_nb, &action,
    7f7b2c
    +                             lb->selection_fields, true);
    7f7b2c
     
    7f7b2c
             struct ds match = DS_EMPTY_INITIALIZER;
    7f7b2c
             ds_put_format(&match, "ct.new && %s.dst == %s", ip_match,
    7f7b2c
    @@ -9685,8 +9698,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
    7f7b2c
                     struct ovn_lb_vip *lb_vip = &lb->vips[j];
    7f7b2c
                     struct ovn_northd_lb_vip *lb_vip_nb = &lb->vips_nb[j];
    7f7b2c
                     ds_clear(&actions);
    7f7b2c
    -                build_lb_vip_ct_lb_actions(lb_vip, lb_vip_nb, &actions,
    7f7b2c
    -                                           lb->selection_fields);
    7f7b2c
    +                build_lb_vip_actions(lb_vip, lb_vip_nb, &actions,
    7f7b2c
    +                                     lb->selection_fields, false);
    7f7b2c
     
    7f7b2c
                     if (!sset_contains(&all_ips, lb_vip->vip_str)) {
    7f7b2c
                         sset_add(&all_ips, lb_vip->vip_str);
    7f7b2c
    @@ -9737,7 +9750,8 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
    7f7b2c
                         prio = 120;
    7f7b2c
                     }
    7f7b2c
     
    7f7b2c
    -                if (od->l3redirect_port) {
    7f7b2c
    +                if (od->l3redirect_port &&
    7f7b2c
    +                    (lb_vip->n_backends || !lb_vip->empty_backend_rej)) {
    7f7b2c
                         ds_put_format(&match, " && is_chassis_resident(%s)",
    7f7b2c
                                       od->l3redirect_port->json_key);
    7f7b2c
                     }
    7f7b2c
    diff --git a/ovn-nb.ovsschema b/ovn-nb.ovsschema
    7f7b2c
    index 269e3a888..af77dd138 100644
    7f7b2c
    --- a/ovn-nb.ovsschema
    7f7b2c
    +++ b/ovn-nb.ovsschema
    7f7b2c
    @@ -1,7 +1,7 @@
    7f7b2c
     {
    7f7b2c
         "name": "OVN_Northbound",
    7f7b2c
    -    "version": "5.28.0",
    7f7b2c
    -    "cksum": "610359755 26847",
    7f7b2c
    +    "version": "5.29.0",
    7f7b2c
    +    "cksum": "328602112 27064",
    7f7b2c
         "tables": {
    7f7b2c
             "NB_Global": {
    7f7b2c
                 "columns": {
    7f7b2c
    @@ -188,6 +188,11 @@
    7f7b2c
                                     ["eth_src", "eth_dst", "ip_src", "ip_dst",
    7f7b2c
                                      "tp_src", "tp_dst"]]},
    7f7b2c
                                  "min": 0, "max": "unlimited"}},
    7f7b2c
    +                "options": {
    7f7b2c
    +                     "type": {"key": "string",
    7f7b2c
    +                              "value": "string",
    7f7b2c
    +                              "min": 0,
    7f7b2c
    +                              "max": "unlimited"}},
    7f7b2c
                     "external_ids": {
    7f7b2c
                         "type": {"key": "string", "value": "string",
    7f7b2c
                                  "min": 0, "max": "unlimited"}}},
    7f7b2c
    diff --git a/ovn-nb.xml b/ovn-nb.xml
    7f7b2c
    index c9ab25ceb..e7a8d6833 100644
    7f7b2c
    --- a/ovn-nb.xml
    7f7b2c
    +++ b/ovn-nb.xml
    7f7b2c
    @@ -1635,6 +1635,16 @@
    7f7b2c
             See External IDs at the beginning of this document.
    7f7b2c
           </column>
    7f7b2c
         </group>
    7f7b2c
    +    <group title="Load_Balancer options">
    7f7b2c
    +      <column name="options" key="reject" type='{"type": "boolean"}'>
    7f7b2c
    +        If the load balancer is created with --reject option and
    7f7b2c
    +        it has no active backends, a TCP reset segment (for tcp) or an ICMP
    7f7b2c
    +        port unreachable packet (for all other kind of traffic) will be sent
    7f7b2c
    +        whenever an incoming packet is received for this load-balancer.
    7f7b2c
    +        Please note using --reject option will disable empty_lb
    7f7b2c
    +        SB controller event for this load balancer.
    7f7b2c
    +      </column>
    7f7b2c
    +    </group>
    7f7b2c
       
    7f7b2c
     
    7f7b2c
       
    7f7b2c
    diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
    7f7b2c
    index 90ca0a4db..50a4cae76 100644
    7f7b2c
    --- a/tests/ovn-northd.at
    7f7b2c
    +++ b/tests/ovn-northd.at
    7f7b2c
    @@ -1233,6 +1233,31 @@ wait_row_count Service_Monitor 2
    7f7b2c
     ovn-nbctl --wait=sb lb-del lb2
    7f7b2c
     wait_row_count Service_Monitor 0
    7f7b2c
     
    7f7b2c
    +check ovn-nbctl --reject lb-add lb3 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80
    7f7b2c
    +check ovn-nbctl --wait=sb set load_balancer lb3 ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
    7f7b2c
    +check ovn-nbctl --wait=sb set load_balancer lb3 ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2
    7f7b2c
    +wait_row_count Service_Monitor 0
    7f7b2c
    +
    7f7b2c
    +check ovn-nbctl --wait=sb ls-lb-add sw0 lb3
    7f7b2c
    +AT_CHECK([ovn-nbctl --wait=sb -- --id=@hc create \
    7f7b2c
    +Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer lb3 \
    7f7b2c
    +health_check @hc | uuidfilt], [0], [<0>
    7f7b2c
    +])
    7f7b2c
    +wait_row_count Service_Monitor 2
    7f7b2c
    +
    7f7b2c
    +# Set the service monitor for sw0-p1 and sw1-p1 to online
    7f7b2c
    +sm_sw0_p1=$(fetch_column Service_Monitor _uuid logical_port=sw0-p1)
    7f7b2c
    +sm_sw1_p1=$(fetch_column Service_Monitor _uuid logical_port=sw1-p1)
    7f7b2c
    +
    7f7b2c
    +ovn-sbctl set service_monitor $sm_sw0_p1 status=offline
    7f7b2c
    +ovn-sbctl set service_monitor $sm_sw1_p1 status=offline
    7f7b2c
    +
    7f7b2c
    +AT_CAPTURE_FILE([sbflows12])
    7f7b2c
    +OVS_WAIT_FOR_OUTPUT(
    7f7b2c
    +  [ovn-sbctl dump-flows sw0 | tee sbflows12 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" | grep priority=120 | sed 's/table=..//'], [0], [dnl
    7f7b2c
    +  (ls_in_stateful     ), priority=120  , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(reg0 = 0; reject { outport <-> inport; next(pipeline=egress,table=6);};)
    7f7b2c
    +])
    7f7b2c
    +
    7f7b2c
     AT_CLEANUP
    7f7b2c
     
    7f7b2c
     AT_SETUP([ovn -- Load balancer VIP in NAT entries])
    7f7b2c
    diff --git a/tests/system-ovn.at b/tests/system-ovn.at
    7f7b2c
    index d59f7c97e..1e73001ab 100644
    7f7b2c
    --- a/tests/system-ovn.at
    7f7b2c
    +++ b/tests/system-ovn.at
    7f7b2c
    @@ -1574,6 +1574,18 @@ OVS_WAIT_UNTIL([
    7f7b2c
         grep "selection_method=hash,fields(ip_src,ip_dst,sctp_src,sctp_dst)" -c) -eq 2
    7f7b2c
     ])
    7f7b2c
     
    7f7b2c
    +ovn-nbctl --reject lb-add lb3 30.0.0.10:80 ""
    7f7b2c
    +ovn-nbctl ls-lb-add foo lb3
    7f7b2c
    +# Filter reset segments
    7f7b2c
    +NS_CHECK_EXEC([foo1], [tcpdump -c 1 -neei foo1 ip[[33:1]]=0x14 > rst.pcap &])
    7f7b2c
    +sleep 1
    7f7b2c
    +NS_CHECK_EXEC([foo1], [wget -q 30.0.0.10],[4])
    7f7b2c
    +
    7f7b2c
    +OVS_WAIT_UNTIL([
    7f7b2c
    +    n_reset=$(cat rst.pcap | wc -l)
    7f7b2c
    +    test "${n_reset}" = "1"
    7f7b2c
    +])
    7f7b2c
    +
    7f7b2c
     OVS_APP_EXIT_AND_WAIT([ovn-controller])
    7f7b2c
     
    7f7b2c
     as ovn-sb
    7f7b2c
    @@ -4151,7 +4163,7 @@ ovn-nbctl lsp-set-type sw1-lr0 router
    7f7b2c
     ovn-nbctl lsp-set-addresses sw1-lr0 router
    7f7b2c
     ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1
    7f7b2c
     
    7f7b2c
    -ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80
    7f7b2c
    +ovn-nbctl --reject lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80
    7f7b2c
     
    7f7b2c
     ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2
    7f7b2c
     ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2
    7f7b2c
    @@ -4266,6 +4278,20 @@ ovn-sbctl list service_monitor
    7f7b2c
     OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns status find \
    7f7b2c
     service_monitor protocol=udp | sed '/^$/d' | grep offline | wc -l`])
    7f7b2c
     
    7f7b2c
    +# Stop webserer in sw1-p1
    7f7b2c
    +pid_file=$(cat l7_pid_file)
    7f7b2c
    +NS_CHECK_EXEC([sw1-p1], [kill $(cat $pid_file)])
    7f7b2c
    +
    7f7b2c
    +NS_CHECK_EXEC([sw0-p2], [tcpdump -c 1 -neei sw0-p2 ip[[33:1]]=0x14 > rst.pcap &])
    7f7b2c
    +OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns status find \
    7f7b2c
    +service_monitor protocol=tcp | sed '/^$/d' | grep offline | wc -l`])
    7f7b2c
    +NS_CHECK_EXEC([sw0-p2], [wget 10.0.0.10 -v -o wget$i.log],[4])
    7f7b2c
    +
    7f7b2c
    +OVS_WAIT_UNTIL([
    7f7b2c
    +    n_reset=$(cat rst.pcap | wc -l)
    7f7b2c
    +    test "${n_reset}" = "1"
    7f7b2c
    +])
    7f7b2c
    +
    7f7b2c
     OVS_APP_EXIT_AND_WAIT([ovn-controller])
    7f7b2c
     
    7f7b2c
     as ovn-sb
    7f7b2c
    diff --git a/utilities/ovn-nbctl.8.xml b/utilities/ovn-nbctl.8.xml
    7f7b2c
    index 59302296b..e5a35f307 100644
    7f7b2c
    --- a/utilities/ovn-nbctl.8.xml
    7f7b2c
    +++ b/utilities/ovn-nbctl.8.xml
    7f7b2c
    @@ -903,7 +903,7 @@
    7f7b2c
     
    7f7b2c
         

    Load Balancer Commands

    7f7b2c
         
    7f7b2c
    -      
    [--may-exist | --add-duplicate] lb-add lb vip ips [protocol]
    7f7b2c
    +        
    [--may-exist | --add-duplicate | --reject] lb-add lb vip ips [protocol]
    7f7b2c
           
    7f7b2c
             

    7f7b2c
              Creates a new load balancer named lb with the provided
    7f7b2c
    @@ -936,6 +936,15 @@
    7f7b2c
              creates a new load balancer with a duplicate name.
    7f7b2c
             

    7f7b2c
     
    7f7b2c
    +        

    7f7b2c
    +         If the load balancer is created with --reject option and
    7f7b2c
    +         it has no active backends, a TCP reset segment (for tcp) or an ICMP
    7f7b2c
    +         port unreachable packet (for all other kind of traffic) will be sent
    7f7b2c
    +         whenever an incoming packet is received for this load-balancer.
    7f7b2c
    +         Please note using --reject option will disable
    7f7b2c
    +         empty_lb SB controller event for this load balancer.
    7f7b2c
    +        

    7f7b2c
    +
    7f7b2c
             

    7f7b2c
              The following example adds a load balancer.
    7f7b2c
             

    7f7b2c
    diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c
    7f7b2c
    index d19e1b6c6..3a95f6b1f 100644
    7f7b2c
    --- a/utilities/ovn-nbctl.c
    7f7b2c
    +++ b/utilities/ovn-nbctl.c
    7f7b2c
    @@ -2821,6 +2821,7 @@ nbctl_lb_add(struct ctl_context *ctx)
    7f7b2c
     
    7f7b2c
         bool may_exist = shash_find(&ctx->options, "--may-exist") != NULL;
    7f7b2c
         bool add_duplicate = shash_find(&ctx->options, "--add-duplicate") != NULL;
    7f7b2c
    +    bool empty_backend_rej = shash_find(&ctx->options, "--reject") != NULL;
    7f7b2c
     
    7f7b2c
         const char *lb_proto;
    7f7b2c
         bool is_update_proto = false;
    7f7b2c
    @@ -2934,6 +2935,10 @@ nbctl_lb_add(struct ctl_context *ctx)
    7f7b2c
         smap_add(CONST_CAST(struct smap *, &lb->vips),
    7f7b2c
                 lb_vip_normalized, ds_cstr(&lb_ips_new));
    7f7b2c
         nbrec_load_balancer_set_vips(lb, &lb->vips);
    7f7b2c
    +    if (empty_backend_rej) {
    7f7b2c
    +        const struct smap options = SMAP_CONST1(&options, "reject", "true");
    7f7b2c
    +        nbrec_load_balancer_set_options(lb, &options);
    7f7b2c
    +    }
    7f7b2c
     out:
    7f7b2c
         ds_destroy(&lb_ips_new);
    7f7b2c
     
    7f7b2c
    @@ -6588,7 +6593,7 @@ static const struct ctl_command_syntax nbctl_commands[] = {
    7f7b2c
           nbctl_lr_nat_set_ext_ips, NULL, "--is-exempted", RW},
    7f7b2c
         /* load balancer commands. */
    7f7b2c
         { "lb-add", 3, 4, "LB VIP[:PORT] IP[:PORT]... [PROTOCOL]", NULL,
    7f7b2c
    -      nbctl_lb_add, NULL, "--may-exist,--add-duplicate", RW },
    7f7b2c
    +      nbctl_lb_add, NULL, "--may-exist,--add-duplicate,--reject", RW },
    7f7b2c
         { "lb-del", 1, 2, "LB [VIP]", NULL, nbctl_lb_del, NULL,
    7f7b2c
             "--if-exists", RW },
    7f7b2c
         { "lb-list", 0, 1, "[LB]", NULL, nbctl_lb_list, NULL, "", RO },
    7f7b2c
    -- 
    7f7b2c
    2.28.0
    7f7b2c