]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: simplify fs add pbr entry
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 21 Aug 2018 08:38:27 +0000 (10:38 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Wed, 22 Aug 2018 12:36:03 +0000 (14:36 +0200)
Simplify the fs pbr entry creation.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_pbr.c

index 51c7de645e2bb387a1a670ea6cb97d6c1a4cb792..fc0fa6c7e9987e47556134d397652e40b69d8735 100644 (file)
@@ -1805,7 +1805,7 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
                       bgp_pbr_match_alloc_intern);
 
        /* new, then self allocate ipset_name and unique */
-       if (bpm && bpm->unique == 0) {
+       if (bpm->unique == 0) {
                bpm->unique = ++bgp_pbr_match_counter_unique;
                /* 0 value is forbidden */
                sprintf(bpm->ipset_name, "match%p", bpm);
@@ -1836,10 +1836,9 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
        temp2.src_port_max = src_port ? src_port->max_port : 0;
        temp2.dst_port_max = dst_port ? dst_port->max_port : 0;
        temp2.proto = bpf->protocol;
-       if (bpm)
-               bpme = hash_get(bpm->entry_hash, &temp2,
-                               bgp_pbr_match_entry_alloc_intern);
-       if (bpme && bpme->unique == 0) {
+       bpme = hash_get(bpm->entry_hash, &temp2,
+                       bgp_pbr_match_entry_alloc_intern);
+       if (bpme->unique == 0) {
                bpme->unique = ++bgp_pbr_match_entry_counter_unique;
                /* 0 value is forbidden */
                bpme->backpointer = bpm;
@@ -1851,7 +1850,7 @@ static void bgp_pbr_policyroute_add_to_zebra_unit(struct bgp *bgp,
                bpme_found = true;
 
        /* already installed */
-       if (bpme_found && bpme) {
+       if (bpme_found) {
                struct bgp_info_extra *extra = bgp_info_extra_get(binfo);
 
                if (extra && extra->bgp_fs_pbr &&