paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Interface related function for RIPng. |
| 3 | * Copyright (C) 1998 Kunihiro Ishiguro |
| 4 | * |
| 5 | * This file is part of GNU Zebra. |
| 6 | * |
| 7 | * GNU Zebra 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 | * GNU Zebra 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 GNU Zebra; 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 | |
| 23 | #include <zebra.h> |
| 24 | |
| 25 | #include "linklist.h" |
| 26 | #include "if.h" |
| 27 | #include "prefix.h" |
| 28 | #include "memory.h" |
| 29 | #include "network.h" |
| 30 | #include "filter.h" |
| 31 | #include "log.h" |
| 32 | #include "stream.h" |
| 33 | #include "zclient.h" |
| 34 | #include "command.h" |
| 35 | #include "table.h" |
| 36 | #include "thread.h" |
gdt | 4d4653a | 2004-07-01 19:26:33 +0000 | [diff] [blame] | 37 | #include "privs.h" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 38 | |
| 39 | #include "ripngd/ripngd.h" |
| 40 | #include "ripngd/ripng_debug.h" |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 41 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 42 | /* If RFC2133 definition is used. */ |
| 43 | #ifndef IPV6_JOIN_GROUP |
| 44 | #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP |
| 45 | #endif |
| 46 | #ifndef IPV6_LEAVE_GROUP |
| 47 | #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP |
| 48 | #endif |
| 49 | |
gdt | 4d4653a | 2004-07-01 19:26:33 +0000 | [diff] [blame] | 50 | extern struct zebra_privs_t ripngd_privs; |
| 51 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 52 | /* Static utility function. */ |
| 53 | static void ripng_enable_apply (struct interface *); |
| 54 | static void ripng_passive_interface_apply (struct interface *); |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 55 | static int ripng_enable_if_lookup (const char *); |
| 56 | static int ripng_enable_network_lookup2 (struct connected *); |
| 57 | static void ripng_enable_apply_all (void); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 58 | |
| 59 | /* Join to the all rip routers multicast group. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 60 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 61 | ripng_multicast_join (struct interface *ifp) |
| 62 | { |
| 63 | int ret; |
| 64 | struct ipv6_mreq mreq; |
ajs | 656b4ee | 2005-01-30 18:08:12 +0000 | [diff] [blame] | 65 | int save_errno; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 66 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 67 | if (if_is_up (ifp) && if_is_multicast (ifp)) { |
| 68 | memset (&mreq, 0, sizeof (mreq)); |
| 69 | inet_pton(AF_INET6, RIPNG_GROUP, &mreq.ipv6mr_multiaddr); |
| 70 | mreq.ipv6mr_interface = ifp->ifindex; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 71 | |
gdt | 4d4653a | 2004-07-01 19:26:33 +0000 | [diff] [blame] | 72 | /* |
| 73 | * NetBSD 1.6.2 requires root to join groups on gif(4). |
| 74 | * While this is bogus, privs are available and easy to use |
| 75 | * for this call as a workaround. |
| 76 | */ |
| 77 | if (ripngd_privs.change (ZPRIVS_RAISE)) |
| 78 | zlog_err ("ripng_multicast_join: could not raise privs"); |
| 79 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 80 | ret = setsockopt (ripng->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, |
| 81 | (char *) &mreq, sizeof (mreq)); |
ajs | 656b4ee | 2005-01-30 18:08:12 +0000 | [diff] [blame] | 82 | save_errno = errno; |
gdt | ddf1c26 | 2004-01-04 01:02:55 +0000 | [diff] [blame] | 83 | |
gdt | 4d4653a | 2004-07-01 19:26:33 +0000 | [diff] [blame] | 84 | if (ripngd_privs.change (ZPRIVS_LOWER)) |
| 85 | zlog_err ("ripng_multicast_join: could not lower privs"); |
| 86 | |
ajs | 656b4ee | 2005-01-30 18:08:12 +0000 | [diff] [blame] | 87 | if (ret < 0 && save_errno == EADDRINUSE) |
gdt | ddf1c26 | 2004-01-04 01:02:55 +0000 | [diff] [blame] | 88 | { |
| 89 | /* |
| 90 | * Group is already joined. This occurs due to sloppy group |
| 91 | * management, in particular declining to leave the group on |
| 92 | * an interface that has just gone down. |
| 93 | */ |
| 94 | zlog_warn ("ripng join on %s EADDRINUSE (ignoring)\n", ifp->name); |
| 95 | return 0; /* not an error */ |
| 96 | } |
| 97 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 98 | if (ret < 0) |
ajs | 656b4ee | 2005-01-30 18:08:12 +0000 | [diff] [blame] | 99 | zlog_warn ("can't setsockopt IPV6_JOIN_GROUP: %s", |
| 100 | safe_strerror (save_errno)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 101 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 102 | if (IS_RIPNG_DEBUG_EVENT) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 103 | zlog_debug ("RIPng %s join to all-rip-routers multicast group", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 104 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 105 | if (ret < 0) |
| 106 | return -1; |
| 107 | } |
| 108 | return 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | /* Leave from the all rip routers multicast group. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 112 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 113 | ripng_multicast_leave (struct interface *ifp) |
| 114 | { |
| 115 | int ret; |
| 116 | struct ipv6_mreq mreq; |
| 117 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 118 | if (if_is_up (ifp) && if_is_multicast (ifp)) { |
| 119 | memset (&mreq, 0, sizeof (mreq)); |
| 120 | inet_pton(AF_INET6, RIPNG_GROUP, &mreq.ipv6mr_multiaddr); |
| 121 | mreq.ipv6mr_interface = ifp->ifindex; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 122 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 123 | ret = setsockopt (ripng->sock, IPPROTO_IPV6, IPV6_LEAVE_GROUP, |
| 124 | (char *) &mreq, sizeof (mreq)); |
| 125 | if (ret < 0) |
ajs | 6099b3b | 2004-11-20 02:06:59 +0000 | [diff] [blame] | 126 | zlog_warn ("can't setsockopt IPV6_LEAVE_GROUP: %s\n", safe_strerror (errno)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 127 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 128 | if (IS_RIPNG_DEBUG_EVENT) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 129 | zlog_debug ("RIPng %s leave from all-rip-routers multicast group", |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 130 | ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 131 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 132 | if (ret < 0) |
| 133 | return -1; |
| 134 | } |
| 135 | |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | /* How many link local IPv6 address could be used on the interface ? */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 140 | static int |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 141 | ripng_if_ipv6_lladdress_check (struct interface *ifp) |
| 142 | { |
| 143 | struct listnode *nn; |
| 144 | struct connected *connected; |
| 145 | int count = 0; |
| 146 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 147 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, nn, connected)) |
| 148 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 149 | struct prefix *p; |
| 150 | p = connected->address; |
| 151 | |
| 152 | if ((p->family == AF_INET6) && |
| 153 | IN6_IS_ADDR_LINKLOCAL (&p->u.prefix6)) |
| 154 | count++; |
| 155 | } |
| 156 | |
| 157 | return count; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 160 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 161 | ripng_if_down (struct interface *ifp) |
| 162 | { |
| 163 | struct route_node *rp; |
| 164 | struct ripng_info *rinfo; |
| 165 | struct ripng_interface *ri; |
Feng Lu | e97c31a | 2015-05-22 11:39:53 +0200 | [diff] [blame] | 166 | struct list *list = NULL; |
| 167 | struct listnode *listnode = NULL, *nextnode = NULL; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 168 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 169 | if (ripng) |
Feng Lu | e97c31a | 2015-05-22 11:39:53 +0200 | [diff] [blame] | 170 | for (rp = route_top (ripng->table); rp; rp = route_next (rp)) |
| 171 | if ((list = rp->info) != NULL) |
| 172 | for (ALL_LIST_ELEMENTS (list, listnode, nextnode, rinfo)) |
| 173 | if (rinfo->ifindex == ifp->ifindex) |
| 174 | ripng_ecmp_delete (rinfo); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 175 | |
| 176 | ri = ifp->info; |
| 177 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 178 | if (ri->running) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 179 | { |
| 180 | if (IS_RIPNG_DEBUG_EVENT) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 181 | zlog_debug ("turn off %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 182 | |
| 183 | /* Leave from multicast group. */ |
| 184 | ripng_multicast_leave (ifp); |
| 185 | |
| 186 | ri->running = 0; |
| 187 | } |
| 188 | |
| 189 | return 0; |
| 190 | } |
| 191 | |
| 192 | /* Inteface link up message processing. */ |
| 193 | int |
| 194 | ripng_interface_up (int command, struct zclient *zclient, zebra_size_t length) |
| 195 | { |
| 196 | struct stream *s; |
| 197 | struct interface *ifp; |
| 198 | |
| 199 | /* zebra_interface_state_read() updates interface structure in iflist. */ |
| 200 | s = zclient->ibuf; |
| 201 | ifp = zebra_interface_state_read (s); |
| 202 | |
| 203 | if (ifp == NULL) |
| 204 | return 0; |
| 205 | |
| 206 | if (IS_RIPNG_DEBUG_ZEBRA) |
Stephen Hemminger | 30d2059 | 2009-07-28 11:58:51 +0100 | [diff] [blame] | 207 | zlog_debug ("interface up %s index %d flags %llx metric %d mtu %d", |
| 208 | ifp->name, ifp->ifindex, (unsigned long long)ifp->flags, |
| 209 | ifp->metric, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 210 | |
| 211 | /* Check if this interface is RIPng enabled or not. */ |
| 212 | ripng_enable_apply (ifp); |
| 213 | |
| 214 | /* Check for a passive interface. */ |
| 215 | ripng_passive_interface_apply (ifp); |
| 216 | |
| 217 | /* Apply distribute list to the all interface. */ |
| 218 | ripng_distribute_update_interface (ifp); |
| 219 | |
| 220 | return 0; |
| 221 | } |
| 222 | |
| 223 | /* Inteface link down message processing. */ |
| 224 | int |
| 225 | ripng_interface_down (int command, struct zclient *zclient, |
| 226 | zebra_size_t length) |
| 227 | { |
| 228 | struct stream *s; |
| 229 | struct interface *ifp; |
| 230 | |
| 231 | /* zebra_interface_state_read() updates interface structure in iflist. */ |
| 232 | s = zclient->ibuf; |
| 233 | ifp = zebra_interface_state_read (s); |
| 234 | |
| 235 | if (ifp == NULL) |
| 236 | return 0; |
| 237 | |
| 238 | ripng_if_down (ifp); |
| 239 | |
| 240 | if (IS_RIPNG_DEBUG_ZEBRA) |
Stephen Hemminger | 5eb9d11 | 2009-12-10 15:52:33 +0300 | [diff] [blame] | 241 | zlog_debug ("interface down %s index %d flags %#llx metric %d mtu %d", |
| 242 | ifp->name, ifp->ifindex, |
| 243 | (unsigned long long) ifp->flags, ifp->metric, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | /* Inteface addition message from zebra. */ |
| 249 | int |
| 250 | ripng_interface_add (int command, struct zclient *zclient, zebra_size_t length) |
| 251 | { |
| 252 | struct interface *ifp; |
| 253 | |
| 254 | ifp = zebra_interface_add_read (zclient->ibuf); |
| 255 | |
| 256 | if (IS_RIPNG_DEBUG_ZEBRA) |
Stephen Hemminger | 5eb9d11 | 2009-12-10 15:52:33 +0300 | [diff] [blame] | 257 | zlog_debug ("RIPng interface add %s index %d flags %#llx metric %d mtu %d", |
| 258 | ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, |
| 259 | ifp->metric, ifp->mtu6); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 260 | |
| 261 | /* Check is this interface is RIP enabled or not.*/ |
| 262 | ripng_enable_apply (ifp); |
| 263 | |
| 264 | /* Apply distribute list to the interface. */ |
| 265 | ripng_distribute_update_interface (ifp); |
| 266 | |
| 267 | /* Check interface routemap. */ |
| 268 | ripng_if_rmap_update_interface (ifp); |
| 269 | |
| 270 | return 0; |
| 271 | } |
| 272 | |
| 273 | int |
| 274 | ripng_interface_delete (int command, struct zclient *zclient, |
| 275 | zebra_size_t length) |
| 276 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 277 | struct interface *ifp; |
| 278 | struct stream *s; |
| 279 | |
| 280 | s = zclient->ibuf; |
| 281 | /* zebra_interface_state_read() updates interface structure in iflist */ |
| 282 | ifp = zebra_interface_state_read(s); |
| 283 | |
| 284 | if (ifp == NULL) |
| 285 | return 0; |
| 286 | |
| 287 | if (if_is_up (ifp)) { |
| 288 | ripng_if_down(ifp); |
| 289 | } |
| 290 | |
Stephen Hemminger | 5eb9d11 | 2009-12-10 15:52:33 +0300 | [diff] [blame] | 291 | zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d", |
| 292 | ifp->name, ifp->ifindex, (unsigned long long) ifp->flags, |
| 293 | ifp->metric, ifp->mtu6); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 294 | |
| 295 | /* To support pseudo interface do not free interface structure. */ |
| 296 | /* if_delete(ifp); */ |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 297 | ifp->ifindex = IFINDEX_INTERNAL; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 298 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 299 | return 0; |
| 300 | } |
| 301 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 302 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 303 | ripng_interface_clean (void) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 304 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 305 | struct listnode *node, *nnode; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 306 | struct interface *ifp; |
| 307 | struct ripng_interface *ri; |
| 308 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 309 | for (ALL_LIST_ELEMENTS (iflist, node, nnode, ifp)) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 310 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 311 | ri = ifp->info; |
| 312 | |
| 313 | ri->enable_network = 0; |
| 314 | ri->enable_interface = 0; |
| 315 | ri->running = 0; |
| 316 | |
| 317 | if (ri->t_wakeup) |
| 318 | { |
| 319 | thread_cancel (ri->t_wakeup); |
| 320 | ri->t_wakeup = NULL; |
| 321 | } |
| 322 | } |
| 323 | } |
| 324 | |
| 325 | void |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 326 | ripng_interface_reset (void) |
| 327 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 328 | struct listnode *node; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 329 | struct interface *ifp; |
| 330 | struct ripng_interface *ri; |
| 331 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 332 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 333 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 334 | ri = ifp->info; |
| 335 | |
| 336 | ri->enable_network = 0; |
| 337 | ri->enable_interface = 0; |
| 338 | ri->running = 0; |
| 339 | |
| 340 | ri->split_horizon = RIPNG_NO_SPLIT_HORIZON; |
| 341 | ri->split_horizon_default = RIPNG_NO_SPLIT_HORIZON; |
| 342 | |
| 343 | ri->list[RIPNG_FILTER_IN] = NULL; |
| 344 | ri->list[RIPNG_FILTER_OUT] = NULL; |
| 345 | |
| 346 | ri->prefix[RIPNG_FILTER_IN] = NULL; |
| 347 | ri->prefix[RIPNG_FILTER_OUT] = NULL; |
| 348 | |
| 349 | if (ri->t_wakeup) |
| 350 | { |
| 351 | thread_cancel (ri->t_wakeup); |
| 352 | ri->t_wakeup = NULL; |
| 353 | } |
| 354 | |
| 355 | ri->passive = 0; |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | static void |
| 360 | ripng_apply_address_add (struct connected *ifc) { |
| 361 | struct prefix_ipv6 address; |
| 362 | struct prefix *p; |
| 363 | |
| 364 | if (!ripng) |
| 365 | return; |
| 366 | |
| 367 | if (! if_is_up(ifc->ifp)) |
| 368 | return; |
| 369 | |
| 370 | p = ifc->address; |
| 371 | |
| 372 | memset (&address, 0, sizeof (address)); |
| 373 | address.family = p->family; |
| 374 | address.prefix = p->u.prefix6; |
| 375 | address.prefixlen = p->prefixlen; |
| 376 | apply_mask_ipv6(&address); |
| 377 | |
| 378 | /* Check if this interface is RIP enabled or not |
| 379 | or Check if this address's prefix is RIP enabled */ |
| 380 | if ((ripng_enable_if_lookup(ifc->ifp->name) >= 0) || |
| 381 | (ripng_enable_network_lookup2(ifc) >= 0)) |
| 382 | ripng_redistribute_add(ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE, |
| 383 | &address, ifc->ifp->ifindex, NULL); |
| 384 | |
| 385 | } |
| 386 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 387 | int |
| 388 | ripng_interface_address_add (int command, struct zclient *zclient, |
| 389 | zebra_size_t length) |
| 390 | { |
| 391 | struct connected *c; |
| 392 | struct prefix *p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 393 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 394 | c = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_ADD, |
| 395 | zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 396 | |
| 397 | if (c == NULL) |
| 398 | return 0; |
| 399 | |
| 400 | p = c->address; |
| 401 | |
| 402 | if (p->family == AF_INET6) |
| 403 | { |
Paul Jakma | 995b965 | 2006-05-11 13:20:47 +0000 | [diff] [blame] | 404 | struct ripng_interface *ri = c->ifp->info; |
| 405 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 406 | if (IS_RIPNG_DEBUG_ZEBRA) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 407 | zlog_debug ("RIPng connected address %s/%d add", |
hasso | 3a2ce6a | 2005-04-08 01:30:51 +0000 | [diff] [blame] | 408 | inet6_ntoa(p->u.prefix6), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 409 | p->prefixlen); |
| 410 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 411 | /* Check is this prefix needs to be redistributed. */ |
| 412 | ripng_apply_address_add(c); |
| 413 | |
| 414 | /* Let's try once again whether the interface could be activated */ |
Paul Jakma | 995b965 | 2006-05-11 13:20:47 +0000 | [diff] [blame] | 415 | if (!ri->running) { |
| 416 | /* Check if this interface is RIP enabled or not.*/ |
| 417 | ripng_enable_apply (c->ifp); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 418 | |
Paul Jakma | 995b965 | 2006-05-11 13:20:47 +0000 | [diff] [blame] | 419 | /* Apply distribute list to the interface. */ |
| 420 | ripng_distribute_update_interface (c->ifp); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 421 | |
Paul Jakma | 995b965 | 2006-05-11 13:20:47 +0000 | [diff] [blame] | 422 | /* Check interface routemap. */ |
| 423 | ripng_if_rmap_update_interface (c->ifp); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 424 | } |
| 425 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | return 0; |
| 429 | } |
| 430 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 431 | static void |
| 432 | ripng_apply_address_del (struct connected *ifc) { |
| 433 | struct prefix_ipv6 address; |
| 434 | struct prefix *p; |
| 435 | |
| 436 | if (!ripng) |
| 437 | return; |
| 438 | |
| 439 | if (! if_is_up(ifc->ifp)) |
| 440 | return; |
| 441 | |
| 442 | p = ifc->address; |
| 443 | |
| 444 | memset (&address, 0, sizeof (address)); |
| 445 | address.family = p->family; |
| 446 | address.prefix = p->u.prefix6; |
| 447 | address.prefixlen = p->prefixlen; |
| 448 | apply_mask_ipv6(&address); |
| 449 | |
| 450 | ripng_redistribute_delete(ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE, |
| 451 | &address, ifc->ifp->ifindex); |
| 452 | } |
| 453 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 454 | int |
| 455 | ripng_interface_address_delete (int command, struct zclient *zclient, |
| 456 | zebra_size_t length) |
| 457 | { |
| 458 | struct connected *ifc; |
| 459 | struct prefix *p; |
| 460 | char buf[INET6_ADDRSTRLEN]; |
| 461 | |
paul | 0a58935 | 2004-05-08 11:48:26 +0000 | [diff] [blame] | 462 | ifc = zebra_interface_address_read (ZEBRA_INTERFACE_ADDRESS_DELETE, |
| 463 | zclient->ibuf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 464 | |
| 465 | if (ifc) |
| 466 | { |
| 467 | p = ifc->address; |
| 468 | |
| 469 | if (p->family == AF_INET6) |
| 470 | { |
| 471 | if (IS_RIPNG_DEBUG_ZEBRA) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 472 | zlog_debug ("RIPng connected address %s/%d delete", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 473 | inet_ntop (AF_INET6, &p->u.prefix6, buf, |
| 474 | INET6_ADDRSTRLEN), |
| 475 | p->prefixlen); |
| 476 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 477 | /* Check wether this prefix needs to be removed. */ |
| 478 | ripng_apply_address_del(ifc); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 479 | } |
| 480 | connected_free (ifc); |
| 481 | } |
| 482 | |
| 483 | return 0; |
| 484 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 485 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 486 | /* RIPng enable interface vector. */ |
| 487 | vector ripng_enable_if; |
| 488 | |
| 489 | /* RIPng enable network table. */ |
| 490 | struct route_table *ripng_enable_network; |
| 491 | |
| 492 | /* Lookup RIPng enable network. */ |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 493 | /* Check wether the interface has at least a connected prefix that |
| 494 | * is within the ripng_enable_network table. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 495 | static int |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 496 | ripng_enable_network_lookup_if (struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 497 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 498 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 499 | struct connected *connected; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 500 | struct prefix_ipv6 address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 501 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 502 | for (ALL_LIST_ELEMENTS_RO (ifp->connected, node, connected)) |
| 503 | { |
| 504 | struct prefix *p; |
| 505 | struct route_node *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 506 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 507 | p = connected->address; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 508 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 509 | if (p->family == AF_INET6) |
| 510 | { |
| 511 | address.family = AF_INET6; |
| 512 | address.prefix = p->u.prefix6; |
| 513 | address.prefixlen = IPV6_MAX_BITLEN; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 514 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 515 | node = route_node_match (ripng_enable_network, |
| 516 | (struct prefix *)&address); |
| 517 | if (node) |
| 518 | { |
| 519 | route_unlock_node (node); |
| 520 | return 1; |
| 521 | } |
| 522 | } |
| 523 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 524 | return -1; |
| 525 | } |
| 526 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 527 | /* Check wether connected is within the ripng_enable_network table. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 528 | static int |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 529 | ripng_enable_network_lookup2 (struct connected *connected) |
| 530 | { |
| 531 | struct prefix_ipv6 address; |
| 532 | struct prefix *p; |
| 533 | |
| 534 | p = connected->address; |
| 535 | |
| 536 | if (p->family == AF_INET6) { |
| 537 | struct route_node *node; |
| 538 | |
| 539 | address.family = p->family; |
| 540 | address.prefix = p->u.prefix6; |
| 541 | address.prefixlen = IPV6_MAX_BITLEN; |
| 542 | |
| 543 | /* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within ripng_enable_network */ |
| 544 | node = route_node_match (ripng_enable_network, |
| 545 | (struct prefix *)&address); |
| 546 | |
| 547 | if (node) { |
| 548 | route_unlock_node (node); |
| 549 | return 1; |
| 550 | } |
| 551 | } |
| 552 | |
| 553 | return -1; |
| 554 | } |
| 555 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 556 | /* Add RIPng enable network. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 557 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 558 | ripng_enable_network_add (struct prefix *p) |
| 559 | { |
| 560 | struct route_node *node; |
| 561 | |
| 562 | node = route_node_get (ripng_enable_network, p); |
| 563 | |
| 564 | if (node->info) |
| 565 | { |
| 566 | route_unlock_node (node); |
| 567 | return -1; |
| 568 | } |
| 569 | else |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 570 | node->info = (char *) "enabled"; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 571 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 572 | /* XXX: One should find a better solution than a generic one */ |
| 573 | ripng_enable_apply_all(); |
| 574 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 575 | return 1; |
| 576 | } |
| 577 | |
| 578 | /* Delete RIPng enable network. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 579 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 580 | ripng_enable_network_delete (struct prefix *p) |
| 581 | { |
| 582 | struct route_node *node; |
| 583 | |
| 584 | node = route_node_lookup (ripng_enable_network, p); |
| 585 | if (node) |
| 586 | { |
| 587 | node->info = NULL; |
| 588 | |
| 589 | /* Unlock info lock. */ |
| 590 | route_unlock_node (node); |
| 591 | |
| 592 | /* Unlock lookup lock. */ |
| 593 | route_unlock_node (node); |
| 594 | |
| 595 | return 1; |
| 596 | } |
| 597 | return -1; |
| 598 | } |
| 599 | |
| 600 | /* Lookup function. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 601 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 602 | ripng_enable_if_lookup (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 603 | { |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 604 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 605 | char *str; |
| 606 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 607 | for (i = 0; i < vector_active (ripng_enable_if); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 608 | if ((str = vector_slot (ripng_enable_if, i)) != NULL) |
| 609 | if (strcmp (str, ifname) == 0) |
| 610 | return i; |
| 611 | return -1; |
| 612 | } |
| 613 | |
| 614 | /* Add interface to ripng_enable_if. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 615 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 616 | ripng_enable_if_add (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 617 | { |
| 618 | int ret; |
| 619 | |
| 620 | ret = ripng_enable_if_lookup (ifname); |
| 621 | if (ret >= 0) |
| 622 | return -1; |
| 623 | |
| 624 | vector_set (ripng_enable_if, strdup (ifname)); |
| 625 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 626 | ripng_enable_apply_all(); |
| 627 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 628 | return 1; |
| 629 | } |
| 630 | |
| 631 | /* Delete interface from ripng_enable_if. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 632 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 633 | ripng_enable_if_delete (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 634 | { |
| 635 | int index; |
| 636 | char *str; |
| 637 | |
| 638 | index = ripng_enable_if_lookup (ifname); |
| 639 | if (index < 0) |
| 640 | return -1; |
| 641 | |
| 642 | str = vector_slot (ripng_enable_if, index); |
| 643 | free (str); |
| 644 | vector_unset (ripng_enable_if, index); |
| 645 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 646 | ripng_enable_apply_all(); |
| 647 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 648 | return 1; |
| 649 | } |
| 650 | |
| 651 | /* Wake up interface. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 652 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 653 | ripng_interface_wakeup (struct thread *t) |
| 654 | { |
| 655 | struct interface *ifp; |
| 656 | struct ripng_interface *ri; |
| 657 | |
| 658 | /* Get interface. */ |
| 659 | ifp = THREAD_ARG (t); |
| 660 | |
| 661 | ri = ifp->info; |
| 662 | ri->t_wakeup = NULL; |
| 663 | |
| 664 | /* Join to multicast group. */ |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 665 | if (ripng_multicast_join (ifp) < 0) { |
| 666 | zlog_err ("multicast join failed, interface %s not running", ifp->name); |
| 667 | return 0; |
| 668 | } |
| 669 | |
| 670 | /* Set running flag. */ |
| 671 | ri->running = 1; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 672 | |
| 673 | /* Send RIP request to the interface. */ |
| 674 | ripng_request (ifp); |
| 675 | |
| 676 | return 0; |
| 677 | } |
| 678 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 679 | static void |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 680 | ripng_connect_set (struct interface *ifp, int set) |
| 681 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 682 | struct listnode *node, *nnode; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 683 | struct connected *connected; |
| 684 | struct prefix_ipv6 address; |
| 685 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 686 | for (ALL_LIST_ELEMENTS (ifp->connected, node, nnode, connected)) |
| 687 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 688 | struct prefix *p; |
| 689 | p = connected->address; |
| 690 | |
| 691 | if (p->family != AF_INET6) |
| 692 | continue; |
| 693 | |
| 694 | address.family = AF_INET6; |
| 695 | address.prefix = p->u.prefix6; |
| 696 | address.prefixlen = p->prefixlen; |
| 697 | apply_mask_ipv6 (&address); |
| 698 | |
| 699 | if (set) { |
| 700 | /* Check once more wether this prefix is within a "network IF_OR_PREF" one */ |
| 701 | if ((ripng_enable_if_lookup(connected->ifp->name) >= 0) || |
| 702 | (ripng_enable_network_lookup2(connected) >= 0)) |
| 703 | ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE, |
| 704 | &address, connected->ifp->ifindex, NULL); |
| 705 | } else { |
| 706 | ripng_redistribute_delete (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_INTERFACE, |
| 707 | &address, connected->ifp->ifindex); |
| 708 | if (ripng_redistribute_check (ZEBRA_ROUTE_CONNECT)) |
| 709 | ripng_redistribute_add (ZEBRA_ROUTE_CONNECT, RIPNG_ROUTE_REDISTRIBUTE, |
| 710 | &address, connected->ifp->ifindex, NULL); |
| 711 | } |
| 712 | } |
| 713 | } |
| 714 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 715 | /* Check RIPng is enabed on this interface. */ |
| 716 | void |
| 717 | ripng_enable_apply (struct interface *ifp) |
| 718 | { |
| 719 | int ret; |
| 720 | struct ripng_interface *ri = NULL; |
| 721 | |
| 722 | /* Check interface. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 723 | if (! if_is_up (ifp)) |
| 724 | return; |
| 725 | |
| 726 | ri = ifp->info; |
| 727 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 728 | /* Is this interface a candidate for RIPng ? */ |
| 729 | ret = ripng_enable_network_lookup_if (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 730 | |
| 731 | /* If the interface is matched. */ |
| 732 | if (ret > 0) |
| 733 | ri->enable_network = 1; |
| 734 | else |
| 735 | ri->enable_network = 0; |
| 736 | |
| 737 | /* Check interface name configuration. */ |
| 738 | ret = ripng_enable_if_lookup (ifp->name); |
| 739 | if (ret >= 0) |
| 740 | ri->enable_interface = 1; |
| 741 | else |
| 742 | ri->enable_interface = 0; |
| 743 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 744 | /* any candidate interface MUST have a link-local IPv6 address */ |
| 745 | if ((! ripng_if_ipv6_lladdress_check (ifp)) && |
| 746 | (ri->enable_network || ri->enable_interface)) { |
| 747 | ri->enable_network = 0; |
| 748 | ri->enable_interface = 0; |
| 749 | zlog_warn("Interface %s does not have any link-local address", |
| 750 | ifp->name); |
| 751 | } |
| 752 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 753 | /* Update running status of the interface. */ |
| 754 | if (ri->enable_network || ri->enable_interface) |
| 755 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 756 | { |
| 757 | if (IS_RIPNG_DEBUG_EVENT) |
ajs | 2e23ab2 | 2004-12-08 19:46:50 +0000 | [diff] [blame] | 758 | zlog_debug ("RIPng turn on %s", ifp->name); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 759 | |
| 760 | /* Add interface wake up thread. */ |
| 761 | if (! ri->t_wakeup) |
| 762 | ri->t_wakeup = thread_add_timer (master, ripng_interface_wakeup, |
| 763 | ifp, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 764 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 765 | ripng_connect_set (ifp, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 766 | } |
| 767 | } |
| 768 | else |
| 769 | { |
| 770 | if (ri->running) |
| 771 | { |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 772 | /* Might as well clean up the route table as well |
| 773 | * ripng_if_down sets to 0 ri->running, and displays "turn off %s" |
| 774 | **/ |
| 775 | ripng_if_down(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 776 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 777 | ripng_connect_set (ifp, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 778 | } |
| 779 | } |
| 780 | } |
| 781 | |
| 782 | /* Set distribute list to all interfaces. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 783 | static void |
| 784 | ripng_enable_apply_all (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 785 | { |
| 786 | struct interface *ifp; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 787 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 788 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 789 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 790 | ripng_enable_apply (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 791 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 792 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 793 | /* Clear all network and neighbor configuration */ |
| 794 | void |
| 795 | ripng_clean_network () |
| 796 | { |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 797 | unsigned int i; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 798 | char *str; |
| 799 | struct route_node *rn; |
| 800 | |
| 801 | /* ripng_enable_network */ |
| 802 | for (rn = route_top (ripng_enable_network); rn; rn = route_next (rn)) |
| 803 | if (rn->info) { |
| 804 | rn->info = NULL; |
| 805 | route_unlock_node(rn); |
| 806 | } |
| 807 | |
| 808 | /* ripng_enable_if */ |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 809 | for (i = 0; i < vector_active (ripng_enable_if); i++) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 810 | if ((str = vector_slot (ripng_enable_if, i)) != NULL) { |
| 811 | free (str); |
| 812 | vector_slot (ripng_enable_if, i) = NULL; |
| 813 | } |
| 814 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 815 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 816 | /* Vector to store passive-interface name. */ |
| 817 | vector Vripng_passive_interface; |
| 818 | |
| 819 | /* Utility function for looking up passive interface settings. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 820 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 821 | ripng_passive_interface_lookup (const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 822 | { |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 823 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 824 | char *str; |
| 825 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 826 | for (i = 0; i < vector_active (Vripng_passive_interface); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 827 | if ((str = vector_slot (Vripng_passive_interface, i)) != NULL) |
| 828 | if (strcmp (str, ifname) == 0) |
| 829 | return i; |
| 830 | return -1; |
| 831 | } |
| 832 | |
| 833 | void |
| 834 | ripng_passive_interface_apply (struct interface *ifp) |
| 835 | { |
| 836 | int ret; |
| 837 | struct ripng_interface *ri; |
| 838 | |
| 839 | ri = ifp->info; |
| 840 | |
| 841 | ret = ripng_passive_interface_lookup (ifp->name); |
| 842 | if (ret < 0) |
| 843 | ri->passive = 0; |
| 844 | else |
| 845 | ri->passive = 1; |
| 846 | } |
| 847 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 848 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 849 | ripng_passive_interface_apply_all (void) |
| 850 | { |
| 851 | struct interface *ifp; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 852 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 853 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 854 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 855 | ripng_passive_interface_apply (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | /* Passive interface. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 859 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 860 | ripng_passive_interface_set (struct vty *vty, const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 861 | { |
| 862 | if (ripng_passive_interface_lookup (ifname) >= 0) |
| 863 | return CMD_WARNING; |
| 864 | |
| 865 | vector_set (Vripng_passive_interface, strdup (ifname)); |
| 866 | |
| 867 | ripng_passive_interface_apply_all (); |
| 868 | |
| 869 | return CMD_SUCCESS; |
| 870 | } |
| 871 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 872 | static int |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 873 | ripng_passive_interface_unset (struct vty *vty, const char *ifname) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 874 | { |
| 875 | int i; |
| 876 | char *str; |
| 877 | |
| 878 | i = ripng_passive_interface_lookup (ifname); |
| 879 | if (i < 0) |
| 880 | return CMD_WARNING; |
| 881 | |
| 882 | str = vector_slot (Vripng_passive_interface, i); |
| 883 | free (str); |
| 884 | vector_unset (Vripng_passive_interface, i); |
| 885 | |
| 886 | ripng_passive_interface_apply_all (); |
| 887 | |
| 888 | return CMD_SUCCESS; |
| 889 | } |
| 890 | |
| 891 | /* Free all configured RIP passive-interface settings. */ |
| 892 | void |
| 893 | ripng_passive_interface_clean (void) |
| 894 | { |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 895 | unsigned int i; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 896 | char *str; |
| 897 | |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 898 | for (i = 0; i < vector_active (Vripng_passive_interface); i++) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 899 | if ((str = vector_slot (Vripng_passive_interface, i)) != NULL) |
| 900 | { |
| 901 | free (str); |
| 902 | vector_slot (Vripng_passive_interface, i) = NULL; |
| 903 | } |
| 904 | ripng_passive_interface_apply_all (); |
| 905 | } |
| 906 | |
| 907 | /* Write RIPng enable network and interface to the vty. */ |
| 908 | int |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 909 | ripng_network_write (struct vty *vty, int config_mode) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 910 | { |
hasso | 7a1d583 | 2004-10-08 06:32:23 +0000 | [diff] [blame] | 911 | unsigned int i; |
hasso | 98b718a | 2004-10-11 12:57:57 +0000 | [diff] [blame] | 912 | const char *ifname; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 913 | struct route_node *node; |
| 914 | char buf[BUFSIZ]; |
| 915 | |
| 916 | /* Write enable network. */ |
| 917 | for (node = route_top (ripng_enable_network); node; node = route_next (node)) |
| 918 | if (node->info) |
| 919 | { |
| 920 | struct prefix *p = &node->p; |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 921 | vty_out (vty, "%s%s/%d%s", |
| 922 | config_mode ? " network " : " ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 923 | inet_ntop (p->family, &p->u.prefix, buf, BUFSIZ), |
| 924 | p->prefixlen, |
| 925 | VTY_NEWLINE); |
| 926 | |
| 927 | } |
| 928 | |
| 929 | /* Write enable interface. */ |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 930 | for (i = 0; i < vector_active (ripng_enable_if); i++) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 931 | if ((ifname = vector_slot (ripng_enable_if, i)) != NULL) |
| 932 | vty_out (vty, "%s%s%s", |
| 933 | config_mode ? " network " : " ", |
| 934 | ifname, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 935 | VTY_NEWLINE); |
| 936 | |
| 937 | /* Write passive interface. */ |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 938 | if (config_mode) |
paul | 55468c8 | 2005-03-14 20:19:01 +0000 | [diff] [blame] | 939 | for (i = 0; i < vector_active (Vripng_passive_interface); i++) |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 940 | if ((ifname = vector_slot (Vripng_passive_interface, i)) != NULL) |
| 941 | vty_out (vty, " passive-interface %s%s", ifname, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 942 | |
| 943 | return 0; |
| 944 | } |
| 945 | |
| 946 | /* RIPng enable on specified interface or matched network. */ |
| 947 | DEFUN (ripng_network, |
| 948 | ripng_network_cmd, |
| 949 | "network IF_OR_ADDR", |
| 950 | "RIPng enable on specified interface or network.\n" |
| 951 | "Interface or address") |
| 952 | { |
| 953 | int ret; |
| 954 | struct prefix p; |
| 955 | |
| 956 | ret = str2prefix (argv[0], &p); |
| 957 | |
| 958 | /* Given string is IPv6 network or interface name. */ |
| 959 | if (ret) |
| 960 | ret = ripng_enable_network_add (&p); |
| 961 | else |
| 962 | ret = ripng_enable_if_add (argv[0]); |
| 963 | |
| 964 | if (ret < 0) |
| 965 | { |
| 966 | vty_out (vty, "There is same network configuration %s%s", argv[0], |
| 967 | VTY_NEWLINE); |
| 968 | return CMD_WARNING; |
| 969 | } |
| 970 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 971 | return CMD_SUCCESS; |
| 972 | } |
| 973 | |
| 974 | /* RIPng enable on specified interface or matched network. */ |
| 975 | DEFUN (no_ripng_network, |
| 976 | no_ripng_network_cmd, |
| 977 | "no network IF_OR_ADDR", |
| 978 | NO_STR |
| 979 | "RIPng enable on specified interface or network.\n" |
| 980 | "Interface or address") |
| 981 | { |
| 982 | int ret; |
| 983 | struct prefix p; |
| 984 | |
| 985 | ret = str2prefix (argv[0], &p); |
| 986 | |
| 987 | /* Given string is interface name. */ |
| 988 | if (ret) |
| 989 | ret = ripng_enable_network_delete (&p); |
| 990 | else |
| 991 | ret = ripng_enable_if_delete (argv[0]); |
| 992 | |
| 993 | if (ret < 0) |
| 994 | { |
| 995 | vty_out (vty, "can't find network %s%s", argv[0], |
| 996 | VTY_NEWLINE); |
| 997 | return CMD_WARNING; |
| 998 | } |
| 999 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1000 | return CMD_SUCCESS; |
| 1001 | } |
| 1002 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1003 | DEFUN (ipv6_ripng_split_horizon, |
| 1004 | ipv6_ripng_split_horizon_cmd, |
| 1005 | "ipv6 ripng split-horizon", |
| 1006 | IPV6_STR |
| 1007 | "Routing Information Protocol\n" |
| 1008 | "Perform split horizon\n") |
| 1009 | { |
| 1010 | struct interface *ifp; |
| 1011 | struct ripng_interface *ri; |
| 1012 | |
| 1013 | ifp = vty->index; |
| 1014 | ri = ifp->info; |
| 1015 | |
| 1016 | ri->split_horizon = RIPNG_SPLIT_HORIZON; |
| 1017 | return CMD_SUCCESS; |
| 1018 | } |
| 1019 | |
| 1020 | DEFUN (ipv6_ripng_split_horizon_poisoned_reverse, |
| 1021 | ipv6_ripng_split_horizon_poisoned_reverse_cmd, |
| 1022 | "ipv6 ripng split-horizon poisoned-reverse", |
| 1023 | IPV6_STR |
| 1024 | "Routing Information Protocol\n" |
| 1025 | "Perform split horizon\n" |
| 1026 | "With poisoned-reverse\n") |
| 1027 | { |
| 1028 | struct interface *ifp; |
| 1029 | struct ripng_interface *ri; |
| 1030 | |
| 1031 | ifp = vty->index; |
| 1032 | ri = ifp->info; |
| 1033 | |
| 1034 | ri->split_horizon = RIPNG_SPLIT_HORIZON_POISONED_REVERSE; |
| 1035 | return CMD_SUCCESS; |
| 1036 | } |
| 1037 | |
| 1038 | DEFUN (no_ipv6_ripng_split_horizon, |
| 1039 | no_ipv6_ripng_split_horizon_cmd, |
| 1040 | "no ipv6 ripng split-horizon", |
| 1041 | NO_STR |
| 1042 | IPV6_STR |
| 1043 | "Routing Information Protocol\n" |
| 1044 | "Perform split horizon\n") |
| 1045 | { |
| 1046 | struct interface *ifp; |
| 1047 | struct ripng_interface *ri; |
| 1048 | |
| 1049 | ifp = vty->index; |
| 1050 | ri = ifp->info; |
| 1051 | |
| 1052 | ri->split_horizon = RIPNG_NO_SPLIT_HORIZON; |
| 1053 | return CMD_SUCCESS; |
| 1054 | } |
| 1055 | |
| 1056 | ALIAS (no_ipv6_ripng_split_horizon, |
| 1057 | no_ipv6_ripng_split_horizon_poisoned_reverse_cmd, |
| 1058 | "no ipv6 ripng split-horizon poisoned-reverse", |
| 1059 | NO_STR |
| 1060 | IPV6_STR |
| 1061 | "Routing Information Protocol\n" |
| 1062 | "Perform split horizon\n" |
| 1063 | "With poisoned-reverse\n") |
| 1064 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1065 | DEFUN (ripng_passive_interface, |
| 1066 | ripng_passive_interface_cmd, |
| 1067 | "passive-interface IFNAME", |
| 1068 | "Suppress routing updates on an interface\n" |
| 1069 | "Interface name\n") |
| 1070 | { |
| 1071 | return ripng_passive_interface_set (vty, argv[0]); |
| 1072 | } |
| 1073 | |
| 1074 | DEFUN (no_ripng_passive_interface, |
| 1075 | no_ripng_passive_interface_cmd, |
| 1076 | "no passive-interface IFNAME", |
| 1077 | NO_STR |
| 1078 | "Suppress routing updates on an interface\n" |
| 1079 | "Interface name\n") |
| 1080 | { |
| 1081 | return ripng_passive_interface_unset (vty, argv[0]); |
| 1082 | } |
David Lamparter | 6b0655a | 2014-06-04 06:53:35 +0200 | [diff] [blame] | 1083 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1084 | static struct ripng_interface * |
| 1085 | ri_new (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1086 | { |
| 1087 | struct ripng_interface *ri; |
| 1088 | ri = XCALLOC (MTYPE_IF, sizeof (struct ripng_interface)); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1089 | |
| 1090 | /* Set default split-horizon behavior. If the interface is Frame |
| 1091 | Relay or SMDS is enabled, the default value for split-horizon is |
| 1092 | off. But currently Zebra does detect Frame Relay or SMDS |
| 1093 | interface. So all interface is set to split horizon. */ |
| 1094 | ri->split_horizon_default = RIPNG_SPLIT_HORIZON; |
| 1095 | ri->split_horizon = ri->split_horizon_default; |
| 1096 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1097 | return ri; |
| 1098 | } |
| 1099 | |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1100 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1101 | ripng_if_new_hook (struct interface *ifp) |
| 1102 | { |
| 1103 | ifp->info = ri_new (); |
| 1104 | return 0; |
| 1105 | } |
| 1106 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1107 | /* Called when interface structure deleted. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1108 | static int |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1109 | ripng_if_delete_hook (struct interface *ifp) |
| 1110 | { |
| 1111 | XFREE (MTYPE_IF, ifp->info); |
| 1112 | ifp->info = NULL; |
| 1113 | return 0; |
| 1114 | } |
| 1115 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1116 | /* Configuration write function for ripngd. */ |
Paul Jakma | 6ac29a5 | 2008-08-15 13:45:30 +0100 | [diff] [blame] | 1117 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1118 | interface_config_write (struct vty *vty) |
| 1119 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 1120 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1121 | struct interface *ifp; |
| 1122 | struct ripng_interface *ri; |
| 1123 | int write = 0; |
| 1124 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1125 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1126 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1127 | ri = ifp->info; |
| 1128 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1129 | /* Do not display the interface if there is no |
| 1130 | * configuration about it. |
| 1131 | **/ |
| 1132 | if ((!ifp->desc) && |
| 1133 | (ri->split_horizon == ri->split_horizon_default)) |
| 1134 | continue; |
| 1135 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1136 | vty_out (vty, "interface %s%s", ifp->name, |
| 1137 | VTY_NEWLINE); |
| 1138 | if (ifp->desc) |
| 1139 | vty_out (vty, " description %s%s", ifp->desc, |
| 1140 | VTY_NEWLINE); |
| 1141 | |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1142 | /* Split horizon. */ |
| 1143 | if (ri->split_horizon != ri->split_horizon_default) |
| 1144 | { |
| 1145 | switch (ri->split_horizon) { |
| 1146 | case RIPNG_SPLIT_HORIZON: |
| 1147 | vty_out (vty, " ipv6 ripng split-horizon%s", VTY_NEWLINE); |
| 1148 | break; |
| 1149 | case RIPNG_SPLIT_HORIZON_POISONED_REVERSE: |
| 1150 | vty_out (vty, " ipv6 ripng split-horizon poisoned-reverse%s", |
| 1151 | VTY_NEWLINE); |
| 1152 | break; |
| 1153 | case RIPNG_NO_SPLIT_HORIZON: |
| 1154 | default: |
| 1155 | vty_out (vty, " no ipv6 ripng split-horizon%s", VTY_NEWLINE); |
| 1156 | break; |
| 1157 | } |
| 1158 | } |
| 1159 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1160 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 1161 | |
| 1162 | write++; |
| 1163 | } |
| 1164 | return write; |
| 1165 | } |
| 1166 | |
| 1167 | /* ripngd's interface node. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 1168 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1169 | { |
| 1170 | INTERFACE_NODE, |
| 1171 | "%s(config-if)# ", |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1172 | 1 /* VTYSH */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1173 | }; |
| 1174 | |
| 1175 | /* Initialization of interface. */ |
| 1176 | void |
| 1177 | ripng_if_init () |
| 1178 | { |
| 1179 | /* Interface initialize. */ |
| 1180 | iflist = list_new (); |
| 1181 | if_add_hook (IF_NEW_HOOK, ripng_if_new_hook); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1182 | if_add_hook (IF_DELETE_HOOK, ripng_if_delete_hook); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1183 | |
| 1184 | /* RIPng enable network init. */ |
| 1185 | ripng_enable_network = route_table_init (); |
| 1186 | |
| 1187 | /* RIPng enable interface init. */ |
| 1188 | ripng_enable_if = vector_init (1); |
| 1189 | |
| 1190 | /* RIPng passive interface. */ |
| 1191 | Vripng_passive_interface = vector_init (1); |
| 1192 | |
| 1193 | /* Install interface node. */ |
| 1194 | install_node (&interface_node, interface_config_write); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1195 | |
| 1196 | /* Install commands. */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1197 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 1198 | install_element (CONFIG_NODE, &no_interface_cmd); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1199 | install_default (INTERFACE_NODE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1200 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 1201 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 1202 | |
| 1203 | install_element (RIPNG_NODE, &ripng_network_cmd); |
| 1204 | install_element (RIPNG_NODE, &no_ripng_network_cmd); |
| 1205 | install_element (RIPNG_NODE, &ripng_passive_interface_cmd); |
| 1206 | install_element (RIPNG_NODE, &no_ripng_passive_interface_cmd); |
hasso | a94434b | 2003-05-25 17:10:12 +0000 | [diff] [blame] | 1207 | |
| 1208 | install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_cmd); |
| 1209 | install_element (INTERFACE_NODE, &ipv6_ripng_split_horizon_poisoned_reverse_cmd); |
| 1210 | install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_cmd); |
| 1211 | install_element (INTERFACE_NODE, &no_ipv6_ripng_split_horizon_poisoned_reverse_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1212 | } |