mirror of
				https://git.proxmox.com/git/mirror_frr
				synced 2025-11-04 06:38:04 +00:00 
			
		
		
		
	Zebra currently performs a delete followed by add when a route needs to be modified. Change this to use the replace semantics of netlink so that the operation can possibly be atomic. Note: This patch handles IPv6 routes, IPv4 already performs a replace. Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Dinesh Dutt <ddutt@cumulusnetworks.com> Ticket: CM-5597 Reviewed By: CCR-3407 Testing Done: Manual testing of various scearnios (Vivek, Satish) Note: This is an import of patch zebra-ipv6-route-replace.patch from 2.5-br.
		
			
				
	
	
		
			66 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* NULL kernel methods for testing. */
 | 
						|
 | 
						|
#include <zebra.h>
 | 
						|
#include <log.h>
 | 
						|
 | 
						|
#include "zebra/zserv.h"
 | 
						|
#include "zebra/rt.h"
 | 
						|
#include "zebra/redistribute.h"
 | 
						|
#include "zebra/connected.h"
 | 
						|
#include "zebra/rt_netlink.h"
 | 
						|
#include "zebra/rib.h"
 | 
						|
 | 
						|
int kernel_add_ipv4 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
int kernel_update_ipv4 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
 | 
						|
#pragma weak kernel_delete_ipv4 = kernel_add_ipv4
 | 
						|
#else
 | 
						|
int kernel_delete_ipv4 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
#endif
 | 
						|
 | 
						|
int kernel_add_ipv6 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
int kernel_update_ipv6 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
 | 
						|
#pragma weak kernel_delete_ipv6 = kernel_add_ipv6
 | 
						|
#else
 | 
						|
int kernel_delete_ipv6 (struct prefix *a, struct rib *b) { return 0; }
 | 
						|
#endif
 | 
						|
 | 
						|
int kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
 | 
						|
                            unsigned int index, int flags, int table)
 | 
						|
{ return 0; }
 | 
						|
 | 
						|
int kernel_add_route (struct prefix_ipv4 *a, struct in_addr *b, int c, int d)
 | 
						|
{ return 0; }
 | 
						|
 | 
						|
int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
 | 
						|
{
 | 
						|
  zlog_debug ("%s", __func__);
 | 
						|
  SET_FLAG (b->conf, ZEBRA_IFC_REAL);
 | 
						|
  connected_add_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen, 
 | 
						|
                      (b->destination ? &b->destination->u.prefix4 : NULL), 
 | 
						|
                      NULL);
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 | 
						|
int kernel_address_delete_ipv4 (struct interface *a, struct connected *b)
 | 
						|
{
 | 
						|
  zlog_debug ("%s", __func__);
 | 
						|
  connected_delete_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen, 
 | 
						|
                         (b->destination ? &b->destination->u.prefix4 : NULL));
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 | 
						|
int netlink_neigh_update (int cmd, int ifindex, __u32 addr, char *lla, int llalen)
 | 
						|
{
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 | 
						|
void kernel_init (struct zebra_vrf *zvrf) { return; }
 | 
						|
void kernel_terminate (struct zebra_vrf *zvrf) { return; }
 | 
						|
#ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
 | 
						|
#pragma weak route_read = kernel_init
 | 
						|
#else
 | 
						|
void route_read (struct zebra_vrf *zvrf) { return; }
 | 
						|
#endif
 |