kernel_null.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* NULL kernel methods for testing. */
  2. #include <zebra.h>
  3. #include <log.h>
  4. #include "zebra/zserv.h"
  5. #include "zebra/rt.h"
  6. #include "zebra/redistribute.h"
  7. #include "zebra/connected.h"
  8. int kernel_add_ipv4 (struct prefix *a, struct rib *b) { return 0; }
  9. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  10. #pragma weak kernel_delete_ipv4 = kernel_add_ipv4
  11. #else
  12. int kernel_delete_ipv4 (struct prefix *a, struct rib *b) { return 0; }
  13. #endif
  14. int kernel_add_ipv6 (struct prefix *a, struct rib *b) { return 0; }
  15. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  16. #pragma weak kernel_delete_ipv6 = kernel_add_ipv6
  17. #else
  18. int kernel_delete_ipv6 (struct prefix *a, struct rib *b) { return 0; }
  19. #endif
  20. int kernel_delete_ipv6_old (struct prefix_ipv6 *dest, struct in6_addr *gate,
  21. unsigned int index, int flags, int table)
  22. { return 0; }
  23. int kernel_add_route (struct prefix_ipv4 *a, struct in_addr *b, int c, int d)
  24. { return 0; }
  25. int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
  26. {
  27. zlog_debug ("%s", __func__);
  28. SET_FLAG (b->conf, ZEBRA_IFC_REAL);
  29. connected_add_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
  30. (b->destination ? &b->destination->u.prefix4 : NULL),
  31. NULL);
  32. return 0;
  33. }
  34. int kernel_address_delete_ipv4 (struct interface *a, struct connected *b)
  35. {
  36. zlog_debug ("%s", __func__);
  37. connected_delete_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
  38. (b->destination ? &b->destination->u.prefix4 : NULL));
  39. return 0;
  40. }
  41. void kernel_init (void) { return; }
  42. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  43. #pragma weak route_read = kernel_init
  44. #else
  45. void route_read (void) { return; }
  46. #endif