From 514665b900c8f15b0f33ecaecddaaf1f3c0250df Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 22 Jul 2015 13:21:25 -0700 Subject: [PATCH] Some more missing changes --- debian/quagga.install | 1 + ripd/ripd.h | 2 +- tools/quagga-reload.py | 26 ++++++++++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/debian/quagga.install b/debian/quagga.install index 5587c72c8f..5fd9e5c0fa 100644 --- a/debian/quagga.install +++ b/debian/quagga.install @@ -1,3 +1,4 @@ +etc/quagga/ usr/bin/vtysh usr/include/quagga/ usr/lib/ diff --git a/ripd/ripd.h b/ripd/ripd.h index 0fc2fd3756..45b07b9cb6 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -49,7 +49,7 @@ #define RIP_RTE_SIZE 20 /* Max count of routing table entry in one rip packet. */ -#define RIP_MAX_RTE ((RIP_PACKET_MAXSIZ - RIP_HEADER_SIZE) / RIP_RTE_SIZE) +#define RIP_MAX_RTE 25 /* RIP version 2 multicast address. */ #ifndef INADDR_RIP_GROUP diff --git a/tools/quagga-reload.py b/tools/quagga-reload.py index a07f1423fb..e05d3382f6 100755 --- a/tools/quagga-reload.py +++ b/tools/quagga-reload.py @@ -388,6 +388,7 @@ def compare_context_objects(newconf, running): # Compare the two Config objects to find the lines that we need to add/del lines_to_add = [] lines_to_del = [] + restart_bgpd = False # Find contexts that are in newconf but not in running # Find contexts that are in running but not in newconf @@ -395,8 +396,13 @@ def compare_context_objects(newconf, running): if running_ctx_keys not in newconf.contexts: + # Check if bgp's local ASN has changed. If yes, just restart it + if "router bgp" in running_ctx_keys[0]: + restart_bgpd = True + continue + # Non-global context - if running_ctx_keys and not ("address-family" in key for key in running_ctx_keys): + if running_ctx_keys and not any("address-family" in key for key in running_ctx_keys): lines_to_del.append((running_ctx_keys, None)) # Global context @@ -422,12 +428,17 @@ def compare_context_objects(newconf, running): for (newconf_ctx_keys, newconf_ctx) in newconf.contexts.iteritems(): if newconf_ctx_keys not in running.contexts: + + # If its "router bgp" and we're restarting bgp, skip doing + # anything specific for bgp + if "router bgp" in newconf_ctx_keys[0] and restart_bgpd: + continue lines_to_add.append((newconf_ctx_keys, None)) for line in newconf_ctx.lines: lines_to_add.append((newconf_ctx_keys, line)) - return (lines_to_add, lines_to_del) + return (lines_to_add, lines_to_del, restart_bgpd) if __name__ == '__main__': # Command line options @@ -478,7 +489,7 @@ if __name__ == '__main__': #print "Running config context" #print running.get_contexts() - (lines_to_add, lines_to_del) = compare_context_objects(newconf, running) + (lines_to_add, lines_to_del, restart_bgp) = compare_context_objects(newconf, running) if lines_to_del: print "\nLines To Delete" @@ -504,6 +515,9 @@ if __name__ == '__main__': cmd = line_to_vtysh_conft(ctx_keys, line, False) print cmd + if restart_bgp: + print "BGP local AS changed, restarting bgpd" + print '' elif args.reload: @@ -538,7 +552,7 @@ if __name__ == '__main__': running.load_from_show_running() logger.info('Running Quagga Config (Pass #%d)\n%s', x, running.get_lines()) - (lines_to_add, lines_to_del) = compare_context_objects(newconf, running) + (lines_to_add, lines_to_del, restart_bgp) = compare_context_objects(newconf, running) if lines_to_del: for (ctx_keys, line) in lines_to_del: @@ -602,3 +616,7 @@ if __name__ == '__main__': subprocess.call(cmd) + if restart_bgp: + cmd = ['sudo', 'service', 'quagga', 'restart', 'bgpd'] + subprocess.call(cmd) + -- 2.39.5