paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame^] | 1 | /* Interface function header. |
| 2 | * Copyright (C) 1999 Kunihiro Ishiguro |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | * 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | /* For interface multicast configuration. */ |
| 23 | #define IF_ZEBRA_MULTICAST_UNSPEC 0 |
| 24 | #define IF_ZEBRA_MULTICAST_ON 1 |
| 25 | #define IF_ZEBRA_MULTICAST_OFF 2 |
| 26 | |
| 27 | /* For interface shutdown configuration. */ |
| 28 | #define IF_ZEBRA_SHUTDOWN_UNSPEC 0 |
| 29 | #define IF_ZEBRA_SHUTDOWN_ON 1 |
| 30 | #define IF_ZEBRA_SHUTDOWN_OFF 2 |
| 31 | |
| 32 | /* Router advertisement feature. */ |
| 33 | #if (defined(LINUX_IPV6) && (defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1)) || defined(KAME) |
| 34 | #define RTADV |
| 35 | #endif |
| 36 | |
| 37 | #ifdef RTADV |
| 38 | /* Router advertisement parameter. From RFC2461. */ |
| 39 | struct rtadvconf |
| 40 | { |
| 41 | /* A flag indicating whether or not the router sends periodic Router |
| 42 | Advertisements and responds to Router Solicitations. |
| 43 | Default: FALSE */ |
| 44 | int AdvSendAdvertisements; |
| 45 | |
| 46 | /* The maximum time allowed between sending unsolicited multicast |
| 47 | Router Advertisements from the interface, in seconds. MUST be no |
| 48 | less than 4 seconds and no greater than 1800 seconds. |
| 49 | |
| 50 | Default: 600 seconds */ |
| 51 | int MaxRtrAdvInterval; |
| 52 | #define RTADV_MAX_RTR_ADV_INTERVAL 600 |
| 53 | |
| 54 | /* The minimum time allowed between sending unsolicited multicast |
| 55 | Router Advertisements from the interface, in seconds. MUST be no |
| 56 | less than 3 seconds and no greater than .75 * MaxRtrAdvInterval. |
| 57 | |
| 58 | Default: 0.33 * MaxRtrAdvInterval */ |
| 59 | int MinRtrAdvInterval; |
| 60 | #define RTADV_MIN_RTR_ADV_INTERVAL (0.33 * RTADV_MAX_RTR_ADV_INTERVAL) |
| 61 | |
| 62 | /* Unsolicited Router Advertisements' interval timer. */ |
| 63 | int AdvIntervalTimer; |
| 64 | |
| 65 | /* The TRUE/FALSE value to be placed in the "Managed address |
| 66 | configuration" flag field in the Router Advertisement. See |
| 67 | [ADDRCONF]. |
| 68 | |
| 69 | Default: FALSE */ |
| 70 | int AdvManagedFlag; |
| 71 | |
| 72 | |
| 73 | /* The TRUE/FALSE value to be placed in the "Other stateful |
| 74 | configuration" flag field in the Router Advertisement. See |
| 75 | [ADDRCONF]. |
| 76 | |
| 77 | Default: FALSE */ |
| 78 | int AdvOtherConfigFlag; |
| 79 | |
| 80 | /* The value to be placed in MTU options sent by the router. A |
| 81 | value of zero indicates that no MTU options are sent. |
| 82 | |
| 83 | Default: 0 */ |
| 84 | int AdvLinkMTU; |
| 85 | |
| 86 | |
| 87 | /* The value to be placed in the Reachable Time field in the Router |
| 88 | Advertisement messages sent by the router. The value zero means |
| 89 | unspecified (by this router). MUST be no greater than 3,600,000 |
| 90 | milliseconds (1 hour). |
| 91 | |
| 92 | Default: 0 */ |
| 93 | u_int32_t AdvReachableTime; |
| 94 | #define RTADV_MAX_REACHABLE_TIME 3600000 |
| 95 | |
| 96 | |
| 97 | /* The value to be placed in the Retrans Timer field in the Router |
| 98 | Advertisement messages sent by the router. The value zero means |
| 99 | unspecified (by this router). |
| 100 | |
| 101 | Default: 0 */ |
| 102 | int AdvRetransTimer; |
| 103 | |
| 104 | /* The default value to be placed in the Cur Hop Limit field in the |
| 105 | Router Advertisement messages sent by the router. The value |
| 106 | should be set to that current diameter of the Internet. The |
| 107 | value zero means unspecified (by this router). |
| 108 | |
| 109 | Default: The value specified in the "Assigned Numbers" RFC |
| 110 | [ASSIGNED] that was in effect at the time of implementation. */ |
| 111 | int AdvCurHopLimit; |
| 112 | |
| 113 | /* The value to be placed in the Router Lifetime field of Router |
| 114 | Advertisements sent from the interface, in seconds. MUST be |
| 115 | either zero or between MaxRtrAdvInterval and 9000 seconds. A |
| 116 | value of zero indicates that the router is not to be used as a |
| 117 | default router. |
| 118 | |
| 119 | Default: 3 * MaxRtrAdvInterval */ |
| 120 | int AdvDefaultLifetime; |
| 121 | #define RTADV_ADV_DEFAULT_LIFETIME (3 * RTADV_MAX_RTR_ADV_INTERVAL) |
| 122 | |
| 123 | |
| 124 | /* A list of prefixes to be placed in Prefix Information options in |
| 125 | Router Advertisement messages sent from the interface. |
| 126 | |
| 127 | Default: all prefixes that the router advertises via routing |
| 128 | protocols as being on-link for the interface from which the |
| 129 | advertisement is sent. The link-local prefix SHOULD NOT be |
| 130 | included in the list of advertised prefixes. */ |
| 131 | list AdvPrefixList; |
| 132 | }; |
| 133 | |
| 134 | #endif /* RTADV */ |
| 135 | |
| 136 | /* `zebra' daemon local interface structure. */ |
| 137 | struct zebra_if |
| 138 | { |
| 139 | /* Shutdown configuration. */ |
| 140 | u_char shutdown; |
| 141 | |
| 142 | /* Multicast configuration. */ |
| 143 | u_char multicast; |
| 144 | |
| 145 | /* Router advertise configuration. */ |
| 146 | u_char rtadv_enable; |
| 147 | |
| 148 | /* Interface's address. */ |
| 149 | list address; |
| 150 | |
| 151 | #ifdef RTADV |
| 152 | struct rtadvconf rtadv; |
| 153 | #endif /* RTADV */ |
| 154 | }; |
| 155 | |
| 156 | void if_delete_update (struct interface *ifp); |
| 157 | void if_add_update (struct interface *ifp); |
| 158 | void if_up (struct interface *); |
| 159 | void if_down (struct interface *); |
| 160 | void if_refresh (struct interface *); |
| 161 | void zebra_interface_up_update (struct interface *ifp); |
| 162 | void zebra_interface_down_update (struct interface *ifp); |
| 163 | |
| 164 | #ifdef HAVE_PROC_NET_DEV |
| 165 | int ifstat_update_proc (); |
| 166 | #endif /* HAVE_PROC_NET_DEV */ |
| 167 | #ifdef HAVE_NET_RT_IFLIST |
| 168 | void ifstat_update_sysctl (); |
| 169 | |
| 170 | #endif /* HAVE_NET_RT_IFLIST */ |
| 171 | #ifdef HAVE_PROC_NET_DEV |
| 172 | int interface_list_proc (); |
| 173 | #endif /* HAVE_PROC_NET_DEV */ |
| 174 | #ifdef HAVE_PROC_NET_IF_INET6 |
| 175 | int ifaddr_proc_ipv6 (); |
| 176 | #endif /* HAVE_PROC_NET_IF_INET6 */ |
| 177 | |
| 178 | #ifdef BSDI |
| 179 | int if_kvm_get_mtu (struct interface *); |
| 180 | #endif /* BSDI */ |