]> git.proxmox.com Git - mirror_frr.git/commitdiff
tools: Fix unnecessary routing perturbations due to old style config
authorDinesh G Dutt <ddutt@cumulusnetworks.com>
Tue, 13 Dec 2016 10:46:52 +0000 (02:46 -0800)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 30 Jan 2017 18:40:04 +0000 (13:40 -0500)
Ticket: CM-14060
Reviewed By:
Testing Done:

There are two harmful problems (cause routing changes in the network) with the
2.5.x style config:
    one with the old style specification of "multipath as-relax", and
    the other with ip import-table, used by redistribute neighbor

In 2.5, we had the user specify 'no-as-set' as the suffix to
'bgp bestpath as-path multipath relax' to avoid quagga's default behavior
which'd cause weird routing problems. However, in 3.x, we made 'no-as-set' as
the default, and so its neither required to specify it nor is it shown in the
running config. This means when we do quagga reload, we remove the multipath
as-relax line and add it back with the no-as-set line. This causes all BGP
sessions to be reset.

The problem with the "ip import-table" is that it causes us to unimport the
routes and then add it back again, causing routing prefix changes throughout
the network, potentially causing blackholing of traffic.

This fix addresses both these issues and avoids the unnecessary routing blips.

Signed-off-by: Dinesh Dutt <ddutt@cumulusnetworks.com>
tools/frr-reload.py

index 463784de11b8cb88e49f476fe72cd3801d5b288f..e14d78d54cfac4fe6ed7a9374d18f3b3c8d0dc6e 100755 (executable)
@@ -579,6 +579,41 @@ def ignore_delete_re_add_lines(lines_to_add, lines_to_del):
                     lines_to_add_to_del.append((ctx_keys, swpx_interface))
                     lines_to_add_to_del.append((tmp_ctx_keys, swpx_remoteas))
 
+        '''
+           In 3.0, we made bgp bestpath multipath as-relax command
+           automatically assume no-as-set since the lack of this option caused
+           weird routing problems and this problem was peculiar to this
+           implementation. When the running config is shown in relases after
+           3.0, the no-as-set is not shown as its the default. This causes
+           reload to unnecessarily unapply this option to only apply it back
+           again, causing unnecessary session resets. Handle this.
+        '''
+        if ctx_keys[0].startswith('router bgp') and line and 'multipath-relax' in line:
+            re_asrelax_new = re.search('^bgp\s+bestpath\s+as-path\s+multipath-relax$', line)
+            old_asrelax_cmd = 'bgp bestpath as-path multipath-relax no-as-set'
+            found_asrelax_old = line_exist(lines_to_add, ctx_keys, old_asrelax_cmd)
+
+            if re_asrelax_new and found_asrelax_old:
+                deleted = True
+                lines_to_del_to_del.append((ctx_keys, line))
+                lines_to_add_to_del.append((ctx_keys, old_asrelax_cmd))
+
+        '''
+           More old-to-new config handling. ip import-table no longer accepts
+           distance, but we honor the old syntax. But 'show running' shows only
+           the new syntax. This causes an unnecessary 'no import-table' followed
+           by the same old 'ip import-table' which causes perturbations in
+           announced routes leading to traffic blackholes. Fix this issue.
+        '''
+        re_importtbl = re.search('^ip\s+import-table\s+(\d+)$', ctx_keys[0])
+        if re_importtbl:
+            table_num = re_importtbl.group(1)
+            for ctx in lines_to_add:
+                if ctx[0][0].startswith('ip import-table %s distance' % table_num):
+                    deleted = True
+                    lines_to_del_to_del.append((('ip import-table %s' % table_num,), None))
+                    lines_to_add_to_del.append((ctx[0], None))
+                                                                                                                                                
         if not deleted:
             found_add_line = line_exist(lines_to_add, ctx_keys, line)