kernel_null.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* NULL kernel methods for testing. */
  2. /*
  3. * Copyright (C) 2006 Sun Microsystems, Inc.
  4. *
  5. * This file is part of Quagga.
  6. *
  7. * Quagga is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2, or (at your option) any
  10. * later version.
  11. *
  12. * Quagga is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with Quagga; see the file COPYING. If not, write to the Free
  19. * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  20. * 02111-1307, USA.
  21. */
  22. #include <zebra.h>
  23. #include <log.h>
  24. #include "zebra/zserv.h"
  25. #include "zebra/rt.h"
  26. #include "zebra/redistribute.h"
  27. #include "zebra/connected.h"
  28. #include "zebra/rib.h"
  29. int kernel_add_ipv4 (struct prefix *a, struct rib *b) { return 0; }
  30. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  31. #pragma weak kernel_delete_ipv4 = kernel_add_ipv4
  32. #else
  33. int kernel_delete_ipv4 (struct prefix *a, struct rib *b) { return 0; }
  34. #endif
  35. int kernel_add_ipv6 (struct prefix *a, struct rib *b) { return 0; }
  36. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  37. #pragma weak kernel_delete_ipv6 = kernel_add_ipv6
  38. #else
  39. int kernel_delete_ipv6 (struct prefix *a, struct rib *b) { return 0; }
  40. #endif
  41. int kernel_add_route (struct prefix_ipv4 *a, struct in_addr *b, int c, int d)
  42. { return 0; }
  43. int kernel_address_add_ipv4 (struct interface *a, struct connected *b)
  44. {
  45. zlog_debug ("%s", __func__);
  46. SET_FLAG (b->conf, ZEBRA_IFC_REAL);
  47. connected_add_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
  48. (b->destination ? &b->destination->u.prefix4 : NULL),
  49. NULL);
  50. return 0;
  51. }
  52. int kernel_address_delete_ipv4 (struct interface *a, struct connected *b)
  53. {
  54. zlog_debug ("%s", __func__);
  55. connected_delete_ipv4 (a, 0, &b->address->u.prefix4, b->address->prefixlen,
  56. (b->destination ? &b->destination->u.prefix4 : NULL));
  57. return 0;
  58. }
  59. void kernel_init (struct zebra_vrf *zvrf) { return; }
  60. void kernel_terminate (struct zebra_vrf *zvrf) { return; }
  61. #ifdef HAVE_SYS_WEAK_ALIAS_PRAGMA
  62. #pragma weak route_read = kernel_init
  63. #else
  64. void route_read (struct zebra_vrf *zvrf) { return; }
  65. #endif