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