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