diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | alpine/APKBUILD.in | 36 | ||||
-rw-r--r-- | bgpd/.gitignore | 1 | ||||
-rw-r--r-- | bgpd/bgp_attr.c | 50 | ||||
-rw-r--r-- | bgpd/bgp_attr.h | 17 | ||||
-rw-r--r-- | bgpd/bgp_debug.c | 5 | ||||
-rw-r--r-- | bgpd/bgp_debug.h | 1 | ||||
-rw-r--r-- | bgpd/bgp_evpn.c | 206 | ||||
-rw-r--r-- | bgpd/bgp_evpn.h | 19 | ||||
-rw-r--r-- | bgpd/bgp_evpn_private.h | 26 | ||||
-rw-r--r-- | bgpd/bgp_evpn_vty.c | 142 | ||||
-rw-r--r-- | bgpd/bgp_route.c | 47 | ||||
-rw-r--r-- | bgpd/bgp_routemap.c | 44 | ||||
-rw-r--r-- | bgpd/bgpd.c | 6 | ||||
-rw-r--r-- | bgpd/bgpd.h | 18 | ||||
-rwxr-xr-x | configure.ac | 29 | ||||
-rwxr-xr-x | debianpkg/backports/ubuntu12.04/debian/rules | 16 | ||||
-rw-r--r-- | debianpkg/backports/ubuntu14.04/debian/frr.install | 12 | ||||
-rwxr-xr-x | debianpkg/backports/ubuntu14.04/debian/rules | 12 | ||||
-rw-r--r-- | debianpkg/control | 2 | ||||
-rw-r--r-- | debianpkg/frr-doc.docs | 6 | ||||
-rw-r--r-- | debianpkg/frr-doc.info | 2 | ||||
-rw-r--r-- | debianpkg/frr-doc.install | 3 | ||||
-rw-r--r-- | debianpkg/frr.install | 15 | ||||
-rw-r--r-- | debianpkg/frr.manpages | 24 | ||||
-rwxr-xr-x | debianpkg/rules | 15 | ||||
-rw-r--r-- | doc/.gitignore | 9 | ||||
-rw-r--r-- | doc/Building_FRR_for_LEDE-OpenWRT.md | 96 | ||||
-rw-r--r-- | doc/Makefile.am | 358 | ||||
-rw-r--r-- | doc/appendix.texi | 257 | ||||
-rw-r--r-- | doc/babeld.texi | 212 | ||||
-rw-r--r-- | doc/basic.texi | 642 | ||||
-rw-r--r-- | doc/bgpd.8.in | 132 | ||||
-rw-r--r-- | doc/bgpd.texi | 2142 | ||||
-rw-r--r-- | doc/cli.md | 557 | ||||
-rw-r--r-- | doc/defines.texi.in | 21 | ||||
-rw-r--r-- | doc/developer/.gitignore (renamed from doc/code/.gitignore) | 0 | ||||
-rw-r--r-- | doc/developer/BGP-TypeCode (renamed from doc/BGP-TypeCode) | 0 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_CentOS6.rst (renamed from doc/Building_FRR_on_CentOS6.md) | 161 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_CentOS7.rst (renamed from doc/Building_FRR_on_CentOS7.md) | 87 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Debian8.rst (renamed from doc/Building_FRR_on_Debian8.md) | 81 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Debian9.rst (renamed from doc/Building_FRR_on_Debian9.md) | 67 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Fedora24.rst (renamed from doc/Building_FRR_on_Fedora24.md) | 85 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_FreeBSD10.rst (renamed from doc/Building_FRR_on_FreeBSD10.md) | 55 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_FreeBSD11.rst (renamed from doc/Building_FRR_on_FreeBSD11.md) | 53 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_FreeBSD9.rst (renamed from doc/Building_FRR_on_FreeBSD9.md) | 58 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_LEDE-OpenWRT.rst | 108 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_NetBSD6.rst (renamed from doc/Building_FRR_on_NetBSD6.md) | 64 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_NetBSD7.rst (renamed from doc/Building_FRR_on_NetBSD7.md) | 59 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_OmniOS.rst (renamed from doc/Building_FRR_on_OmniOS.md) | 61 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_OpenBSD6.rst (renamed from doc/Building_FRR_on_OpenBSD6.md) | 82 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Ubuntu1204.rst (renamed from doc/Building_FRR_on_Ubuntu1204.md) | 108 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Ubuntu1404.rst (renamed from doc/Building_FRR_on_Ubuntu1404.md) | 96 | ||||
-rw-r--r-- | doc/developer/Building_FRR_on_Ubuntu1604.rst (renamed from doc/Building_FRR_on_Ubuntu1604.md) | 97 | ||||
-rw-r--r-- | doc/developer/Makefile | 1 | ||||
-rw-r--r-- | doc/developer/OSPF-API.md (renamed from doc/OSPF-API.md) | 0 | ||||
-rw-r--r-- | doc/developer/bgpd.rst | 8 | ||||
-rw-r--r-- | doc/developer/building.rst | 22 | ||||
-rw-r--r-- | doc/developer/cli.rst | 723 | ||||
-rw-r--r-- | doc/developer/conf.py (renamed from doc/code/conf.py) | 78 | ||||
-rw-r--r-- | doc/developer/dev-modules.md (renamed from doc/dev-modules.md) | 0 | ||||
-rw-r--r-- | doc/developer/draft-zebra-00.ms (renamed from doc/draft-zebra-00.ms) | 0 | ||||
-rw-r--r-- | doc/developer/hooks.rst (renamed from doc/code/hooks.rst) | 0 | ||||
-rw-r--r-- | doc/developer/index.rst (renamed from doc/code/index.rst) | 15 | ||||
-rw-r--r-- | doc/developer/ldpd-basic-test-setup.md (renamed from doc/ldpd-basic-test-setup.md) | 0 | ||||
-rw-r--r-- | doc/developer/library.rst (renamed from doc/code/library.rst) | 2 | ||||
-rw-r--r-- | doc/developer/memtypes.rst (renamed from doc/code/memtypes.rst) | 2 | ||||
-rw-r--r-- | doc/developer/modules.rst | 123 | ||||
-rw-r--r-- | doc/developer/next-hop-tracking.rst | 352 | ||||
-rw-r--r-- | doc/developer/ospf-api.rst | 388 | ||||
-rw-r--r-- | doc/developer/ospf-sr.rst (renamed from doc/OSPF-SR.rst) | 45 | ||||
-rw-r--r-- | doc/developer/workflow.rst | 657 | ||||
-rw-r--r-- | doc/eigrpd.8.in | 122 | ||||
-rw-r--r-- | doc/eigrpd.texi | 216 | ||||
-rw-r--r-- | doc/figures/cligraph.svg | 211 | ||||
-rw-r--r-- | doc/figures/fig-normal-processing.dia (renamed from doc/fig-normal-processing.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-normal-processing.png (renamed from doc/fig-normal-processing.png) | bin | 29958 -> 29958 bytes | |||
-rw-r--r-- | doc/figures/fig-normal-processing.txt (renamed from doc/fig-normal-processing.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-rs-processing.dia (renamed from doc/fig-rs-processing.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-rs-processing.png (renamed from doc/fig-rs-processing.png) | bin | 80048 -> 80048 bytes | |||
-rw-r--r-- | doc/figures/fig-rs-processing.txt (renamed from doc/fig-rs-processing.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-commercial-route-reflector.dia (renamed from doc/fig-vnc-commercial-route-reflector.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-commercial-route-reflector.png (renamed from doc/fig-vnc-commercial-route-reflector.png) | bin | 50984 -> 50984 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-commercial-route-reflector.txt (renamed from doc/fig-vnc-commercial-route-reflector.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-frr-route-reflector.dia (renamed from doc/fig-vnc-frr-route-reflector.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-frr-route-reflector.png (renamed from doc/fig-vnc-frr-route-reflector.png) | bin | 49978 -> 49978 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-frr-route-reflector.txt (renamed from doc/fig-vnc-frr-route-reflector.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-gw-rr.dia (renamed from doc/fig-vnc-gw-rr.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-gw-rr.png (renamed from doc/fig-vnc-gw-rr.png) | bin | 80004 -> 80004 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-gw-rr.txt (renamed from doc/fig-vnc-gw-rr.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-gw.dia (renamed from doc/fig-vnc-gw.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-gw.png (renamed from doc/fig-vnc-gw.png) | bin | 67376 -> 67376 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-gw.txt (renamed from doc/fig-vnc-gw.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-mesh.dia (renamed from doc/fig-vnc-mesh.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-mesh.png (renamed from doc/fig-vnc-mesh.png) | bin | 61028 -> 61028 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-mesh.txt (renamed from doc/fig-vnc-mesh.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-redundant-route-reflectors.dia (renamed from doc/fig-vnc-redundant-route-reflectors.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig-vnc-redundant-route-reflectors.png (renamed from doc/fig-vnc-redundant-route-reflectors.png) | bin | 75353 -> 75353 bytes | |||
-rw-r--r-- | doc/figures/fig-vnc-redundant-route-reflectors.txt (renamed from doc/fig-vnc-redundant-route-reflectors.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig_topologies_full.dia (renamed from doc/fig_topologies_full.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig_topologies_full.png (renamed from doc/fig_topologies_full.png) | bin | 8489 -> 8489 bytes | |||
-rw-r--r-- | doc/figures/fig_topologies_full.txt (renamed from doc/fig_topologies_full.txt) | 0 | ||||
-rw-r--r-- | doc/figures/fig_topologies_rs.dia (renamed from doc/fig_topologies_rs.dia) | 0 | ||||
-rw-r--r-- | doc/figures/fig_topologies_rs.png (renamed from doc/fig_topologies_rs.png) | bin | 9994 -> 9994 bytes | |||
-rw-r--r-- | doc/figures/fig_topologies_rs.txt (renamed from doc/fig_topologies_rs.txt) | 0 | ||||
-rw-r--r-- | doc/figures/frr-icon.svg | 39 | ||||
-rw-r--r-- | doc/figures/frr-logo-icon.png | bin | 0 -> 1609 bytes | |||
-rw-r--r-- | doc/figures/frr-logo-medium.png | bin | 0 -> 13129 bytes | |||
-rw-r--r-- | doc/figures/frr-logo-small.png | bin | 0 -> 6175 bytes | |||
-rw-r--r-- | doc/figures/frr-logo.png | bin | 0 -> 26502 bytes | |||
-rw-r--r-- | doc/figures/git_branches.png | bin | 0 -> 53216 bytes | |||
-rw-r--r-- | doc/figures/git_branches.svg (renamed from doc/git_branches.svg) | 0 | ||||
-rw-r--r-- | doc/figures/ospf_api_architecture.png (renamed from doc/ospf_api_architecture.png) | bin | 20580 -> 20580 bytes | |||
-rw-r--r-- | doc/figures/ospf_api_msghdr.png (renamed from doc/ospf_api_msghdr.png) | bin | 6604 -> 6604 bytes | |||
-rw-r--r-- | doc/figures/ospf_api_msgs1.png (renamed from doc/ospf_api_msgs1.png) | bin | 36814 -> 36814 bytes | |||
-rw-r--r-- | doc/figures/ospf_api_msgs2.png (renamed from doc/ospf_api_msgs2.png) | bin | 35544 -> 35544 bytes | |||
-rw-r--r-- | doc/filter.texi | 182 | ||||
-rw-r--r-- | doc/frr-args.8.in | 248 | ||||
-rw-r--r-- | doc/frr-sphinx.mk (renamed from doc/code/Makefile) | 20 | ||||
-rw-r--r-- | doc/frr.1.in | 65 | ||||
-rw-r--r-- | doc/frr.texi | 140 | ||||
-rw-r--r-- | doc/install.texi | 291 | ||||
-rw-r--r-- | doc/ipv6.texi | 186 | ||||
-rw-r--r-- | doc/isisd.8.in | 119 | ||||
-rw-r--r-- | doc/isisd.texi | 433 | ||||
-rw-r--r-- | doc/kernel.texi | 47 | ||||
-rw-r--r-- | doc/ldpd.8.in | 117 | ||||
-rw-r--r-- | doc/main.texi | 525 | ||||
-rw-r--r-- | doc/manpages/.gitignore | 3 | ||||
-rw-r--r-- | doc/manpages/Makefile | 48 | ||||
-rw-r--r-- | doc/manpages/bgpd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/common-options.rst | 165 | ||||
-rw-r--r-- | doc/manpages/conf.py | 348 | ||||
-rw-r--r-- | doc/manpages/defines.rst | 3 | ||||
-rw-r--r-- | doc/manpages/eigrpd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/epilogue.rst | 16 | ||||
-rw-r--r-- | doc/manpages/frr.rst | 44 | ||||
-rw-r--r-- | doc/manpages/index.rst | 27 | ||||
-rw-r--r-- | doc/manpages/isisd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/ldpd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/mtracebis.rst | 39 | ||||
-rw-r--r-- | doc/manpages/nhrpd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/ospf6d.rst | 39 | ||||
-rw-r--r-- | doc/manpages/ospfclient.rst | 43 | ||||
-rw-r--r-- | doc/manpages/ospfd.rst | 39 | ||||
-rw-r--r-- | doc/manpages/pimd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/ripd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/ripngd.rst | 38 | ||||
-rw-r--r-- | doc/manpages/vtysh.rst | 72 | ||||
-rw-r--r-- | doc/manpages/watchfrr.rst | 119 | ||||
-rw-r--r-- | doc/manpages/zebra.rst | 59 | ||||
-rw-r--r-- | doc/mtracebis.8.in | 25 | ||||
-rw-r--r-- | doc/next-hop-tracking.txt | 326 | ||||
-rw-r--r-- | doc/nhrpd.8.in | 113 | ||||
-rw-r--r-- | doc/ospf6d.8.in | 119 | ||||
-rw-r--r-- | doc/ospf6d.texi | 172 | ||||
-rw-r--r-- | doc/ospf_fundamentals.texi | 582 | ||||
-rw-r--r-- | doc/ospfclient.8.in | 42 | ||||
-rw-r--r-- | doc/ospfd.8.in | 121 | ||||
-rw-r--r-- | doc/ospfd.texi | 972 | ||||
-rw-r--r-- | doc/overview.texi | 337 | ||||
-rw-r--r-- | doc/pimd.8.in | 135 | ||||
-rw-r--r-- | doc/pimd.texi | 366 | ||||
-rw-r--r-- | doc/protocol.texi | 115 | ||||
-rw-r--r-- | doc/ripd.8.in | 121 | ||||
-rw-r--r-- | doc/ripd.texi | 623 | ||||
-rw-r--r-- | doc/ripngd.8.in | 122 | ||||
-rw-r--r-- | doc/ripngd.texi | 84 | ||||
-rw-r--r-- | doc/routemap.texi | 285 | ||||
-rw-r--r-- | doc/routeserver.texi | 561 | ||||
-rw-r--r-- | doc/rpki.texi | 256 | ||||
-rw-r--r-- | doc/snmp.texi | 189 | ||||
-rw-r--r-- | doc/snmptrap.texi | 205 | ||||
-rw-r--r-- | doc/user/.gitignore | 3 | ||||
-rw-r--r-- | doc/user/Makefile | 55 | ||||
-rw-r--r-- | doc/user/Useful_Sysctl_Settings.md (renamed from doc/Useful_Sysctl_Settings.md) | 0 | ||||
-rw-r--r-- | doc/user/appendix.rst | 221 | ||||
-rw-r--r-- | doc/user/babeld.rst | 291 | ||||
-rw-r--r-- | doc/user/basic.rst | 642 | ||||
-rw-r--r-- | doc/user/bgp.rst | 2303 | ||||
-rw-r--r-- | doc/user/conf.py | 341 | ||||
-rw-r--r-- | doc/user/eigrpd.rst | 243 | ||||
-rw-r--r-- | doc/user/filter.rst | 178 | ||||
-rw-r--r-- | doc/user/glossary.rst | 41 | ||||
-rw-r--r-- | doc/user/index.rst | 31 | ||||
-rw-r--r-- | doc/user/installation.rst | 348 | ||||
-rw-r--r-- | doc/user/ipv6.rst | 193 | ||||
-rw-r--r-- | doc/user/isisd.rst | 636 | ||||
-rw-r--r-- | doc/user/kernel.rst | 42 | ||||
-rw-r--r-- | doc/user/nhrpd.rst (renamed from doc/nhrpd.texi) | 151 | ||||
-rw-r--r-- | doc/user/ospf6d.rst | 199 | ||||
-rw-r--r-- | doc/user/ospf_fundamentals.rst | 546 | ||||
-rw-r--r-- | doc/user/ospfd.rst | 1308 | ||||
-rw-r--r-- | doc/user/overview.rst | 302 | ||||
-rw-r--r-- | doc/user/pim.rst | 409 | ||||
-rw-r--r-- | doc/user/protocol.rst | 122 | ||||
-rw-r--r-- | doc/user/ripd.rst | 695 | ||||
-rw-r--r-- | doc/user/ripngd.rst | 89 | ||||
-rw-r--r-- | doc/user/routemap.rst | 287 | ||||
-rw-r--r-- | doc/user/routeserver.rst | 550 | ||||
-rw-r--r-- | doc/user/rpki.rst | 261 | ||||
-rw-r--r-- | doc/user/snmp.rst | 200 | ||||
-rw-r--r-- | doc/user/snmptrap.rst | 201 | ||||
-rw-r--r-- | doc/user/vnc.rst | 1425 | ||||
-rw-r--r-- | doc/user/vtysh.rst | 163 | ||||
-rw-r--r-- | doc/user/zebra.rst | 628 | ||||
-rw-r--r-- | doc/vnc.texi | 1593 | ||||
-rw-r--r-- | doc/vtysh.1.in | 103 | ||||
-rw-r--r-- | doc/vtysh.texi | 161 | ||||
-rw-r--r-- | doc/watchfrr.8.in | 155 | ||||
-rw-r--r-- | doc/zebra.8.in | 158 | ||||
-rw-r--r-- | isisd/isis_adjacency.c | 47 | ||||
-rw-r--r-- | isisd/isis_adjacency.h | 9 | ||||
-rw-r--r-- | isisd/isis_circuit.c | 56 | ||||
-rw-r--r-- | isisd/isis_circuit.h | 10 | ||||
-rw-r--r-- | isisd/isis_csm.c | 9 | ||||
-rw-r--r-- | isisd/isis_lsp.c | 10 | ||||
-rw-r--r-- | isisd/isis_pdu.c | 133 | ||||
-rw-r--r-- | isisd/isis_route.c | 40 | ||||
-rw-r--r-- | isisd/isis_spf.c | 42 | ||||
-rw-r--r-- | isisd/isis_te.c | 60 | ||||
-rw-r--r-- | isisd/isis_tlvs.c | 337 | ||||
-rw-r--r-- | isisd/isis_tlvs.h | 24 | ||||
-rw-r--r-- | isisd/isis_vty.c | 17 | ||||
-rw-r--r-- | isisd/isisd.h | 5 | ||||
-rw-r--r-- | ldpd/.gitignore | 1 | ||||
-rw-r--r-- | lib/.gitignore | 1 | ||||
-rw-r--r-- | lib/debug.h | 92 | ||||
-rw-r--r-- | lib/frr_pthread.c | 44 | ||||
-rw-r--r-- | lib/frr_pthread.h | 36 | ||||
-rw-r--r-- | lib/ipaddr.h | 17 | ||||
-rw-r--r-- | lib/log.c | 43 | ||||
-rw-r--r-- | lib/nexthop.c | 51 | ||||
-rw-r--r-- | lib/nexthop.h | 2 | ||||
-rw-r--r-- | lib/nexthop_group.c | 313 | ||||
-rw-r--r-- | lib/nexthop_group.h | 42 | ||||
-rw-r--r-- | lib/strlcat.c | 14 | ||||
-rw-r--r-- | lib/strlcpy.c | 29 | ||||
-rw-r--r-- | lib/thread.c | 12 | ||||
-rw-r--r-- | lib/thread.h | 1 | ||||
-rw-r--r-- | lib/vrf.c | 20 | ||||
-rw-r--r-- | lib/vrf.h | 3 | ||||
-rw-r--r-- | lib/zclient.c | 12 | ||||
-rw-r--r-- | lib/zclient.h | 65 | ||||
-rw-r--r-- | lib/zebra.h | 6 | ||||
-rw-r--r-- | ospf6d/ospf6_message.c | 3 | ||||
-rw-r--r-- | ospfd/.gitignore | 1 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 18 | ||||
-rw-r--r-- | pimd/pim_iface.c | 20 | ||||
-rw-r--r-- | pimd/pim_igmp.c | 21 | ||||
-rw-r--r-- | pimd/pim_igmp.h | 5 | ||||
-rw-r--r-- | pimd/pim_igmpv2.c | 6 | ||||
-rw-r--r-- | pimd/pim_igmpv3.c | 3 | ||||
-rw-r--r-- | pimd/pim_instance.c | 2 | ||||
-rw-r--r-- | redhat/README.rpm_build.md | 2 | ||||
-rw-r--r-- | redhat/frr.spec.in | 31 | ||||
-rw-r--r-- | sharpd/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/isisd/test_fuzz_isis_tlv_tests.h.gz | bin | 232370 -> 262877 bytes | |||
-rw-r--r-- | tests/lib/test_zlog.c | 61 | ||||
-rw-r--r-- | tests/lib/test_zlog.py | 4 | ||||
-rwxr-xr-x | tools/frr-reload.py | 30 | ||||
-rwxr-xr-x | tools/indent.py | 2 | ||||
-rw-r--r-- | vtysh/vtysh.c | 28 | ||||
-rw-r--r-- | zebra/.gitignore | 1 | ||||
-rw-r--r-- | zebra/if_netlink.c | 3 | ||||
-rw-r--r-- | zebra/label_manager.c | 22 | ||||
-rw-r--r-- | zebra/redistribute.c | 24 | ||||
-rw-r--r-- | zebra/redistribute.h | 15 | ||||
-rw-r--r-- | zebra/rib.h | 2 | ||||
-rw-r--r-- | zebra/rtadv.c | 14 | ||||
-rw-r--r-- | zebra/rtadv.h | 5 | ||||
-rw-r--r-- | zebra/zebra_mpls.c | 5 | ||||
-rw-r--r-- | zebra/zebra_mroute.c | 14 | ||||
-rw-r--r-- | zebra/zebra_mroute.h | 5 | ||||
-rw-r--r-- | zebra/zebra_netns_notify.c | 4 | ||||
-rw-r--r-- | zebra/zebra_ptm.c | 38 | ||||
-rw-r--r-- | zebra/zebra_ptm.h | 12 | ||||
-rw-r--r-- | zebra/zebra_ptm_redistribute.c | 10 | ||||
-rw-r--r-- | zebra/zebra_rib.c | 25 | ||||
-rw-r--r-- | zebra/zebra_rnh.c | 5 | ||||
-rw-r--r-- | zebra/zebra_vrf.c | 10 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 352 | ||||
-rw-r--r-- | zebra/zebra_vxlan.c | 132 | ||||
-rw-r--r-- | zebra/zebra_vxlan.h | 24 | ||||
-rw-r--r-- | zebra/zserv.c | 1829 | ||||
-rw-r--r-- | zebra/zserv.h | 14 |
287 files changed, 21517 insertions, 17290 deletions
diff --git a/.gitignore b/.gitignore index f7c731b4b..c5fd0ced9 100644 --- a/.gitignore +++ b/.gitignore @@ -82,3 +82,6 @@ GPATH *.lo compile_commands.json .dirstamp + +# clippy generated source +*_clippy.c diff --git a/alpine/APKBUILD.in b/alpine/APKBUILD.in new file mode 100644 index 000000000..33c285924 --- /dev/null +++ b/alpine/APKBUILD.in @@ -0,0 +1,36 @@ +# Maintainer: Arthur Jones <arthur.jones@riverbed.com> +pkgname=frr +pkgver=@VERSION@ +pkgrel=0 +pkgdesc="Free Range Routing is a fork of quagga" +url="https://frrouting.org/" +arch="all" +license="GPL-2.0" +depends="iproute2 json-c c-ares ipsec-tools iproute2" +makedepends="ncurses-dev net-snmp-dev gawk texinfo perl + acct autoconf automake bash + binutils binutils-libs bison bsd-compat-headers build-base + c-ares c-ares-dev ca-certificates cryptsetup-libs curl + device-mapper-libs expat fakeroot flex fortify-headers gdbm + git gmp isl json-c-dev kmod lddtree libacl libatomic libattr + libblkid libburn libbz2 libc-dev libcap libcurl libedit libffi libgcc + libgomp libisoburn libisofs libltdl libressl libssh2 + libstdc++ libtool libuuid linux-headers lzip lzo m4 make mkinitfs mpc1 + mpfr3 mtools musl-dev ncurses-libs ncurses-terminfo ncurses-terminfo-base + patch pax-utils pcre perl pkgconf python2 python2-dev readline + readline-dev sqlite-libs squashfs-tools sudo tar texinfo xorriso xz-libs" +subpackages="$pkgname-dev $pkgname-doc $pkgname-dbg" +source="$pkgname-$pkgver.tar.gz" + +builddir="$srcdir"/$pkgname-$pkgver + +build() { + cd "$builddir" + ./configure --prefix=/usr || return 1 + make || return 1 +} + +package() { + cd "$builddir" + make DESTDIR="$pkgdir" install || return 1 +} diff --git a/bgpd/.gitignore b/bgpd/.gitignore index a97bdb83d..105be2299 100644 --- a/bgpd/.gitignore +++ b/bgpd/.gitignore @@ -16,4 +16,3 @@ TAGS .arch-ids *~ *.loT -*clippy.c diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index c23950799..c3a110599 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2107,6 +2107,51 @@ bgp_attr_prefix_sid(struct bgp_attr_parser_args *args, return BGP_ATTR_PARSE_PROCEED; } +/* PMSI tunnel attribute (RFC 6514) + * Basic validation checks done here. + */ +static bgp_attr_parse_ret_t +bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) +{ + struct peer *const peer = args->peer; + struct attr *const attr = args->attr; + const bgp_size_t length = args->length; + u_int8_t tnl_type; + + /* Verify that the receiver is expecting "ingress replication" as we + * can only support that. + */ + if (length < 2) { + zlog_err("Bad PMSI tunnel attribute length %d", length); + return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, + args->total); + } + stream_getc(peer->curr); /* Flags */ + tnl_type = stream_getc(peer->curr); + if (tnl_type > PMSI_TNLTYPE_MAX) { + zlog_err("Invalid PMSI tunnel attribute type %d", tnl_type); + return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, + args->total); + } + if (tnl_type == PMSI_TNLTYPE_INGR_REPL) { + if (length != 9) { + zlog_err("Bad PMSI tunnel attribute length %d for IR", + length); + return bgp_attr_malformed( + args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, + args->total); + } + } + + attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); + attr->pmsi_tnl_type = tnl_type; + + /* Forward read pointer of input stream. */ + stream_forward_getp(peer->curr, length - 2); + + return BGP_ATTR_PARSE_PROCEED; +} + /* BGP unknown attribute treatment. */ static bgp_attr_parse_ret_t bgp_attr_unknown(struct bgp_attr_parser_args *args) { @@ -2440,6 +2485,9 @@ bgp_attr_parse_ret_t bgp_attr_parse(struct peer *peer, struct attr *attr, case BGP_ATTR_PREFIX_SID: ret = bgp_attr_prefix_sid(&attr_args, mp_update); break; + case BGP_ATTR_PMSI_TUNNEL: + ret = bgp_attr_pmsi_tunnel(&attr_args); + break; default: ret = bgp_attr_unknown(&attr_args); break; @@ -3263,7 +3311,7 @@ bgp_size_t bgp_packet_attribute(struct bgp *bgp, struct peer *peer, stream_putc(s, BGP_ATTR_PMSI_TUNNEL); stream_putc(s, 9); // Length stream_putc(s, 0); // Flags - stream_putc(s, 6); // Tunnel type: Ingress Replication (6) + stream_putc(s, PMSI_TNLTYPE_INGR_REPL); // IR (6) stream_put(s, &(attr->label), BGP_LABEL_BYTES); // MPLS Label / VXLAN VNI stream_put_ipv4(s, attr->nexthop.s_addr); diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index 1a49e4ecf..5403f3254 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -66,6 +66,8 @@ #define BGP_PREFIX_SID_IPV6_LENGTH 19 #define BGP_PREFIX_SID_ORIGINATOR_SRGB_LENGTH 6 +/* PMSI tunnel types (RFC 6514) */ + struct bgp_attr_encap_subtlv { struct bgp_attr_encap_subtlv *next; /* for chaining */ /* Reference count of this attribute. */ @@ -96,6 +98,18 @@ struct overlay_index { union gw_addr gw_ip; }; +enum pta_type { + PMSI_TNLTYPE_NO_INFO = 0, + PMSI_TNLTYPE_RSVP_TE_P2MP, + PMSI_TNLTYPE_MLDP_P2MP, + PMSI_TNLTYPE_PIM_SSM, + PMSI_TNLTYPE_PIM_SM, + PMSI_TNLTYPE_PIM_BIDIR, + PMSI_TNLTYPE_INGR_REPL, + PMSI_TNLTYPE_MLDP_MP2MP, + PMSI_TNLTYPE_MAX = PMSI_TNLTYPE_MLDP_MP2MP +}; + /* BGP core attribute structure. */ struct attr { /* AS Path structure */ @@ -119,6 +133,9 @@ struct attr { /* Path origin attribute */ u_char origin; + /* PMSI tunnel type (RFC 6514). */ + enum pta_type pmsi_tnl_type; + /* has the route-map changed any attribute? Used on the peer outbound side. */ u_int32_t rmap_change_flags; diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 691cdd19d..f86726695 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -162,7 +162,6 @@ static const struct message bgp_notify_capability_msg[] = { const char *bgp_origin_str[] = {"i", "e", "?"}; const char *bgp_origin_long_str[] = {"IGP", "EGP", "incomplete"}; - /* Given a string return a pointer the corresponding peer structure */ static struct peer *bgp_find_peer(struct vty *vty, const char *peer_str) { @@ -417,6 +416,10 @@ int bgp_dump_attr(struct attr *attr, char *buf, size_t size) inet_ntoa(attr->cluster->list[i])); } + if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) + snprintf(buf + strlen(buf), size - strlen(buf), + ", pmsi tnltype %u", attr->pmsi_tnl_type); + if (CHECK_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_AS_PATH))) snprintf(buf + strlen(buf), size - strlen(buf), ", path %s", aspath_print(attr->aspath)); diff --git a/bgpd/bgp_debug.h b/bgpd/bgp_debug.h index 57f8fef5f..fe7ca8c46 100644 --- a/bgpd/bgp_debug.h +++ b/bgpd/bgp_debug.h @@ -142,6 +142,7 @@ struct bgp_debug_filter { #define CONF_BGP_DEBUG(a, b) (conf_bgp_debug_ ## a & BGP_DEBUG_ ## b) extern const char *bgp_type_str[]; +extern const char *pmsi_tnltype_str[]; extern int bgp_dump_attr(struct attr *, char *, size_t); extern int bgp_debug_peer_updout_enabled(char *host); diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index fc7549671..94d9cb465 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -475,6 +475,17 @@ static void derive_rd_rt_for_vni(struct bgp *bgp, struct bgpevpn *vpn) } /* + * Convert nexthop (remote VTEP IP) into an IPv6 address. + */ +static void evpn_convert_nexthop_to_ipv6(struct attr *attr) +{ + if (BGP_ATTR_NEXTHOP_AFI_IP6(attr)) + return; + ipv4_to_ipv4_mapped_ipv6(&attr->mp_nexthop_global, attr->nexthop); + attr->mp_nexthop_len = IPV6_MAX_BYTELEN; +} + +/* * Add (update) or delete MACIP from zebra. */ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, @@ -622,17 +633,17 @@ static void build_evpn_type5_route_extcomm(struct bgp *bgp_vrf, } /* - * Build extended communities for EVPN route. RT and ENCAP are - * applicable to all routes. - * TODO: currently kernel doesnt support ipv6 routes with ipv4 nexthops. - * This means that we can't do symmetric routing for ipv6 hosts routes - * in the same way as ipv4 host routes. - * We wont attach l3-vni related RTs for ipv6 routes. - * For now, We will only adevrtise ipv4 host routes - * with L3-VNI related ext-comm. + * Build extended communities for EVPN route. + * This function is applicable for type-2 and type-3 routes. The layer-2 RT + * and ENCAP extended communities are applicable for all routes. + * The default gateway extended community and MAC mobility (sticky) extended + * community are added as needed based on passed settings - only for type-2 + * routes. Likewise, the layer-3 RT and Router MAC extended communities are + * added, if present, based on passed settings - only for non-link-local + * type-2 routes. */ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, - afi_t afi) + int add_l3_ecomm) { struct ecommunity ecom_encap; struct ecommunity ecom_sticky; @@ -662,11 +673,10 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, for (ALL_LIST_ELEMENTS(vpn->export_rtl, node, nnode, ecom)) attr->ecommunity = ecommunity_merge(attr->ecommunity, ecom); - /* - * only attach l3-vni export rts for ipv4 address family and if we are - * advertising both the labels in type-2 routes + /* Add the export RTs for L3VNI if told to - caller determines + * when this should be done. */ - if (afi == AFI_IP && CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) { + if (add_l3_ecomm) { vrf_export_rtl = bgpevpn_get_vrf_export_rtl(vpn); if (vrf_export_rtl && !list_isempty(vrf_export_rtl)) { for (ALL_LIST_ELEMENTS(vrf_export_rtl, node, nnode, @@ -676,6 +686,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, } } + /* Add MAC mobility (sticky) if needed. */ if (attr->sticky) { seqnum = 0; memset(&ecom_sticky, 0, sizeof(ecom_sticky)); @@ -686,12 +697,8 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, ecommunity_merge(attr->ecommunity, &ecom_sticky); } - /* - * only attach l3-vni rmac for ipv4 address family and if we are - * advertising both the labels in type-2 routes - */ - if (afi == AFI_IP && !is_zero_mac(&attr->rmac) - && CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) { + /* Add RMAC, if told to. */ + if (add_l3_ecomm) { memset(&ecom_rmac, 0, sizeof(ecom_rmac)); encode_rmac_extcomm(&eval_rmac, &attr->rmac); ecom_rmac.size = 1; @@ -700,6 +707,7 @@ static void build_evpn_route_extcomm(struct bgpevpn *vpn, struct attr *attr, ecommunity_merge(attr->ecommunity, &ecom_rmac); } + /* Add default gateway, if needed. */ if (attr->default_gw) { memset(&ecom_default_gw, 0, sizeof(ecom_default_gw)); encode_default_gw_extcomm(&eval_default_gw); @@ -1260,6 +1268,7 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, struct bgp_node *rn; struct attr attr; struct attr *attr_new; + int add_l3_ecomm = 0; struct bgp_info *ri; afi_t afi = AFI_L2VPN; safi_t safi = SAFI_EVPN; @@ -1279,14 +1288,23 @@ static int update_evpn_route(struct bgp *bgp, struct bgpevpn *vpn, if (p->prefix.route_type == BGP_EVPN_IMET_ROUTE) attr.flag |= ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL); - /* router mac is only needed for type-2 and type-5 routes */ + /* router mac is only needed for type-2 routes here. */ if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE) bgpevpn_get_rmac(vpn, &attr.rmac); vni2label(vpn->vni, &(attr.label)); - /* Set up RT and ENCAP extended community. */ - build_evpn_route_extcomm( - vpn, &attr, IS_EVPN_PREFIX_IPADDR_V4(p) ? AFI_IP : AFI_IP6); + /* Include L3 VNI related RTs and RMAC for type-2 routes, if they're + * IPv4 or IPv6 global addresses and we're advertising L3VNI with + * these routes. + */ + if (p->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE && + (IS_EVPN_PREFIX_IPADDR_V4(p) || + !IN6_IS_ADDR_LINKLOCAL(&p->prefix.ip.ipaddr_v6)) && + CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) + add_l3_ecomm = 1; + + /* Set up extended community. */ + build_evpn_route_extcomm(vpn, &attr, add_l3_ecomm); /* First, create (or fetch) route node within the VNI. */ /* NOTE: There is no RD here. */ @@ -1466,22 +1484,20 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn) struct attr attr; struct attr attr_sticky; struct attr attr_def_gw; - struct attr attr_ip6; - struct attr attr_sticky_ip6; - struct attr attr_def_gw_ip6; + struct attr attr_ip6_ll; struct attr *attr_new; + int add_l3_ecomm = 0; afi = AFI_L2VPN; safi = SAFI_EVPN; memset(&attr, 0, sizeof(struct attr)); memset(&attr_sticky, 0, sizeof(struct attr)); memset(&attr_def_gw, 0, sizeof(struct attr)); - memset(&attr_ip6, 0, sizeof(struct attr)); - memset(&attr_sticky_ip6, 0, sizeof(struct attr)); - memset(&attr_def_gw_ip6, 0, sizeof(struct attr)); + memset(&attr_ip6_ll, 0, sizeof(struct attr)); - /* Build path-attribute - all type-2 routes for this VNI will share the - * same path attribute. + /* Build path-attribute - multiple type-2 routes for this VNI will share + * the same path attribute, but we need separate structures for sticky + * MACs, default gateway and IPv6 link-local addresses (no L3 RT/RMAC). */ bgp_attr_default_set(&attr, BGP_ORIGIN_IGP); bgp_attr_default_set(&attr_sticky, BGP_ORIGIN_IGP); @@ -1500,31 +1516,21 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn) attr_def_gw.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; attr_def_gw.default_gw = 1; bgpevpn_get_rmac(vpn, &attr_def_gw.rmac); - bgp_attr_default_set(&attr_ip6, BGP_ORIGIN_IGP); - bgp_attr_default_set(&attr_sticky_ip6, BGP_ORIGIN_IGP); - bgp_attr_default_set(&attr_def_gw_ip6, BGP_ORIGIN_IGP); - attr_ip6.nexthop = vpn->originator_ip; - attr_ip6.mp_nexthop_global_in = vpn->originator_ip; - attr_ip6.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; - bgpevpn_get_rmac(vpn, &attr_ip6.rmac); - attr_sticky_ip6.nexthop = vpn->originator_ip; - attr_sticky_ip6.mp_nexthop_global_in = vpn->originator_ip; - attr_sticky_ip6.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; - attr_sticky_ip6.sticky = 1; - bgpevpn_get_rmac(vpn, &attr_sticky_ip6.rmac); - attr_def_gw_ip6.nexthop = vpn->originator_ip; - attr_def_gw_ip6.mp_nexthop_global_in = vpn->originator_ip; - attr_def_gw_ip6.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; - attr_def_gw_ip6.default_gw = 1; - bgpevpn_get_rmac(vpn, &attr_def_gw_ip6.rmac); - - /* Set up RT, ENCAP and sticky MAC extended community. */ - build_evpn_route_extcomm(vpn, &attr, AFI_IP); - build_evpn_route_extcomm(vpn, &attr_sticky, AFI_IP); - build_evpn_route_extcomm(vpn, &attr_def_gw, AFI_IP); - build_evpn_route_extcomm(vpn, &attr_ip6, AFI_IP6); - build_evpn_route_extcomm(vpn, &attr_sticky_ip6, AFI_IP6); - build_evpn_route_extcomm(vpn, &attr_def_gw_ip6, AFI_IP); + bgp_attr_default_set(&attr_ip6_ll, BGP_ORIGIN_IGP); + attr_ip6_ll.nexthop = vpn->originator_ip; + attr_ip6_ll.mp_nexthop_global_in = vpn->originator_ip; + attr_ip6_ll.mp_nexthop_len = BGP_ATTR_NHLEN_IPV4; + + /* Add L3 VNI RTs and RMAC for non IPv6 link-local attributes if + * using L3 VNI for type-2 routes also. + */ + if (CHECK_FLAG(vpn->flags, VNI_FLAG_USE_TWO_LABELS)) + add_l3_ecomm = 1; + + build_evpn_route_extcomm(vpn, &attr, add_l3_ecomm); + build_evpn_route_extcomm(vpn, &attr_sticky, add_l3_ecomm); + build_evpn_route_extcomm(vpn, &attr_def_gw, add_l3_ecomm); + build_evpn_route_extcomm(vpn, &attr_ip6_ll, 0); /* Walk this VNI's route table and update local type-2 routes. For any * routes updated, update corresponding entry in the global table too. @@ -1538,7 +1544,11 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn) if (evp->prefix.route_type != BGP_EVPN_MAC_IP_ROUTE) continue; - if (IS_EVPN_PREFIX_IPADDR_V4(evp)) { + if (IS_EVPN_PREFIX_IPADDR_V6(evp) && + IN6_IS_ADDR_LINKLOCAL(&evp->prefix.ip.ipaddr_v6)) + update_evpn_route_entry(bgp, vpn, afi, safi, rn, + &attr_ip6_ll, 0, 1, &ri, 0); + else { if (evpn_route_is_sticky(bgp, rn)) update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr_sticky, 0, 1, &ri, @@ -1550,19 +1560,6 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn) else update_evpn_route_entry(bgp, vpn, afi, safi, rn, &attr, 0, 1, &ri, 0); - } else { - if (evpn_route_is_sticky(bgp, rn)) - update_evpn_route_entry(bgp, vpn, afi, safi, rn, - &attr_sticky_ip6, 0, 1, - &ri, 0); - else if (evpn_route_is_def_gw(bgp, rn)) - update_evpn_route_entry(bgp, vpn, afi, safi, rn, - &attr_def_gw_ip6, 0, 1, - &ri, 0); - else - update_evpn_route_entry(bgp, vpn, afi, safi, rn, - &attr_ip6, 0, 1, &ri, - 0); } /* If a local route exists for this prefix, we need to update @@ -1593,11 +1590,9 @@ static int update_all_type2_routes(struct bgp *bgp, struct bgpevpn *vpn) /* Unintern temporary. */ aspath_unintern(&attr.aspath); - aspath_unintern(&attr_ip6.aspath); aspath_unintern(&attr_sticky.aspath); - aspath_unintern(&attr_sticky_ip6.aspath); aspath_unintern(&attr_def_gw.aspath); - aspath_unintern(&attr_def_gw_ip6.aspath); + aspath_unintern(&attr_ip6_ll.aspath); return 0; } @@ -1791,6 +1786,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, { struct bgp_node *rn; struct bgp_info *ri; + struct attr attr; struct attr *attr_new; int ret = 0; struct prefix p; @@ -1827,6 +1823,15 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, } else return 0; + /* EVPN routes currently only support a IPv4 next hop which corresponds + * to the remote VTEP. When importing into a VRF, if it is IPv6 host + * route, we have to convert the next hop to an IPv4-mapped address + * for the rest of the code to flow through. + */ + bgp_attr_dup(&attr, parent_ri->attr); + if (afi == AFI_IP6) + evpn_convert_nexthop_to_ipv6(&attr); + /* Check if route entry is already present. */ for (ri = rn->info; ri; ri = ri->next) if (ri->extra @@ -1835,7 +1840,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, if (!ri) { /* Add (or update) attribute to hash. */ - attr_new = bgp_attr_intern(parent_ri->attr); + attr_new = bgp_attr_intern(&attr); /* Create new route with its attribute. */ ri = info_make(parent_ri->type, parent_ri->sub_type, 0, @@ -1850,21 +1855,25 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, } bgp_info_add(rn, ri); } else { - if (attrhash_cmp(ri->attr, parent_ri->attr) + if (attrhash_cmp(ri->attr, &attr) && !CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) { bgp_unlock_node(rn); return 0; } /* The attribute has changed. */ /* Add (or update) attribute to hash. */ - attr_new = bgp_attr_intern(parent_ri->attr); + attr_new = bgp_attr_intern(&attr); /* Restore route, if needed. */ if (CHECK_FLAG(ri->flags, BGP_INFO_REMOVED)) bgp_info_restore(rn, ri); /* Mark if nexthop has changed. */ - if (!IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) + if ((afi == AFI_IP && + !IPV4_ADDR_SAME(&ri->attr->nexthop, &attr_new->nexthop)) || + (afi == AFI_IP6 && + !IPV6_ADDR_SAME(&ri->attr->mp_nexthop_global, + &attr_new->mp_nexthop_global))) SET_FLAG(ri->flags, BGP_INFO_IGP_CHANGED); /* Unintern existing, set to new. */ @@ -2577,10 +2586,12 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi, static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf) { /* delete all ipv4 routes and withdraw from peers */ - bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP)) + bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); /* delete all ipv6 routes and withdraw from peers */ - bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP6)) + bgp_evpn_withdraw_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); } /* update and advertise all ipv4 and ipv6 routes in thr vrf table as type-5 @@ -2588,10 +2599,12 @@ static void delete_withdraw_vrf_routes(struct bgp *bgp_vrf) static void update_advertise_vrf_routes(struct bgp *bgp_vrf) { /* update all ipv4 routes */ - bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP)) + bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP, SAFI_UNICAST); /* update all ipv6 routes */ - bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); + if (advertise_type5_routes(bgp_vrf, AFI_IP6)) + bgp_evpn_advertise_type5_routes(bgp_vrf, AFI_IP6, SAFI_UNICAST); } /* @@ -2922,6 +2935,19 @@ static int process_type3_route(struct peer *peer, afi_t afi, safi_t safi, return -1; } + /* If PMSI is present, log if it is anything other than IR. + * Note: We just simply ignore the values as it is not clear if + * doing anything else is better. + */ + if (attr && + (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL))) { + if (attr->pmsi_tnl_type != PMSI_TNLTYPE_INGR_REPL) { + zlog_warn("%u:%s - Rx EVPN Type-3 NLRI with unsupported PTA %d", + peer->bgp->vrf_id, peer->host, + attr->pmsi_tnl_type); + } + } + /* Make prefix_rd */ prd.family = AF_UNSPEC; prd.prefixlen = 64; @@ -3214,10 +3240,6 @@ void bgp_evpn_withdraw_type5_route(struct bgp *bgp_vrf, struct prefix *p, struct prefix_evpn evp; char buf[PREFIX_STRLEN]; - /* NOTE: Check needed as this is called per-route also. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - build_type5_prefix_from_ip_prefix(&evp, p); ret = delete_evpn_type5_route(bgp_vrf, &evp); if (ret) { @@ -3235,10 +3257,6 @@ void bgp_evpn_withdraw_type5_routes(struct bgp *bgp_vrf, afi_t afi, safi_t safi) struct bgp_node *rn = NULL; struct bgp_info *ri; - /* Bail out early if we don't have to advertise type-5 routes. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { /* Only care about "selected" routes - non-imported. */ @@ -3267,11 +3285,7 @@ void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, int ret = 0; struct prefix_evpn evp; char buf[PREFIX_STRLEN]; - - /* NOTE: Check needed as this is called per-route also. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - + build_type5_prefix_from_ip_prefix(&evp, p); ret = update_evpn_type5_route(bgp_vrf, &evp, src_attr); if (ret) @@ -3290,10 +3304,6 @@ void bgp_evpn_advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi, struct bgp_node *rn = NULL; struct bgp_info *ri; - /* Bail out early if we don't have to advertise type-5 routes. */ - if (!advertise_type5_routes(bgp_vrf, afi)) - return; - table = bgp_vrf->rib[afi][safi]; for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn)) { /* Need to identify the "selected" route entry to use its diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index bf6150e64..7c0d63832 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -55,6 +55,25 @@ static inline vni_t label2vni(mpls_label_t *label) return vni; } +static inline int advertise_type5_routes(struct bgp *bgp_vrf, + afi_t afi) +{ + if (!bgp_vrf->l3vni) + return 0; + + if (afi == AFI_IP && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) + return 1; + + if (afi == AFI_IP6 && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) + return 1; + + return 0; +} + extern void bgp_evpn_advertise_type5_route(struct bgp *bgp_vrf, struct prefix *p, struct attr *src_attr, afi_t afi, diff --git a/bgpd/bgp_evpn_private.h b/bgpd/bgp_evpn_private.h index 63dd58184..ce279005d 100644 --- a/bgpd/bgp_evpn_private.h +++ b/bgpd/bgp_evpn_private.h @@ -285,6 +285,14 @@ static inline void ip_prefix_from_type5_prefix(struct prefix_evpn *evp, } } +static inline int is_evpn_prefix_default(struct prefix *evp) +{ + if (evp->family != AF_EVPN) + return 0; + + return ((evp->u.prefix_evpn.ip_prefix_length == 0) ? 1 : 0); +} + static inline void ip_prefix_from_type2_prefix(struct prefix_evpn *evp, struct prefix *ip) { @@ -352,19 +360,17 @@ static inline void build_evpn_type3_prefix(struct prefix_evpn *p, p->prefix.ip.ipaddr_v4 = originator_ip; } -static inline int advertise_type5_routes(struct bgp *bgp_vrf, afi_t afi) +static inline int evpn_default_originate_set(struct bgp *bgp, afi_t afi, + safi_t safi) { - if (!bgp_vrf->l3vni) - return 0; - - if (afi == AFI_IP - && CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + if (afi == AFI_IP && + CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) return 1; - - if (afi == AFI_IP6 - && CHECK_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + else if (afi == AFI_IP6 && + CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) return 1; - return 0; } diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index d42da23f5..58487a682 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -2419,7 +2419,50 @@ static void evpn_unset_advertise_default_gw(struct bgp *bgp, /* * evpn - enable advertisement of default g/w */ -static void evpn_set_advertise_subnet(struct bgp *bgp, struct bgpevpn *vpn) +static void evpn_process_default_originate_cmd(struct bgp *bgp_vrf, + afi_t afi, int add) +{ + struct prefix ip_prefix; + safi_t safi = SAFI_UNICAST; /* ipv4/ipv6 unicast */ + + /* form the default prefix 0.0.0.0/0 */ + memset(&ip_prefix, 0, sizeof(struct prefix)); + ip_prefix.family = afi2family(afi); + ip_prefix.prefixlen = 0; + + if (add) { + /* bail if we are already advertising default route */ + if (evpn_default_originate_set(bgp_vrf, afi, safi)) + return; + + if (afi == AFI_IP) + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); + else if (afi == AFI_IP6) + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); + bgp_evpn_advertise_type5_route(bgp_vrf, &ip_prefix, + NULL, afi, safi); + } else { + /* bail out if we havent advertised the default route */ + if (!evpn_default_originate_set(bgp_vrf, afi, safi)) + return; + if (afi == AFI_IP) + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4); + else if (afi == AFI_IP6) + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6); + bgp_evpn_withdraw_type5_route(bgp_vrf, &ip_prefix, + afi, safi); + } +} + +/* + * evpn - enable advertisement of default g/w + */ +static void evpn_set_advertise_subnet(struct bgp *bgp, + struct bgpevpn *vpn) { if (vpn->advertise_subnet) return; @@ -2612,6 +2655,43 @@ DEFUN (no_bgp_evpn_advertise_all_vni, return CMD_SUCCESS; } +DEFUN (bgp_evpn_default_originate, + bgp_evpn_default_originate_cmd, + "default-originate <ipv4 | ipv6>", + "originate a default route\n" + "ipv4 address family\n" + "ipv6 address family\n") +{ + afi_t afi = 0; + int idx_afi = 0; + struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); + + if (!bgp_vrf) + return CMD_WARNING; + argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); + evpn_process_default_originate_cmd(bgp_vrf, afi, 1); + return CMD_SUCCESS; +} + +DEFUN (no_bgp_evpn_default_originate, + no_bgp_evpn_default_originate_cmd, + "no default-originate <ipv4 | ipv6>", + NO_STR + "withdraw a default route\n" + "ipv4 address family\n" + "ipv6 address family\n") +{ + afi_t afi = 0; + int idx_afi = 0; + struct bgp *bgp_vrf = VTY_GET_CONTEXT(bgp); + + if (!bgp_vrf) + return CMD_WARNING; + argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); + evpn_process_default_originate_cmd(bgp_vrf, afi, 0); + return CMD_SUCCESS; +} + DEFUN (bgp_evpn_advertise_vni_subnet, bgp_evpn_advertise_vni_subnet_cmd, "advertise-subnet", @@ -2631,14 +2711,6 @@ DEFUN (bgp_evpn_advertise_vni_subnet, if (!bgp_vrf) return CMD_WARNING; - if (!(advertise_type5_routes(bgp_vrf, AFI_IP) - || advertise_type5_routes(bgp_vrf, AFI_IP6))) { - vty_out(vty, - "%%Please enable ip prefix advertisement under l2vpn evpn in %s", - vrf_id_to_name(bgp_vrf->vrf_id)); - return CMD_WARNING; - } - evpn_set_advertise_subnet(bgp, vpn); return CMD_SUCCESS; } @@ -2711,19 +2783,23 @@ DEFUN (bgp_evpn_advertise_type5, /* if we are already advertising ipv4 prefix as type-5 * nothing to do */ - if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + if (!rmap_changed && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) return CMD_WARNING; - SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN); + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST); } else { /* if we are already advertising ipv6 prefix as type-5 * nothing to do */ - if (!rmap_changed && CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + if (!rmap_changed && + CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) return CMD_WARNING; - SET_FLAG(bgp_vrf->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN); + SET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST); } if (rmap_changed) { @@ -2766,7 +2842,7 @@ DEFUN (no_bgp_evpn_advertise_type5, argv_find_and_parse_afi(argv, argc, &idx_afi, &afi); argv_find_and_parse_safi(argv, argc, &idx_safi, &safi); - if (!(afi == AFI_IP) || (afi == AFI_IP6)) { + if (!(afi == AFI_IP || afi == AFI_IP6)) { vty_out(vty, "%%only ipv4 or ipv6 address families are supported"); return CMD_WARNING; @@ -2780,25 +2856,25 @@ DEFUN (no_bgp_evpn_advertise_type5, if (afi == AFI_IP) { - /* if we are already advertising ipv4 prefix as type-5 + /* if we are not advertising ipv4 prefix as type-5 * nothing to do */ - if (CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) { + if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) { bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi); - UNSET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV4_IN_EVPN); + UNSET_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST); } } else { - /* if we are already advertising ipv6 prefix as type-5 + /* if we are not advertising ipv6 prefix as type-5 * nothing to do */ - if (CHECK_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) { + if (CHECK_FLAG(bgp_vrf->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) { bgp_evpn_withdraw_type5_routes(bgp_vrf, afi, safi); UNSET_FLAG(bgp_vrf->vrf_flags, - BGP_VRF_ADVERTISE_IPV6_IN_EVPN); + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST); } } @@ -4305,12 +4381,22 @@ void bgp_config_write_evpn_info(struct vty *vty, struct bgp *bgp, afi_t afi, if (bgp->advertise_gw_macip) vty_out(vty, " advertise-default-gw\n"); - if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV4_IN_EVPN)) + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST)) vty_out(vty, " advertise ipv4 unicast\n"); - if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_ADVERTISE_IPV6_IN_EVPN)) + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST)) vty_out(vty, " advertise ipv6 unicast\n"); + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4)) + vty_out(vty, " default-originate ipv4\n"); + + if (CHECK_FLAG(bgp->af_flags[AFI_L2VPN][SAFI_EVPN], + BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6)) + vty_out(vty, " default-originate ipv6\n"); + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_RD_CFGD)) vty_out(vty, " rd %s\n", prefix_rd2str(&bgp->vrf_prd, buf1, sizeof(buf1))); @@ -4373,6 +4459,8 @@ void bgp_ethernetvpn_init(void) install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_default_gw_cmd); install_element(BGP_EVPN_NODE, &bgp_evpn_advertise_type5_cmd); install_element(BGP_EVPN_NODE, &no_bgp_evpn_advertise_type5_cmd); + install_element(BGP_EVPN_NODE, &bgp_evpn_default_originate_cmd); + install_element(BGP_EVPN_NODE, &no_bgp_evpn_default_originate_cmd); /* "show bgp l2vpn evpn" commands. */ install_element(VIEW_NODE, &show_bgp_l2vpn_evpn_vni_cmd); diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 26f96d684..032b33229 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -82,6 +82,21 @@ extern const char *bgp_origin_str[]; extern const char *bgp_origin_long_str[]; +/* PMSI strings. */ +#define PMSI_TNLTYPE_STR_NO_INFO "No info" +#define PMSI_TNLTYPE_STR_DEFAULT PMSI_TNLTYPE_STR_NO_INFO +static const struct message bgp_pmsi_tnltype_str[] = { + {PMSI_TNLTYPE_NO_INFO, PMSI_TNLTYPE_STR_NO_INFO}, + {PMSI_TNLTYPE_RSVP_TE_P2MP, "RSVP-TE P2MP"}, + {PMSI_TNLTYPE_MLDP_P2MP, "mLDP P2MP"}, + {PMSI_TNLTYPE_PIM_SSM, "PIM-SSM"}, + {PMSI_TNLTYPE_PIM_SM, "PIM-SM"}, + {PMSI_TNLTYPE_PIM_BIDIR, "PIM-BIDIR"}, + {PMSI_TNLTYPE_INGR_REPL, "Ingress Replication"}, + {PMSI_TNLTYPE_MLDP_MP2MP, "mLDP MP2MP"}, + {0} +}; + struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi, safi_t safi, struct prefix *p, struct prefix_rd *prd) @@ -2285,12 +2300,13 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_node *rn, /* advertise/withdraw type-5 routes */ if ((afi == AFI_IP || afi == AFI_IP6) && (safi == SAFI_UNICAST)) { - if (new_select - && (!new_select->extra || !new_select->extra->parent)) - bgp_evpn_advertise_type5_route( - bgp, &rn->p, new_select->attr, afi, safi); - else if (old_select - && (!old_select->extra || !old_select->extra->parent)) + if (advertise_type5_routes(bgp, afi) && new_select && + (!new_select->extra || !new_select->extra->parent)) + bgp_evpn_advertise_type5_route(bgp, &rn->p, + new_select->attr, + afi, safi); + else if (advertise_type5_routes(bgp, afi) && old_select && + (!old_select->extra || !old_select->extra->parent)) bgp_evpn_withdraw_type5_route(bgp, &rn->p, afi, safi); } @@ -7197,6 +7213,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, json_object *json_ext_community = NULL; json_object *json_lcommunity = NULL; json_object *json_last_update = NULL; + json_object *json_pmsi = NULL; json_object *json_nexthop_global = NULL; json_object *json_nexthop_ll = NULL; json_object *json_nexthops = NULL; @@ -7949,6 +7966,24 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p, json_last_update); } else vty_out(vty, " Last update: %s", ctime(&tbuf)); + + /* Line 10 display PMSI tunnel attribute, if present */ + if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) { + const char *str = lookup_msg(bgp_pmsi_tnltype_str, + attr->pmsi_tnl_type, + PMSI_TNLTYPE_STR_DEFAULT); + + if (json_paths) { + json_pmsi = json_object_new_object(); + json_object_string_add(json_pmsi, + "tunnelType", str); + json_object_object_add(json_path, "pmsi", + json_pmsi); + } else + vty_out(vty, " PMSI Tunnel Type: %s\n", + str); + } + } /* We've constructed the json object for this path, add it to the json diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index b79c6a7c3..5a265b6c9 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -595,6 +595,24 @@ struct route_map_rule_cmd route_match_ip_route_source_prefix_list_cmd = { route_match_ip_route_source_prefix_list_compile, route_match_ip_route_source_prefix_list_free}; +/* `match evpn default-route' */ + +/* Match function should return 1 if match is success else 0 */ +static route_map_result_t route_match_evpn_default_route(void *rule, + struct prefix *p, + route_map_object_t + type, void *object) +{ + if (type == RMAP_BGP && is_evpn_prefix_default(p)) + return RMAP_MATCH; + + return RMAP_NOMATCH; +} + +/* Route map commands for default-route matching. */ +struct route_map_rule_cmd route_match_evpn_default_route_cmd = { + "evpn default-route", route_match_evpn_default_route, NULL, NULL}; + /* `match mac address MAC_ACCESS_LIST' */ /* Match function should return 1 if match is success else return @@ -3254,6 +3272,29 @@ DEFUN (no_match_evpn_vni, RMAP_EVENT_MATCH_DELETED); } +DEFUN (match_evpn_default_route, + match_evpn_default_route_cmd, + "match evpn default-route", + MATCH_STR + EVPN_HELP_STR + "default EVPN type-5 route\n") +{ + return bgp_route_match_add(vty, "evpn default-route", NULL, + RMAP_EVENT_MATCH_ADDED); +} + +DEFUN (no_match_evpn_default_route, + no_match_evpn_default_route_cmd, + "no match evpn default-route", + NO_STR + MATCH_STR + EVPN_HELP_STR + "default EVPN type-5 route\n") +{ + return bgp_route_match_delete(vty, "evpn default-route", NULL, + RMAP_EVENT_MATCH_DELETED); +} + DEFUN (match_peer, match_peer_cmd, "match peer <A.B.C.D|X:X::X:X|WORD>", @@ -4633,6 +4674,7 @@ void bgp_route_map_init(void) route_map_install_match(&route_match_mac_address_cmd); route_map_install_match(&route_match_evpn_vni_cmd); route_map_install_match(&route_match_evpn_route_type_cmd); + route_map_install_match(&route_match_evpn_default_route_cmd); route_map_install_set(&route_set_ip_nexthop_cmd); route_map_install_set(&route_set_local_pref_cmd); @@ -4669,6 +4711,8 @@ void bgp_route_map_init(void) install_element(RMAP_NODE, &no_match_evpn_vni_cmd); install_element(RMAP_NODE, &match_evpn_route_type_cmd); install_element(RMAP_NODE, &no_match_evpn_route_type_cmd); + install_element(RMAP_NODE, &match_evpn_default_route_cmd); + install_element(RMAP_NODE, &no_match_evpn_default_route_cmd); install_element(RMAP_NODE, &match_aspath_cmd); install_element(RMAP_NODE, &no_match_aspath_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index e7d58a021..2eae2e5e9 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7534,16 +7534,14 @@ static void bgp_pthreads_init() .id = PTHREAD_IO, .start = frr_pthread_attr_default.start, .stop = frr_pthread_attr_default.stop, - .name = "BGP I/O thread", }; struct frr_pthread_attr ka = { .id = PTHREAD_KEEPALIVES, .start = bgp_keepalives_start, .stop = bgp_keepalives_stop, - .name = "BGP Keepalives thread", }; - frr_pthread_new(&io); - frr_pthread_new(&ka); + frr_pthread_new(&io, "BGP I/O thread"); + frr_pthread_new(&ka, "BGP Keepalives thread"); } void bgp_pthreads_run() diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 41ae8e916..664f8c9da 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -319,6 +319,13 @@ struct bgp { #define BGP_CONFIG_DAMPENING (1 << 0) #define BGP_CONFIG_VRF_TO_MPLSVPN_EXPORT (1 << 1) +/* l2vpn evpn flags - 1 << 0 is used for DAMPENNG */ +#define BGP_L2VPN_EVPN_ADVERTISE_IPV4_UNICAST (1 << 1) +#define BGP_L2VPN_EVPN_ADVERTISE_IPV6_UNICAST (1 << 2) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV4 (1 << 3) +#define BGP_L2VPN_EVPN_DEFAULT_ORIGINATE_IPV6 (1 << 4) + + /* Route table for next-hop lookup cache. */ struct bgp_table *nexthop_cache_table[AFI_MAX]; @@ -430,12 +437,11 @@ struct bgp { /* vrf flags */ uint32_t vrf_flags; #define BGP_VRF_AUTO (1 << 0) -#define BGP_VRF_ADVERTISE_IPV4_IN_EVPN (1 << 1) -#define BGP_VRF_ADVERTISE_IPV6_IN_EVPN (1 << 2) -#define BGP_VRF_IMPORT_RT_CFGD (1 << 3) -#define BGP_VRF_EXPORT_RT_CFGD (1 << 4) -#define BGP_VRF_RD_CFGD (1 << 5) -#define BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY (1 << 6) +#define BGP_VRF_IMPORT_RT_CFGD (1 << 1) +#define BGP_VRF_EXPORT_RT_CFGD (1 << 2) +#define BGP_VRF_RD_CFGD (1 << 3) +#define BGP_VRF_L3VNI_PREFIX_ROUTES_ONLY (1 << 4) + /* unique ID for auto derivation of RD for this vrf */ uint16_t vrf_rd_id; diff --git a/configure.ac b/configure.ac index 0d6c99acf..24d6fa086 100755 --- a/configure.ac +++ b/configure.ac @@ -396,6 +396,8 @@ AC_ARG_ENABLE(rpki, AS_HELP_STRING([--enable-rpki], [enable RPKI prefix validation support])) AC_ARG_ENABLE([clippy-only], AS_HELP_STRING([--enable-clippy-only], [Only build clippy])) +AC_ARG_ENABLE([numeric_version], + AS_HELP_STRING([--enable-numeric-version], [Only numeric digits allowed in version (for Alpine)])) AS_IF([test "${enable_clippy_only}" != "yes"], [ AC_CHECK_HEADERS(json-c/json.h) @@ -647,6 +649,14 @@ AC_DEFINE_UNQUOTED(MULTIPATH_NUM, $MPATH_NUM, Maximum number of paths for a rout AC_DEFINE_UNQUOTED(VTYSH_PAGER, "$VTYSH_PAGER", [What pager to use]) +dnl ------------------------------------ +dnl Alpine only accepts numeric versions +dnl ------------------------------------ +if test "x${enable_numeric_version}" != "x" ; then + VERSION="`echo ${VERSION} | tr -c -d '[[.0-9]]'`" + PACKAGE_VERSION="`echo ${PACKAGE_VERSION} | tr -c -d '[[.0-9]]'`" +fi + dnl ----------------------------------- dnl Add extra version string to package dnl name, string and version fields. @@ -1872,27 +1882,10 @@ AC_CONFIG_FILES([Makefile redhat/frr.spec debianpkg/Makefile debianpkg/changelog + alpine/APKBUILD snapcraft/snapcraft.yaml lib/version.h tests/lib/cli/test_cli.refout - doc/defines.texi - doc/bgpd.8 - doc/isisd.8 - doc/ospf6d.8 - doc/ospfclient.8 - doc/ospfd.8 - doc/ldpd.8 - doc/ripd.8 - doc/eigrpd.8 - doc/ripngd.8 - doc/pimd.8 - doc/mtracebis.8 - doc/nhrpd.8 - doc/vtysh.1 - doc/watchfrr.8 - doc/zebra.8 - doc/frr.1 - doc/frr-args.8 pkgsrc/bgpd.sh pkgsrc/ospf6d.sh pkgsrc/ospfd.sh pkgsrc/ripd.sh pkgsrc/ripngd.sh pkgsrc/zebra.sh pkgsrc/eigrpd.sh]) diff --git a/debianpkg/backports/ubuntu12.04/debian/rules b/debianpkg/backports/ubuntu12.04/debian/rules index 2e9e84faa..9a3ea1ffb 100755 --- a/debianpkg/backports/ubuntu12.04/debian/rules +++ b/debianpkg/backports/ubuntu12.04/debian/rules @@ -27,6 +27,9 @@ MULTIPATH ?= 256 WANT_FRR_USER ?= frr WANT_FRR_VTY_GROUP ?= frrvty +# Don't build PDF docs by default +GENERATE_PDF ?= 0 + # #################################### @@ -135,18 +138,11 @@ override_dh_auto_configure: fi override_dh_auto_build: - #dh_auto_build - $(MAKE) - dh_auto_build -- -C doc draft-zebra-00.txt - - - # doc/ is a bit crazy ifeq ($(GENERATE_PDF), 1) - dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf + dh_auto_build -- -C doc pdf endif - rm -vf doc/frr.info - dh_auto_build -- -C doc frr.info - rm -vf doc/frr.info.html* + rm -vf doc/user/_build/texinfo/frr.info + dh_auto_build -- -C doc info override_dh_auto_test: diff --git a/debianpkg/backports/ubuntu14.04/debian/frr.install b/debianpkg/backports/ubuntu14.04/debian/frr.install index 8e83bdf6d..0b0d953ac 100644 --- a/debianpkg/backports/ubuntu14.04/debian/frr.install +++ b/debianpkg/backports/ubuntu14.04/debian/frr.install @@ -5,18 +5,6 @@ usr/include/frr/ usr/lib/ tools/frr etc/init.d/ usr/share/doc/frr/ -usr/share/man/man1/vtysh.1 -usr/share/man/man1/frr.1 -usr/share/man/man8 -usr/share/man/man8/bgpd.8 -usr/share/man/man8/ospf6d.8 -usr/share/man/man8/ospfd.8 -usr/share/man/man8/ripd.8 -usr/share/man/man8/ripngd.8 -usr/share/man/man8/zebra.8 -usr/share/man/man8/isisd.8 -usr/share/man/man8/watchfrr.8 -usr/share/man/man8/mtracebis.8 usr/share/snmp/mibs/ tools/etc/* etc/ tools/*.service lib/systemd/system diff --git a/debianpkg/backports/ubuntu14.04/debian/rules b/debianpkg/backports/ubuntu14.04/debian/rules index 4f82d772c..20b821ead 100755 --- a/debianpkg/backports/ubuntu14.04/debian/rules +++ b/debianpkg/backports/ubuntu14.04/debian/rules @@ -27,6 +27,9 @@ MULTIPATH ?= 256 WANT_FRR_USER ?= frr WANT_FRR_VTY_GROUP ?= frrvty +# Don't build PDF docs by default +GENERATE_PDF ?= 0 + # #################################### @@ -137,16 +140,13 @@ override_dh_auto_configure: override_dh_auto_build: #dh_auto_build $(MAKE) - dh_auto_build -- -C doc draft-zebra-00.txt - # doc/ is a bit crazy ifeq ($(GENERATE_PDF), 1) - dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf + dh_auto_build -- -C doc pdf endif - rm -vf doc/frr.info - dh_auto_build -- -C doc frr.info - rm -vf doc/frr.info.html* + rm -vf doc/_build/texinfo/frr.info + dh_auto_build -- -C doc info override_dh_auto_test: diff --git a/debianpkg/control b/debianpkg/control index 297a7cf10..bbd4c43b4 100644 --- a/debianpkg/control +++ b/debianpkg/control @@ -4,7 +4,7 @@ Priority: optional Maintainer: Nobody <nobody@frrouting.org> Uploaders: Nobody <nobody@frrouting.org> XSBC-Original-Maintainer: <maintainers@frrouting.org> -Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, autotools-dev, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson-c-dev, libjson-c2 | libjson-c3, dh-systemd, libsystemd-dev, bison, flex, libc-ares-dev, pkg-config, python (>= 2.7), python-ipaddr +Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), autotools-dev, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson-c-dev, libjson-c2 | libjson-c3, dh-systemd, libsystemd-dev, bison, flex, libc-ares-dev, pkg-config, python (>= 2.7), python-ipaddr, python-sphinx Standards-Version: 3.9.6 Homepage: http://www.frrouting.org/ diff --git a/debianpkg/frr-doc.docs b/debianpkg/frr-doc.docs index a0776fd68..4720a3b92 100644 --- a/debianpkg/frr-doc.docs +++ b/debianpkg/frr-doc.docs @@ -2,7 +2,5 @@ AUTHORS NEWS README REPORTING-BUGS -doc/BGP-TypeCode -doc/draft-zebra-00.txt -doc/mpls/ -bgpd/BGP4-MIB.txt +doc/user/*.rst +doc/figures/*.png diff --git a/debianpkg/frr-doc.info b/debianpkg/frr-doc.info index c4f181cdb..a83255a24 100644 --- a/debianpkg/frr-doc.info +++ b/debianpkg/frr-doc.info @@ -1 +1 @@ -doc/frr.info* +doc/user/_build/texinfo/frr.info diff --git a/debianpkg/frr-doc.install b/debianpkg/frr-doc.install index e5910fec8..8854b2c54 100644 --- a/debianpkg/frr-doc.install +++ b/debianpkg/frr-doc.install @@ -1,2 +1 @@ -usr/share/info -doc/*.png usr/share/info +doc/user/_build/texinfo/*.png usr/share/info diff --git a/debianpkg/frr.install b/debianpkg/frr.install index 1aee4d540..8d1266270 100644 --- a/debianpkg/frr.install +++ b/debianpkg/frr.install @@ -5,20 +5,7 @@ usr/include/frr/ usr/lib/ tools/frr usr/lib/frr usr/share/doc/frr/ -usr/share/man/man1/vtysh.1 -usr/share/man/man1/frr.1 -usr/share/man/man8 -usr/share/man/man8/bgpd.8 -usr/share/man/man8/ospf6d.8 -usr/share/man/man8/ospfd.8 -usr/share/man/man8/ripd.8 -usr/share/man/man8/ripngd.8 -usr/share/man/man8/zebra.8 -usr/share/man/man8/isisd.8 -usr/share/man/man8/watchfrr.8 -usr/share/man/man8/frr-args.8 -usr/share/man/man8/mtracebis.8 usr/share/snmp/mibs/ tools/etc/* etc/ -tools/*.service lib/systemd/system +tools/*.service lib/systemd/system debian/frr.conf usr/lib/tmpfiles.d diff --git a/debianpkg/frr.manpages b/debianpkg/frr.manpages index 17a128b7e..d4bb920b4 100644 --- a/debianpkg/frr.manpages +++ b/debianpkg/frr.manpages @@ -1,9 +1,15 @@ -doc/bgpd.8 -doc/ospf6d.8 -doc/ospfd.8 -doc/ripd.8 -doc/ripngd.8 -doc/vtysh.1 -doc/zebra.8 -doc/isisd.8 -doc/watchfrr.8 +doc/manpages/_build/man/frr.1 +doc/manpages/_build/man/bgpd.8 +doc/manpages/_build/man/pimd.8 +doc/manpages/_build/man/eigrpd.8 +doc/manpages/_build/man/ldpd.8 +doc/manpages/_build/man/nhrpd.8 +doc/manpages/_build/man/ospf6d.8 +doc/manpages/_build/man/ospfd.8 +doc/manpages/_build/man/ripd.8 +doc/manpages/_build/man/ripngd.8 +doc/manpages/_build/man/vtysh.1 +doc/manpages/_build/man/zebra.8 +doc/manpages/_build/man/isisd.8 +doc/manpages/_build/man/watchfrr.8 +doc/manpages/_build/man/mtracebis.8 diff --git a/debianpkg/rules b/debianpkg/rules index 574f448df..82a514803 100755 --- a/debianpkg/rules +++ b/debianpkg/rules @@ -27,6 +27,9 @@ MULTIPATH ?= 256 WANT_FRR_USER ?= frr WANT_FRR_VTY_GROUP ?= frrvty +# Don't build PDF docs by default +GENERATE_PDF ?= 0 + # #################################### @@ -136,18 +139,12 @@ override_dh_auto_configure: fi override_dh_auto_build: - #dh_auto_build - $(MAKE) - dh_auto_build -- -C doc draft-zebra-00.txt - - # doc/ is a bit crazy ifeq ($(GENERATE_PDF), 1) - dh_auto_build -- -C doc frr.pdf || true # pdfetex fails with exit code 1 but still produces a good looking .pdf + dh_auto_build -- -C doc pdf endif - rm -vf doc/frr.info - dh_auto_build -- -C doc frr.info - rm -vf doc/frr.info.html* + rm -vf doc/user/_build/texinfo/frr.info + dh_auto_build -- -C doc info override_dh_auto_test: diff --git a/doc/.gitignore b/doc/.gitignore index 57c66cb4a..e539d9a97 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -2,13 +2,6 @@ Makefile Makefile.in mdate-sh draft-zebra-00.txt -frr.info-* -zebra.html -defines.texi -version.texi -texinfo.tex -frr.html -frr.info *.pdf *.eps frr.ps @@ -28,8 +21,6 @@ stamp-vti *.toc *.tp *.vr -*.8 -*.1 .arch-inventory .arch-ids *~ diff --git a/doc/Building_FRR_for_LEDE-OpenWRT.md b/doc/Building_FRR_for_LEDE-OpenWRT.md deleted file mode 100644 index cde68dbd0..000000000 --- a/doc/Building_FRR_for_LEDE-OpenWRT.md +++ /dev/null @@ -1,96 +0,0 @@ -Building FRR for OpenWRT/LEDE from Git Source -=============================================== - -- for the moment because of cross compile problems, master is not supported, - only upto 3.0 -- LDP can't be built because of missing Perl-XML-LibXML in OpenWRT/LEDE tree - -Prepare build environment -------------------------- - -https://lede-project.org/docs/guide-developer/install-buildsystem - -for - -Ubuntu 12.04LTS: - - sudo apt-get install build-essential subversion git-core \ - libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc \ - libxml-parser-perl mercurial bzr ecj cvs unzip - -Ubuntu 64bit: - - sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev \ - gawk gcc-multilib flex git-core gettext libssl-dev - -Debian 8 Jessie: - - sudo apt-get install build-essential libncurses5-dev gawk git subversion \ - libssl-dev gettext unzip zlib1g-dev file python - -Debian 9 Stretch: - - sudo apt-get install build-essential libncurses5-dev gawk git subversion \ - libssl-dev gettext zlib1g-dev - -Centos x86-64 (some packages require EPEL): - - yum install subversion binutils bzip2 gcc gcc-c++ gawk gettext flex \ - ncurses-devel zlib-devel zlib-static make patch unzip glibc glibc-devel \ - perl-ExtUtils-MakeMaker glibc-static quilt ncurses-libs sed sdcc bison \ - intltool sharutils wget git-core openssl-devel xz - -Fedora 24 - 64Bit: - - dnf install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext git-core \ - unzip ncurses-devel ncurses-compat-libs zlib-devel zlib-static make \ - flex patch perl-ExtUtils-MakeMaker perl-Thread-Queue glibc glibc-devel \ - glibc-static quilt sed sdcc intltool sharutils bison wget openssl-devel - - -Get LEDE Sources (from Git) ---------------------------- - -LEDE and OpenWRT is planned to remerge and won't cover the similar OpenWRT build -As normal user: - git clone https://git.lede-project.org/source.git lede - cd lede - ./scripts/feeds update -a - ./scripts/feeds install -a - cd feeds/routing - git pull origin pull/319/head - ln -s ../../../feeds/routing/frr/ ../../package/feeds/routing/ - cd ../.. - make menuconfig - -Select the needed target then select needed packages in -Network -> Routing and Redirection -> frr, exit and save - - make or make package/frr/compile - -It may be possible that on first build `make package/frr/compile` not to work -and it may be needed to run a `make` for the entire build envronment, add V=s -for debugging - -Work with sources ------------------ - -To update the rc1 version or add other options, the Makefile is found in -feeds/routing/frr - -edit: - PKG_VERSION:= - PKG_SOURCE_VERSION:=<git-hash> - -Usage ------ - -Edit `/usr/sbin/frr.init` and add/remove the daemons name in section DAEMONS= -or don't install unneded packages -For example: zebra bgpd ldpd isisd nhrpd ospfd ospf6d pimd ripd ripngd - -### Enable the serivce - - service frr enable - -### Start the service - - service frr start diff --git a/doc/Makefile.am b/doc/Makefile.am index 9c81202db..aeabc0981 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,194 +1,258 @@ ## Process this file with automake to produce Makefile.in. -# Dia, the version i have at least, doesn't do very good EPS output -# (some of the text is scaled strangely). So this will work, but -# it is probably better to use something like gimp to convert the -# dia exported PNG files to EPS manually. +# Pass down make invocation to each subdirectory. # -# Here we use 'convert' from the well known 'ImageMagick' package -# to do conversion from png to eps/pdf for figures. -# PDF form is required for frr.pdf, using PDFTex at least. +# Each of these directories contains a Sphinx-generated Makefile that has been +# modified to implement all the targets required by Automake, as documented in +# the 'Third-Party Makefiles' section of the Automake docs. # -# TeX implementation, which we depend on already anyway. -# -# dia -> (dia) -> png -> (convert) -> eps -> (epstopdf) -> pdf -SUFFIXES = .png .eps .dia .pdf -DIATOPNG = dia -t png -e -DIATOEPS = dia -t eps -e -PNGTOEPS = convert -antialias -contrast -despeckle -PNGTOPDF = $(PNGTOEPS) -EPSTOPDF = epstopdf - -VNCFIGURES_PNG = -VNCFIGURES_DIA = -vnc-mesh -vnc-frr-route-reflector \ --vnc-commercial-route-reflector -vnc-redundant-route-reflectors \ --vnc-gw -vnc-gw-rr - -# TODO: A target that creates an empty text file for each member of -# VNCFIGURES_TXT -VNCFIGURES_TXT = $(VNCFIGURES:%.png=%.txt) - -# The figure sources -figures_names_parts = -normal-processing -rs-processing \ - _topologies_full _topologies_rs \ - $(VNCFIGURES_DIA) - -figures_sources = $(figures_names_parts:%=fig%.dia) -figures_png = $(figures_names_parts:%=fig%.png) $(VNCFIGURES_PNG) -figures_pdf = $(figures_names_parts:%=fig%.pdf) $(VNCFIGURES_PNG:%.png=%.pdf) -figures_eps = $(figures_names_parts:%=fig%.eps) $(VNCFIGURES_PNG:%.png=%.eps) -figures_txt = $(figures_names_parts:%=fig%.txt) - -# rather twisted logic because we have to build PDFs of the EPS figures for -# PDFTex and yet build one PDF, frr.pdf, from texi source. Which means we -# cant rely on a single automatic rule for *.pdf, eg the one automatically -# provided by automake. If you are an automake wizard, please feel free to -# compact it somehow. - -info_TEXINFOS = frr.texi - -# Have to manually specify the frr.pdf rule in order to allow -# us to have a generic automatic .pdf rule to build the figure sources -# because it cant just work from the png's directly it seems - contrary -# to the documentation... -frr.pdf: $(info_TEXINFOS) $(figures_pdf) $(frr_TEXINFOS) defines.texi - $(TEXI2PDF) -o "$@" $< || true - -# don't ask me why the info file is in srcdir -$(srcdir)/frr.info: $(frr_TEXINFOS) defines.texi -frr.dvi: $(frr_TEXINFOS) defines.texi -frr.html: $(frr_TEXINFOS) defines.texi - -frr_TEXINFOS = \ - appendix.texi \ - basic.texi \ - bgpd.texi \ - isisd.texi \ - filter.texi \ - vnc.texi \ - babeld.texi \ - install.texi \ - ipv6.texi \ - kernel.texi \ - main.texi \ - nhrpd.texi \ - eigrpd.texi \ - ospf6d.texi \ - ospfd.texi \ - overview.texi \ - protocol.texi \ - ripd.texi \ - ripngd.texi \ - routemap.texi \ - snmp.texi \ - vtysh.texi \ - routeserver.texi \ - $(figures_png) \ - snmptrap.texi \ - ospf_fundamentals.texi \ - isisd.texi $(figures_txt) \ - rpki.texi \ - pimd.texi \ - #END - -.png.eps: - $(PNGTOEPS) $< "$@" - -.png.pdf: - $(PNGTOPDF) $< "$@" - -.dia.png: - $(DIATOPNG) "$@" $< - -man_MANS = frr.1 frr-args.8 +# Note the absence of the 'developer' directory here; development docs are +# never built as part of a regular build. They are only built when explicitly +# asked for. See comment further down. + +# Sphinx is not designed to be invoked multiple times against the same toctree. +.NOTPARALLEL: + +SUBDIRS = manpages user +AM_MAKEFLAGS = DESTDIR=${DESTDIR} infodir=${infodir} doczdir=${abs_srcdir} + +MANPAGE_BUILDDIR = manpages/_build/man + +# This is a hack, see comment further down. +man_MANS = $(MANPAGE_BUILDDIR)/frr.1 if PIMD -man_MANS += pimd.8 -man_MANS += mtracebis.8 +man_MANS += $(MANPAGE_BUILDDIR)/pimd.8 +man_MANS += $(MANPAGE_BUILDDIR)/mtracebis.8 endif if BGPD -man_MANS += bgpd.8 +man_MANS += $(MANPAGE_BUILDDIR)/bgpd.8 endif if ISISD -man_MANS += isisd.8 +man_MANS += $(MANPAGE_BUILDDIR)/isisd.8 endif if OSPF6D -man_MANS += ospf6d.8 +man_MANS += $(MANPAGE_BUILDDIR)/ospf6d.8 endif if OSPFCLIENT -man_MANS += ospfclient.8 +man_MANS += $(MANPAGE_BUILDDIR)/ospfclient.8 endif if OSPFD -man_MANS += ospfd.8 +man_MANS += $(MANPAGE_BUILDDIR)/ospfd.8 endif if LDPD -man_MANS += ldpd.8 +man_MANS += $(MANPAGE_BUILDDIR)/ldpd.8 endif if RIPD -man_MANS += ripd.8 +man_MANS += $(MANPAGE_BUILDDIR)/ripd.8 endif if RIPNGD -man_MANS += ripngd.8 +man_MANS += $(MANPAGE_BUILDDIR)/ripngd.8 endif if NHRPD -man_MANS += nhrpd.8 +man_MANS += $(MANPAGE_BUILDDIR)/nhrpd.8 endif if VTYSH -man_MANS += vtysh.1 +man_MANS += $(MANPAGE_BUILDDIR)/vtysh.1 endif if WATCHFRR -man_MANS += watchfrr.8 +man_MANS += $(MANPAGE_BUILDDIR)/watchfrr.8 endif if ZEBRA -man_MANS += zebra.8 +man_MANS += $(MANPAGE_BUILDDIR)/zebra.8 endif if EIGRPD -man_MANS += eigrpd.8 +man_MANS += $(MANPAGE_BUILDDIR)/eigrpd.8 endif -EXTRA_DIST = BGP-TypeCode draft-zebra-00.ms draft-zebra-00.txt \ - \ - bgpd.8.in \ - isisd.8.in \ - ospf6d.8.in \ - ospfclient.8.in \ - ospfd.8.in \ - ldpd.8.in \ - ripd.8.in \ - ripngd.8.in \ - pimd.8.in \ - mtracebis.8.in \ - nhrpd.8.in \ - vtysh.1.in \ - watchfrr.8.in \ - zebra.8.in \ - frr.1.in \ - eigrpd.8.in \ - \ - mpls/ChangeLog.opaque.txt mpls/cli_summary.txt \ - mpls/opaque_lsa.txt mpls/ospfd.conf \ - $(figures_sources) $(figures_png) $(figures_txt) - -draft-zebra-00.txt: draft-zebra-00.ms - groff -T ascii -ms $< > $@ - -# Ensure that all of the figures are copied into the html directory -html-local: $(HTMLS) - if test -d $(HTMLS) ; then \ - cp -p $(figures_png) $(HTMLS) ; \ - else \ - echo "$(HTMLS) is not a directory. Make it so, the rerun make."; \ - fi +# Automake is particular about manpages. It is aware of them and has some +# special facilities for handling them, but it assumes that manpages are always +# given in groff source and so these facilities are limited to simply +# specifying the path to the groff sources in a special variable. There is no +# target for building manpages that can be extended, as there are for pdf, +# html, dvi, etc. Unfortunately this leaves us with hijacking the +# 'install-data' and 'all' targets in the 3rd-party Makefile in manpages/ to +# make sure manpages are always built, and then using the special Automake +# variable defined above in order to take advantage of automatic installation. +# +# However, it is conceivable that someone may want to build just the manpages, +# so here's an explicit target for that. +man: + $(MAKE) -C manpages man + +# Automake automatically defines targets for various document formats. All of +# the child 3rd-party Makefiles are aware of all Automake targets and implement +# the ones we are interested in. +# +# The SUBDIRS variable at the top of this Makefile.am causes the following +# implicit Automake targets to only build user documentation, and not developer +# documentation: +# - info +# - html +# - pdf +# +# If you wish to build developer documentation, use these targets: +developer-info: + $(MAKE) -C developer info + +developer-pdf: + $(MAKE) -C developer latexpdf + +developer-html: + $(MAKE) -C developer html + +# If you want to build the developer's docs in other formats, try the +# following: +# +# $ cd developer +# $ make help + +# dist tarballs want doc sources +EXTRA_DIST = frr-sphinx.mk \ + manpages/defines.rst \ + manpages/ldpd.rst \ + manpages/index.rst \ + manpages/bgpd.rst \ + manpages/watchfrr.rst \ + manpages/ospfclient.rst \ + manpages/ripd.rst \ + manpages/zebra.rst \ + manpages/epilogue.rst \ + manpages/eigrpd.rst \ + manpages/isisd.rst \ + manpages/ospf6d.rst \ + manpages/common-options.rst \ + manpages/ospfd.rst \ + manpages/vtysh.rst \ + manpages/nhrpd.rst \ + manpages/pimd.rst \ + manpages/mtracebis.rst \ + manpages/ripngd.rst \ + manpages/frr.rst \ + manpages/conf.py \ + manpages/Makefile \ + developer/Building_FRR_on_NetBSD7.rst \ + developer/ldpd-basic-test-setup.md \ + developer/cli.rst \ + developer/index.rst \ + developer/library.rst \ + developer/memtypes.rst \ + developer/bgpd.rst \ + developer/draft-zebra-00.ms \ + developer/dev-modules.md \ + developer/conf.py \ + developer/next-hop-tracking.rst \ + developer/Building_FRR_on_FreeBSD11.rst \ + developer/building.rst \ + developer/Building_FRR_on_CentOS6.rst \ + developer/Building_FRR_on_Ubuntu1604.rst \ + developer/ospf-api.rst \ + developer/ospf-sr.rst \ + developer/Building_FRR_on_OpenBSD6.rst \ + developer/Building_FRR_on_Debian8.rst \ + developer/Building_FRR_on_NetBSD6.rst \ + developer/Building_FRR_on_Debian9.rst \ + developer/Building_FRR_on_LEDE-OpenWRT.rst \ + developer/modules.rst \ + developer/Building_FRR_on_FreeBSD10.rst \ + developer/Building_FRR_on_Ubuntu1204.rst \ + developer/Building_FRR_on_Fedora24.rst \ + developer/Makefile \ + developer/Building_FRR_on_FreeBSD9.rst \ + developer/BGP-TypeCode \ + developer/Building_FRR_on_OmniOS.rst \ + developer/Building_FRR_on_CentOS7.rst \ + developer/hooks.rst \ + developer/OSPF-API.md \ + developer/workflow.rst \ + developer/Building_FRR_on_Ubuntu1404.rst \ + user/ospf_fundamentals.rst \ + user/routemap.rst \ + user/index.rst \ + user/conf.py \ + user/ipv6.rst \ + user/ripd.rst \ + user/vnc.rst \ + user/zebra.rst \ + user/installation.rst \ + user/overview.rst \ + user/protocol.rst \ + user/eigrpd.rst \ + user/rpki.rst \ + user/kernel.rst \ + user/isisd.rst \ + user/ospf6d.rst \ + user/Useful_Sysctl_Settings.md \ + user/basic.rst \ + user/ospfd.rst \ + user/vtysh.rst \ + user/filter.rst \ + user/nhrpd.rst \ + user/Makefile \ + user/routeserver.rst \ + user/appendix.rst \ + user/bgp.rst \ + user/babeld.rst \ + user/snmp.rst \ + user/pim.rst \ + user/ripngd.rst \ + user/snmptrap.rst \ + user/glossary.rst \ + mpls/ChangeLog.opaque.txt \ + mpls/ospfd.conf \ + mpls/cli_summary.txt \ + mpls/opaque_lsa.txt \ + figures/frr-logo.png \ + figures/fig-vnc-commercial-route-reflector.dia \ + figures/ospf_api_msghdr.png \ + figures/fig-normal-processing.txt \ + figures/fig-vnc-gw-rr.txt \ + figures/fig-vnc-mesh.dia \ + figures/frr-logo-medium.png \ + figures/git_branches.svg \ + figures/fig-vnc-commercial-route-reflector.txt \ + figures/fig_topologies_rs.txt \ + figures/git_branches.png \ + figures/fig-vnc-mesh.txt \ + figures/ospf_api_msgs1.png \ + figures/fig-vnc-redundant-route-reflectors.txt \ + figures/fig-vnc-commercial-route-reflector.png \ + figures/fig-vnc-gw.png \ + figures/fig_topologies_rs.png \ + figures/fig_topologies_full.txt \ + figures/fig-vnc-frr-route-reflector.txt \ + figures/fig-normal-processing.dia \ + figures/fig-vnc-redundant-route-reflectors.png \ + figures/fig-vnc-frr-route-reflector.dia \ + figures/fig_topologies_full.png \ + figures/fig-vnc-redundant-route-reflectors.dia \ + figures/fig-normal-processing.png \ + figures/fig-rs-processing.dia \ + figures/ospf_api_msgs2.png \ + figures/fig-vnc-gw.dia \ + figures/fig-rs-processing.txt \ + figures/frr-logo-icon.png \ + figures/ospf_api_architecture.png \ + figures/fig-vnc-gw.txt \ + figures/fig-rs-processing.png \ + figures/frr-icon.svg \ + figures/fig_topologies_rs.dia \ + figures/fig-vnc-frr-route-reflector.png \ + figures/fig-vnc-gw-rr.png \ + figures/fig-vnc-gw-rr.dia \ + figures/fig_topologies_full.dia \ + figures/frr-logo-small.png \ + figures/fig-vnc-mesh.png diff --git a/doc/appendix.texi b/doc/appendix.texi deleted file mode 100644 index 2e1c9deb1..000000000 --- a/doc/appendix.texi +++ /dev/null @@ -1,257 +0,0 @@ -@node Packet Binary Dump Format -@appendix Packet Binary Dump Format - - FRR can dump routing protocol packet into file with a binary format -(@pxref{Dump BGP packets and table}). - - It seems to be better that we share the MRT's header format for -backward compatibility with MRT's dump logs. We should also define the -binary format excluding the header, because we must support both IP -v4 and v6 addresses as socket addresses and / or routing entries. - - In the last meeting, we discussed to have a version field in the -header. But Masaki told us that we can define new `type' value rather -than having a `version' field, and it seems to be better because we -don't need to change header format. - - Here is the common header format. This is same as that of MRT. - -@example -@group -0 1 2 3 -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Time | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Type | Subtype | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Length | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - - If `type' is PROTOCOL_BGP4MP_ET, the common header format will -contain an additional microsecond field (RFC6396 2011). - -@example -@group -0 1 2 3 -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Time | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Type | Subtype | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Length | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Microsecond | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - - If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE, and -Address Family == IP (version 4) - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source AS number | Destination AS number | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Interface Index | Address Family | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Old State | New State | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - -Where State is the value defined in RFC1771. - -If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_STATE_CHANGE, -and Address Family == IP version 6 - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source AS number | Destination AS number | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Interface Index | Address Family | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Old State | New State | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - -If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE, -and Address Family == IP (version 4) - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source AS number | Destination AS number | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Interface Index | Address Family | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| BGP Message Packet | -| | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - -Where BGP Message Packet is the whole contents of the -BGP4 message including header portion. - -If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_MESSAGE, -and Address Family == IP version 6 - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source AS number | Destination AS number | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Interface Index | Address Family | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Source IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Destination IP address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| BGP Message Packet | -| | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - -If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY, -and Address Family == IP (version 4) - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| View # | Status | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Time Last Change | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Address Family | SAFI | Next-Hop-Len | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Next Hop Address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Prefix Length | Address Prefix [variable] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Attribute Length | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| BGP Attribute [variable length] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - -If `type' is PROTOCOL_BGP4MP, `subtype' is BGP4MP_ENTRY, -and Address Family == IP version 6 - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| View # | Status | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Time Last Change | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Address Family | SAFI | Next-Hop-Len | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Next Hop Address | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Next Hop Address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Next Hop Address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Next Hop Address (Cont'd) | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Prefix Length | Address Prefix [variable] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Address Prefix (cont'd) [variable] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| Attribute Length | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| BGP Attribute [variable length] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - - BGP4 Attribute must not contain MP_UNREACH_NLRI. - If BGP Attribute has MP_REACH_NLRI field, it must has - zero length NLRI, e.g., MP_REACH_NLRI has only Address - Family, SAFI and next-hop values. - -If `type' is PROTOCOL_BGP4MP and `subtype' is BGP4MP_SNAPSHOT, - -@example -@group - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| View # | File Name [variable] | -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -@end group -@end example - - The file specified in "File Name" contains all routing entries, - which are in the format of ``subtype == BGP4MP_ENTRY''. - -@example -@group -Constants: - /* type value */ - #define MSG_PROTOCOL_BGP4MP 16 - #define MSG_PROTOCOL_BGP4MP_ET 17 - /* subtype value */ - #define BGP4MP_STATE_CHANGE 0 - #define BGP4MP_MESSAGE 1 - #define BGP4MP_ENTRY 2 - #define BGP4MP_SNAPSHOT 3 -@end group -@end example diff --git a/doc/babeld.texi b/doc/babeld.texi deleted file mode 100644 index 341f69286..000000000 --- a/doc/babeld.texi +++ /dev/null @@ -1,212 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the FRR Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node Babel -@chapter Babel - -Babel is an interior gateway protocol that is suitable both for wired -networks and for wireless mesh networks. Babel has been described as -``RIP on speed'' --- it is based on the same principles as RIP, but -includes a number of refinements that make it react much faster to -topology changes without ever counting to infinity, and allow it to -perform reliable link quality estimation on wireless links. Babel is -a double-stack routing protocol, meaning that a single Babel instance -is able to perform routing for both IPv4 and IPv6. - -FRR implements Babel as described in RFC6126. - -@menu -* Configuring babeld:: -* Babel configuration:: -* Babel redistribution:: -* Show Babel information:: -* Babel debugging commands:: -@end menu - -@node Configuring babeld, Babel configuration, Babel, Babel -@section Configuring babeld - -The @command{babeld} daemon can be invoked with any of the common -options (@pxref{Common Invocation Options}). - -The @command{zebra} daemon must be running before @command{babeld} is -invoked. Also, if @command{zebra} is restarted then @command{babeld} -must be too. - -Configuration of @command{babeld} is done in its configuration file -@file{babeld.conf}. - -@node Babel configuration, Babel redistribution, Configuring babeld, Babel -@section Babel configuration - -@deffn Command {router babel} {} -@deffnx Command {no router babel} {} -Enable or disable Babel routing. -@end deffn - -@deffn Command {babel resend-delay <20-655340>} {} -Specifies the time after which important messages are resent when -avoiding a black-hole. The default is 2000@dmn{ms}. -@end deffn - -@deffn Command {babel diversity} {} -@deffnx Command {no babel diversity} {} -Enable or disable routing using radio frequency diversity. This is -highly recommended in networks with many wireless nodes. - -If you enable this, you will probably want to set @code{babel -diversity-factor} and @code{babel channel} below. -@end deffn - -@deffn Command {babel diversity-factor <1-256>} {} -Sets the multiplicative factor used for diversity routing, in units of -1/256; lower values cause diversity to play a more important role in -route selection. The default it 256, which means that diversity plays -no role in route selection; you will probably want to set that to 128 -or less on nodes with multiple independent radios. -@end deffn - -@deffn {Babel Command} {network @var{ifname}} {} -@deffnx {Babel Command} {no network @var{ifname}} {} -Enable or disable Babel on the given interface. -@end deffn - -@deffn {Interface Command} {babel wired} {} -@deffnx {Interface Command} {babel wireless} {} -Specifies whether this interface is wireless, which disables a number -of optimisations that are only correct on wired interfaces. -Specifying @code{wireless} (the default) is always correct, but may -cause slower convergence and extra routing traffic. -@end deffn - -@deffn {Interface Command} {babel split-horizon} -@deffnx {Interface Command} {no babel split-horizon} -Specifies whether to perform split-horizon on the interface. -Specifying @code{no babel split-horizon} is always correct, while -@code{babel split-horizon} is an optimisation that should only be used -on symmetric and transitive (wired) networks. The default is -@code{babel split-horizon} on wired interfaces, and @code{no babel -split-horizon} on wireless interfaces. This flag is reset when the -wired/wireless status of an interface is changed. -@end deffn - -@deffn {Interface Command} {babel hello-interval <20-655340>} -Specifies the time in milliseconds between two scheduled hellos. On -wired links, Babel notices a link failure within two hello intervals; -on wireless links, the link quality value is reestimated at every -hello interval. The default is 4000@dmn{ms}. -@end deffn - -@deffn {Interface Command} {babel update-interval <20-655340>} -Specifies the time in milliseconds between two scheduled updates. -Since Babel makes extensive use of triggered updates, this can be set -to fairly high values on links with little packet loss. The default -is 20000@dmn{ms}. -@end deffn - -@deffn {Interface Command} {babel channel <1-254>} -@deffnx {Interface Command} {babel channel interfering} -@deffnx {Interface Command} {babel channel noninterfering} -Set the channel number that diversity routing uses for this interface -(see @code{babel diversity} above). Noninterfering interfaces are -assumed to only interfere with themselves, interfering interfaces are -assumed to interfere with all other channels except noninterfering -channels, and interfaces with a channel number interfere with -interfering interfaces and interfaces with the same channel number. -The default is @samp{babel channel interfering} for wireless -interfaces, and @samp{babel channel noninterfering} for wired -interfaces. This is reset when the wired/wireless status of an -interface is changed. -@end deffn - -@deffn {Interface Command} {babel rxcost <1-65534>} -Specifies the base receive cost for this interface. For wireless -interfaces, it specifies the multiplier used for computing the ETX -reception cost (default 256); for wired interfaces, it specifies the -cost that will be advertised to neighbours. This value is reset when -the wired/wireless attribute of the interface is changed. - -Do not use this command unless you know what you are doing; in most -networks, acting directly on the cost using route maps is a better -technique. -@end deffn - -@deffn {Interface Command} {babel rtt-decay <1-256>} -This specifies the decay factor for the exponential moving average of -RTT samples, in units of 1/256. Higher values discard old samples -faster. The default is 42. -@end deffn - -@deffn {Interface Command} {babel rtt-min <1-65535>} -This specifies the minimum RTT, in milliseconds, starting from which we -increase the cost to a neighbour. The additional cost is linear in (rtt -- rtt-min ). The default is 10@dmn{ms}. -@end deffn - -@deffn {Interface Command} {babel rtt-max <1-65535>} -This specifies the maximum RTT, in milliseconds, above which we don't -increase the cost to a neighbour. The default is 120@dmn{ms}. -@end deffn - -@deffn {Interface Command} {babel max-rtt-penalty <0-65535>} -This specifies the maximum cost added to a neighbour because of RTT, -i.e. when the RTT is higher or equal than rtt-max. The default is 0, -which effectively disables the use of a RTT-based cost. -@end deffn - -@deffn {Interface Command} {babel enable-timestamps} -@deffnx {Interface Command} {no babel enable-timestamps} -Enable or disable sending timestamps with each Hello and IHU message in -order to compute RTT values. The default is @code{no babel -enable-timestamps}. -@end deffn - -@deffn {Babel Command} {babel resend-delay <20-655340>} -Specifies the time in milliseconds after which an ``important'' -request or update will be resent. The default is 2000@dmn{ms}. You -probably don't want to tweak this value. -@end deffn - -@deffn {Babel Command} {babel smoothing-half-life <0-65534>} -Specifies the time constant, in seconds, of the smoothing algorithm -used for implementing hysteresis. Larger values reduce route -oscillation at the cost of very slightly increasing convergence time. -The value 0 disables hysteresis, and is suitable for wired networks. -The default is 4@dmn{s}. -@end deffn - -@node Babel redistribution, Show Babel information, Babel configuration, Babel -@section Babel redistribution - -@deffn {Babel command} {redistribute @var{<ipv4|ipv6>} @var{kind}} -@deffnx {Babel command} {no redistribute @var{<ipv4|ipv6>} @var{kind}} -Specify which kind of routes should be redistributed into Babel. -@end deffn - -@node Show Babel information, Babel debugging commands, Babel redistribution, Babel -@section Show Babel information - -@deffn {Command} {show babel route} {} -@deffnx {Command} {show babel route A.B.C.D} -@deffnx {Command} {show babel route X:X::X:X} -@deffnx {Command} {show babel route A.B.C.D/M} -@deffnx {Command} {show babel route X:X::X:X/M} -@deffnx {Command} {show babel interface} {} -@deffnx {Command} {show babel interface @var{ifname}} {} -@deffnx {Command} {show babel neighbor} {} -@deffnx {Command} {show babel parameters} {} -These commands dump various parts of @command{babeld}'s internal state. -@end deffn - -@node Babel debugging commands, , Show Babel information, Babel -@section Babel debugging commands - -@deffn {Babel Command} {debug babel @var{kind}} {} -@deffnx {Babel Command} {no debug babel @var{kind}} {} -Enable or disable debugging messages of a given kind. @var{kind} can -be one of @samp{common}, @samp{kernel}, @samp{filter}, @samp{timeout}, -@samp{interface}, @samp{route} or @samp{all}. Note that if you have -compiled with the NO_DEBUG flag, then these commands aren't available. -@end deffn - diff --git a/doc/basic.texi b/doc/basic.texi deleted file mode 100644 index 6e43210bb..000000000 --- a/doc/basic.texi +++ /dev/null @@ -1,642 +0,0 @@ -@node Basic commands -@chapter Basic commands - -There are five routing daemons in use, and there is one manager daemon. -These daemons may be located on separate machines from the manager -daemon. Each of these daemons will listen on a particular port for -incoming VTY connections. The routing daemons are: - -@itemize @bullet -@item @command{ripd}, @command{ripngd}, @command{ospfd}, @command{ospf6d}, @command{bgpd} -@item @command{zebra} -@end itemize - -The following sections discuss commands common to all the routing -daemons. - -@menu -* Config Commands:: Commands used in config files -* Terminal Mode Commands:: Common commands used in a VTY -* Common Invocation Options:: Starting the daemons -* Loadable Module Support:: Using extension modules -* Virtual Terminal Interfaces:: Interacting with the daemons -@end menu - - - -@node Config Commands -@section Config Commands - -@cindex Configuration files for running the software -@c A -not configuration files for installing the software -@cindex Files for running configurations -@cindex Modifying the herd's behavior -@cindex Getting the herd running - - -@menu -* Basic Config Commands:: Some of the generic config commands -* Sample Config File:: An example config file -@end menu - - -In a config file, you can write the debugging options, a vty's password, -routing daemon configurations, a log file name, and so forth. This -information forms the initial command set for a routing beast as it is -starting. - -Config files are generally found in: - -@itemize @w{} -@item @file{@value{INSTALL_PREFIX_ETC}/*.conf} -@end itemize - -Each of the daemons has its own -config file. For example, zebra's default config file name is: - -@itemize @w{} -@item @file{@value{INSTALL_PREFIX_ETC}/zebra.conf} -@end itemize - -The daemon name plus @file{.conf} is the default config file name. You -can specify a config file using the @kbd{-f} or @kbd{--config-file} -options when starting the daemon. - - - -@node Basic Config Commands -@subsection Basic Config Commands - -@deffn Command {hostname @var{hostname}} {} -Set hostname of the router. -@end deffn - -@deffn Command {password @var{password}} {} -Set password for vty interface. If there is no password, a vty won't -accept connections. -@end deffn - -@deffn Command {enable password @var{password}} {} -Set enable password. -@end deffn - -@deffn Command {log trap @var{level}} {} -@deffnx Command {no log trap} {} -These commands are deprecated and are present only for historical compatibility. -The log trap command sets the current logging level for all enabled -logging destinations, and it sets the default for all future logging commands -that do not specify a level. The normal default -logging level is debugging. The @code{no} form of the command resets -the default level for future logging commands to debugging, but it does -not change the logging level of existing logging destinations. -@end deffn - - -@deffn Command {log stdout} {} -@deffnx Command {log stdout @var{level}} {} -@deffnx Command {no log stdout} {} -Enable logging output to stdout. -If the optional second argument specifying the -logging level is not present, the default logging level (typically debugging, -but can be changed using the deprecated @code{log trap} command) will be used. -The @code{no} form of the command disables logging to stdout. -The @code{level} argument must have one of these values: -emergencies, alerts, critical, errors, warnings, notifications, informational, or debugging. Note that the existing code logs its most important messages -with severity @code{errors}. -@end deffn - -@deffn Command {log file @var{filename}} {} -@deffnx Command {log file @var{filename} @var{level}} {} -@deffnx Command {no log file} {} -If you want to log into a file, please specify @code{filename} as -in this example: -@example -log file /var/log/frr/bgpd.log informational -@end example -If the optional second argument specifying the -logging level is not present, the default logging level (typically debugging, -but can be changed using the deprecated @code{log trap} command) will be used. -The @code{no} form of the command disables logging to a file. - -Note: if you do not configure any file logging, and a daemon crashes due -to a signal or an assertion failure, it will attempt to save the crash -information in a file named /var/tmp/frr.<daemon name>.crashlog. -For security reasons, this will not happen if the file exists already, so -it is important to delete the file after reporting the crash information. -@end deffn - -@deffn Command {log syslog} {} -@deffnx Command {log syslog @var{level}} {} -@deffnx Command {no log syslog} {} -Enable logging output to syslog. -If the optional second argument specifying the -logging level is not present, the default logging level (typically debugging, -but can be changed using the deprecated @code{log trap} command) will be used. -The @code{no} form of the command disables logging to syslog. -@end deffn - -@deffn Command {log monitor} {} -@deffnx Command {log monitor @var{level}} {} -@deffnx Command {no log monitor} {} -Enable logging output to vty terminals that have enabled logging -using the @code{terminal monitor} command. -By default, monitor logging is enabled at the debugging level, but this -command (or the deprecated @code{log trap} command) can be used to change -the monitor logging level. -If the optional second argument specifying the -logging level is not present, the default logging level (typically debugging, -but can be changed using the deprecated @code{log trap} command) will be used. -The @code{no} form of the command disables logging to terminal monitors. -@end deffn - -@deffn Command {log facility @var{facility}} {} -@deffnx Command {no log facility} {} -This command changes the facility used in syslog messages. The default -facility is @code{daemon}. The @code{no} form of the command resets -the facility to the default @code{daemon} facility. -@end deffn - -@deffn Command {log record-priority} {} -@deffnx Command {no log record-priority} {} -To include the severity in all messages logged to a file, to stdout, or to -a terminal monitor (i.e. anything except syslog), -use the @code{log record-priority} global configuration command. -To disable this option, use the @code{no} form of the command. By default, -the severity level is not included in logged messages. Note: some -versions of syslogd (including Solaris) can be configured to include -the facility and level in the messages emitted. -@end deffn - -@deffn Command {log timestamp precision @var{<0-6>}} {} -@deffnx Command {no log timestamp precision} {} -This command sets the precision of log message timestamps to the -given number of digits after the decimal point. Currently, -the value must be in the range 0 to 6 (i.e. the maximum precision -is microseconds). -To restore the default behavior (1-second accuracy), use the -@code{no} form of the command, or set the precision explicitly to 0. - -@example -@group -log timestamp precision 3 -@end group -@end example - -In this example, the precision is set to provide timestamps with -millisecond accuracy. -@end deffn - -@deffn Command {log commands} {} -This command enables the logging of all commands typed by a user to -all enabled log destinations. The note that logging includes full -command lines, including passwords. Once set, command logging can only -be turned off by restarting the daemon. -@end deffn - -@deffn Command {service password-encryption} {} -Encrypt password. -@end deffn - -@deffn Command {service advanced-vty} {} -Enable advanced mode VTY. -@end deffn - -@deffn Command {service terminal-length @var{<0-512>}} {} -Set system wide line configuration. This configuration command applies -to all VTY interfaces. -@end deffn - -@deffn Command {line vty} {} -Enter vty configuration mode. -@end deffn - -@deffn Command {banner motd default} {} -Set default motd string. -@end deffn - -@deffn Command {no banner motd} {} -No motd banner string will be printed. -@end deffn - -@deffn {Line Command} {exec-timeout @var{minute}} {} -@deffnx {Line Command} {exec-timeout @var{minute} @var{second}} {} -Set VTY connection timeout value. When only one argument is specified -it is used for timeout value in minutes. Optional second argument is -used for timeout value in seconds. Default timeout value is 10 minutes. -When timeout value is zero, it means no timeout. -@end deffn - -@deffn {Line Command} {no exec-timeout} {} -Do not perform timeout at all. This command is as same as -@command{exec-timeout 0 0}. -@end deffn - -@deffn {Line Command} {access-class @var{access-list}} {} -Restrict vty connections with an access list. -@end deffn - -@node Sample Config File -@subsection Sample Config File - - -Below is a sample configuration file for the zebra daemon. - -@example -@group -! -! Zebra configuration file -! -hostname Router -password zebra -enable password zebra -! -log stdout -! -! -@end group -@end example - -'!' and '#' are comment characters. If the first character of the word -is one of the comment characters then from the rest of the line forward -will be ignored as a comment. - -@example -password zebra!password -@end example - -If a comment character is not the first character of the word, it's a -normal character. So in the above example '!' will not be regarded as a -comment and the password is set to 'zebra!password'. - - - -@node Terminal Mode Commands -@section Terminal Mode Commands - -@deffn Command {write terminal} {} -Displays the current configuration to the vty interface. -@end deffn - -@deffn Command {write file} {} -Write current configuration to configuration file. -@end deffn - -@deffn Command {configure terminal} {} -Change to configuration mode. This command is the first step to -configuration. -@end deffn - -@deffn Command {terminal length @var{<0-512>}} {} -Set terminal display length to @var{<0-512>}. If length is 0, no -display control is performed. -@end deffn - -@deffn Command {who} {} -Show a list of currently connected vty sessions. -@end deffn - -@deffn Command {list} {} -List all available commands. -@end deffn - -@deffn Command {show version} {} -Show the current version of @value{PACKAGE_NAME} and its build host information. -@end deffn - -@deffn Command {show logging} {} -Shows the current configuration of the logging system. This includes -the status of all logging destinations. -@end deffn - -@deffn Command {logmsg @var{level} @var{message}} {} -Send a message to all logging destinations that are enabled for messages -of the given severity. -@end deffn - - - - -@node Common Invocation Options -@section Common Invocation Options -@c COMMON_OPTIONS -@c OPTIONS section of the man page - -These options apply to all @value{PACKAGE_NAME} daemons. - -@table @samp - -@item -d -@itemx --daemon -Runs in daemon mode. - -@item -f @var{file} -@itemx --config_file=@var{file} -Set configuration file name. - -@item -h -@itemx --help -Display this help and exit. - -@item -i @var{file} -@itemx --pid_file=@var{file} - -Upon startup the process identifier of the daemon is written to a file, -typically in @file{/var/run}. This file can be used by the init system -to implement commands such as @command{@dots{}/init.d/zebra status}, -@command{@dots{}/init.d/zebra restart} or @command{@dots{}/init.d/zebra -stop}. - -The file name is an run-time option rather than a configure-time option -so that multiple routing daemons can be run simultaneously. This is -useful when using @value{PACKAGE_NAME} to implement a routing looking glass. One -machine can be used to collect differing routing views from differing -points in the network. - -@item -A @var{address} -@itemx --vty_addr=@var{address} -Set the VTY local address to bind to. If set, the VTY socket will only -be bound to this address. - -@item -P @var{port} -@itemx --vty_port=@var{port} -Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not -be opened. - -@item -u @var{user} -@itemx --vty_addr=@var{user} -Set the user and group to run as. - -@item -v -@itemx --version -Print program version. - -@end table - - -@node Loadable Module Support -@section Loadable Module Support - -FRR supports loading extension modules at startup. Loading, reloading or -unloading modules at runtime is not supported (yet). To load a module, use -the following command line option at daemon startup: - -@table @samp -@item -M @var{module:options} -@itemx --module @var{module:options} - -Load the specified module, optionally passing options to it. If the module -name contains a slash (/), it is assumed to be a full pathname to a file to -be loaded. If it does not contain a slash, the -@code{@value{INSTALL_PREFIX_MODULES}} directory is searched for a module of -the given name; first with the daemon name prepended (e.g. @code{zebra_mod} -for @code{mod}), then without the daemon name prepended. - -This option is available on all daemons, though some daemons may not have -any modules available to be loaded. -@end table - - -@subsection The SNMP Module - -If SNMP is enabled during compile-time and installed as part of the package, -the @code{snmp} module can be loaded for the @command{zebra}, -@command{bgpd}, @command{ospfd}, @command{ospf6d} and @command{ripd} daemons. - -The module ignores any options passed to it. Refer to @ref{SNMP Support} -for information on its usage. - - -@subsection The FPM Module - -If FPM is enabled during compile-time and installed as part of the package, -the @code{fpm} module can be loaded for the @command{zebra} daemon. This -provides the Forwarding Plane Manager ("FPM") API. - -The module expects its argument to be either @code{netlink} or -@code{protobuf}, specifying the encapsulation to use. @code{netlink} is the -default, and @code{protobuf} may not be available if the module was built -without protobuf support. Refer to @ref{zebra FIB push interface} for more -information. - - -@node Virtual Terminal Interfaces -@section Virtual Terminal Interfaces - -VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line -interface (CLI) for user interaction with the routing daemon. - -@menu -* VTY Overview:: Basics about VTYs -* VTY Modes:: View, Enable, and Other VTY modes -* VTY CLI Commands:: Commands for movement, edition, and management -@end menu - - - -@node VTY Overview -@subsection VTY Overview - - -VTY stands for Virtual TeletYpe interface. It means you can connect to -the daemon via the telnet protocol. - -To enable a VTY interface, you have to setup a VTY password. If there -is no VTY password, one cannot connect to the VTY interface at all. - -@example -@group -% telnet localhost 2601 -Trying 127.0.0.1... -Connected to localhost. -Escape character is '^]'. - -Hello, this is @value{PACKAGE_NAME} (version @value{PACKAGE_VERSION}) -@value{COPYRIGHT_STR} - -User Access Verification - -Password: XXXXX -Router> ? - enable Turn on privileged commands - exit Exit current mode and down to previous mode - help Description of the interactive help system - list Print command list - show Show running system information - who Display who is on a vty -Router> enable -Password: XXXXX -Router# configure terminal -Router(config)# interface eth0 -Router(config-if)# ip address 10.0.0.1/8 -Router(config-if)# ^Z -Router# -@end group -@end example - -'?' is very useful for looking up commands. - -@node VTY Modes -@subsection VTY Modes - -There are three basic VTY modes: - -@menu -* VTY View Mode:: Mode for read-only interaction -* VTY Enable Mode:: Mode for read-write interaction -* VTY Other Modes:: Special modes (tftp, etc) -@end menu - -There are commands that may be restricted to specific VTY modes. - -@node VTY View Mode -@subsubsection VTY View Mode -@c to be written (gpoul) - - -This mode is for read-only access to the CLI. One may exit the mode by -leaving the system, or by entering @code{enable} mode. - -@node VTY Enable Mode -@subsubsection VTY Enable Mode - -@c to be written (gpoul) -This mode is for read-write access to the CLI. One may exit the mode by -leaving the system, or by escaping to view mode. - -@node VTY Other Modes -@subsubsection VTY Other Modes - - -@c to be written (gpoul) -This page is for describing other modes. - -@node VTY CLI Commands -@subsection VTY CLI Commands - -Commands that you may use at the command-line are described in the following -three subsubsections. - -@menu -* CLI Movement Commands:: Commands for moving the cursor about -* CLI Editing Commands:: Commands for changing text -* CLI Advanced Commands:: Other commands, session management and so on -@end menu - -@node CLI Movement Commands -@subsubsection CLI Movement Commands - -These commands are used for moving the CLI cursor. The @key{C} character -means press the Control Key. - -@table @kbd - -@item C-f -@itemx @key{RIGHT} -@kindex C-f -@kindex @key{RIGHT} -Move forward one character. - -@item C-b -@itemx @key{LEFT} -@kindex C-b -@kindex @key{LEFT} -Move backward one character. - -@item M-f -@kindex M-f -Move forward one word. - -@item M-b -@kindex M-b -Move backward one word. - -@item C-a -@kindex C-a -Move to the beginning of the line. - -@item C-e -@kindex C-e -Move to the end of the line. - -@end table - -@node CLI Editing Commands -@subsubsection CLI Editing Commands - -These commands are used for editing text on a line. The @key{C} -character means press the Control Key. - -@table @kbd - -@item C-h -@itemx @key{DEL} -@kindex C-h -@kindex @key{DEL} -Delete the character before point. - -@item C-d -@kindex C-d -Delete the character after point. - -@item M-d -@kindex M-d -Forward kill word. - -@item C-w -@kindex C-w -Backward kill word. - -@item C-k -@kindex C-k -Kill to the end of the line. - -@item C-u -@kindex C-u -Kill line from the beginning, erasing input. - -@item C-t -@kindex C-t -Transpose character. - -@end table - -@node CLI Advanced Commands -@subsubsection CLI Advanced Commands - -There are several additional CLI commands for command line completions, -insta-help, and VTY session management. - -@table @kbd - -@item C-c -@kindex C-c -Interrupt current input and moves to the next line. - -@item C-z -@kindex C-z -End current configuration session and move to top node. - - -@item C-n -@itemx @key{DOWN} -@kindex C-n -@kindex @key{DOWN} -Move down to next line in the history buffer. - -@item C-p -@itemx @key{UP} -@kindex C-p -@kindex @key{UP} -Move up to previous line in the history buffer. - -@item TAB -@kindex @key{TAB} -Use command line completion by typing @key{TAB}. - -@item ? -@kindex @key{?} -You can use command line help by typing @code{help} at the beginning of -the line. Typing @kbd{?} at any point in the line will show possible -completions. - -@end table diff --git a/doc/bgpd.8.in b/doc/bgpd.8.in deleted file mode 100644 index 0df1b1dce..000000000 --- a/doc/bgpd.8.in +++ /dev/null @@ -1,132 +0,0 @@ -.TH BGPD 8 "25 November 2004" "@PACKAGE_FULLNAME@ BGPD daemon" "Version @PACKAGE_VERSION@" -.SH NAME -bgpd \- a BGPv4, BGPv4\+, BGPv4\- routing engine for use with @PACKAGE_FULLNAME@. - -.SH SYNOPSIS -.B bgpd -[ -.B \-dhrSv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-p -.I bgp-port-number -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B bgpd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B bgpd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/bgpd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When bgpd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart bgpd. The default is \fB\fI@CFG_STATE@/bgpd.pid\fR. -.TP -\fB\-p\fR, \fB\-\-bgp_port \fR\fIbgp-port-number\fR -Set the port that bgpd will listen to for bgp data. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the bgpd VTY will listen on. This defaults to -2605, as specified in \fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the bgpd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-r\fR, \fB\-\-retain\fR -When the program terminates, retain routes added by \fBbgpd\fR. -.TP -\fB\-S\fR, \fB\-\-skip_runas\fR -Skip setting the process effective user and group. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR module may be available for -\fBbgpd\fR, if the package was built with SNMP support. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/bgpd -The default location of the -.B bgpd -binary. -.TP -.BI @CFG_SYSCONF@/bgpd.conf -The default location of the -.B bgpd -config file. -.TP -.BI $(PWD)/bgpd.log -If the -.B bgpd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBbgpd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The bgpd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBbgpd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR nhrpd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B bgpd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/bgpd.texi b/doc/bgpd.texi deleted file mode 100644 index 83483f569..000000000 --- a/doc/bgpd.texi +++ /dev/null @@ -1,2142 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c Portions: -@c Copyright @copyright{} 2015 Hewlett Packard Enterprise Development LP -@c See file frr.texi for copying conditions. -@node BGP -@chapter BGP - -@acronym{BGP} stands for a Border Gateway Protocol. The lastest BGP version -is 4. It is referred as BGP-4. BGP-4 is one of the Exterior Gateway -Protocols and de-fact standard of Inter Domain routing protocol. -BGP-4 is described in @cite{RFC1771, A Border Gateway Protocol -4 (BGP-4)}. - -Many extensions have been added to @cite{RFC1771}. @cite{RFC2858, -Multiprotocol Extensions for BGP-4} provides multiprotocol support to -BGP-4. - -@menu -* Starting BGP:: -* BGP router:: -* BGP MED:: -* BGP network:: -* BGP Peer:: -* BGP Peer Group:: -* BGP Address Family:: -* Autonomous System:: -* BGP Communities Attribute:: -* BGP Extended Communities Attribute:: -* BGP Large Communities Attribute:: -* Displaying BGP information:: -* Capability Negotiation:: -* Route Reflector:: -* Route Server:: -* BGP Regular Expressions:: -* How to set up a 6-Bone connection:: -* Dump BGP packets and table:: -* BGP Configuration Examples:: -* Prefix Origin Validation Using RPKI:: -@end menu - -@node Starting BGP -@section Starting BGP - -Default configuration file of @command{bgpd} is @file{bgpd.conf}. -@command{bgpd} searches the current directory first then -@value{INSTALL_PREFIX_ETC}/bgpd.conf. All of bgpd's command must be -configured in @file{bgpd.conf}. - -@command{bgpd} specific invocation options are described below. Common -options may also be specified (@pxref{Common Invocation Options}). - -@table @samp -@item -p @var{PORT} -@itemx --bgp_port=@var{PORT} -Set the bgp protocol's port number. - -@item -r -@itemx --retain -When program terminates, retain BGP routes added by zebra. - -@item -l -@itemx --listenon -Specify a specific IP address for bgpd to listen on, rather than its -default of INADDR_ANY / IN6ADDR_ANY. This can be useful to constrain bgpd -to an internal address, or to run multiple bgpd processes on one host. - -@end table - -@node BGP router -@section BGP router - - First of all you must configure BGP router with @command{router bgp} -command. To configure BGP router, you need AS number. AS number is an -identification of autonomous system. BGP protocol uses the AS number -for detecting whether the BGP connection is internal one or external one. - -@deffn Command {router bgp @var{asn}} {} -Enable a BGP protocol process with the specified @var{asn}. After -this statement you can input any @code{BGP Commands}. You can not -create different BGP process under different @var{asn} without -specifying @code{multiple-instance} (@pxref{Multiple instance}). -@end deffn - -@deffn Command {no router bgp @var{asn}} {} -Destroy a BGP protocol process with the specified @var{asn}. -@end deffn - -@deffn {BGP} {bgp router-id @var{A.B.C.D}} {} -This command specifies the router-ID. If @command{bgpd} connects to @command{zebra} it gets -interface and address information. In that case default router ID value -is selected as the largest IP Address of the interfaces. When -@code{router zebra} is not enabled @command{bgpd} can't get interface information -so @code{router-id} is set to 0.0.0.0. So please set router-id by hand. -@end deffn - -@menu -* BGP distance:: -* BGP decision process:: -* BGP route flap dampening:: -@end menu - -@node BGP distance -@subsection BGP distance - -@deffn {BGP} {distance bgp <1-255> <1-255> <1-255>} {} -This command change distance value of BGP. Each argument is distance -value for external routes, internal routes and local routes. -@end deffn - -@deffn {BGP} {distance <1-255> @var{A.B.C.D/M}} {} -@deffnx {BGP} {distance <1-255> @var{A.B.C.D/M} @var{word}} {} -This command set distance value to -@end deffn - -@node BGP decision process -@subsection BGP decision process - -The decision process Frr BGP uses to select routes is as follows: - -@table @asis -@item 1. Weight check -prefer higher local weight routes to lower routes. - -@item 2. Local preference check -prefer higher local preference routes to lower. - -@item 3. Local route check -Prefer local routes (statics, aggregates, redistributed) to received routes. - -@item 4. AS path length check -Prefer shortest hop-count AS_PATHs. - -@item 5. Origin check -Prefer the lowest origin type route. That is, prefer IGP origin routes to -EGP, to Incomplete routes. - -@item 6. MED check -Where routes with a MED were received from the same AS, -prefer the route with the lowest MED. @xref{BGP MED}. - -@item 7. External check -Prefer the route received from an external, eBGP peer -over routes received from other types of peers. - -@item 8. IGP cost check -Prefer the route with the lower IGP cost. - -@item 9. Multi-path check -If multi-pathing is enabled, then check whether -the routes not yet distinguished in preference may be considered equal. If -@ref{bgp bestpath as-path multipath-relax} is set, all such routes are -considered equal, otherwise routes received via iBGP with identical AS_PATHs -or routes received from eBGP neighbours in the same AS are considered equal. - -@item 10 Already-selected external check - -Where both routes were received from eBGP peers, then prefer the route which -is already selected. Note that this check is not applied if @ref{bgp -bestpath compare-routerid} is configured. This check can prevent some cases -of oscillation. - -@item 11. Router-ID check -Prefer the route with the lowest @w{router-ID}. If the -route has an @w{ORIGINATOR_ID} attribute, through iBGP reflection, then that -router ID is used, otherwise the @w{router-ID} of the peer the route was -received from is used. - -@item 12. Cluster-List length check -The route with the shortest cluster-list -length is used. The cluster-list reflects the iBGP reflection path the -route has taken. - -@item 13. Peer address -Prefer the route received from the peer with the higher -transport layer address, as a last-resort tie-breaker. - -@end table - -@deffn {BGP} {bgp bestpath as-path confed} {} -This command specifies that the length of confederation path sets and -sequences should should be taken into account during the BGP best path -decision process. -@end deffn - -@deffn {BGP} {bgp bestpath as-path multipath-relax} {} -@anchor{bgp bestpath as-path multipath-relax} -This command specifies that BGP decision process should consider paths -of equal AS_PATH length candidates for multipath computation. Without -the knob, the entire AS_PATH must match for multipath computation. -@end deffn - -@deffn {BGP} {bgp bestpath compare-routerid} {} -@anchor{bgp bestpath compare-routerid} - -Ensure that when comparing routes where both are equal on most metrics, -including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken -based on router-ID. - -If this option is enabled, then the already-selected check, where -already selected eBGP routes are preferred, is skipped. - -If a route has an @w{ORIGINATOR_ID} attribute because it has been reflected, -that @w{ORIGINATOR_ID} will be used. Otherwise, the router-ID of the peer the -route was received from will be used. - -The advantage of this is that the route-selection (at this point) will be -more deterministic. The disadvantage is that a few or even one lowest-ID -router may attract all trafic to otherwise-equal paths because of this -check. It may increase the possibility of MED or IGP oscillation, unless -other measures were taken to avoid these. The exact behaviour will be -sensitive to the iBGP and reflection topology. - -@end deffn - - -@node BGP route flap dampening -@subsection BGP route flap dampening - -@deffn {BGP} {bgp dampening @var{<1-45>} @var{<1-20000>} @var{<1-20000>} @var{<1-255>}} {} -This command enables BGP route-flap dampening and specifies dampening parameters. - -@table @asis -@item @asis{half-life} -Half-life time for the penalty -@item @asis{reuse-threshold} -Value to start reusing a route -@item @asis{suppress-threshold} -Value to start suppressing a route -@item @asis{max-suppress} -Maximum duration to suppress a stable route -@end table - -The route-flap damping algorithm is compatible with @cite{RFC2439}. The use of this command -is not recommended nowadays, see @uref{http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378}. -@end deffn - -@node BGP MED -@section BGP MED - -The BGP MED (Multi_Exit_Discriminator) attribute has properties which can -cause subtle convergence problems in BGP. These properties and problems -have proven to be hard to understand, at least historically, and may still -not be widely understood. The following attempts to collect together and -present what is known about MED, to help operators and Frr users in -designing and configuring their networks. - -The BGP @acronym{MED, Multi_Exit_Discriminator} attribute is intended to -allow one AS to indicate its preferences for its ingress points to another -AS. The MED attribute will not be propagated on to another AS by the -receiving AS - it is `non-transitive' in the BGP sense. - -E.g., if AS X and AS Y have 2 different BGP peering points, then AS X -might set a MED of 100 on routes advertised at one and a MED of 200 at the -other. When AS Y selects between otherwise equal routes to or via -AS X, AS Y should prefer to take the path via the lower MED peering of 100 with -AS X. Setting the MED allows an AS to influence the routing taken to it -within another, neighbouring AS. - -In this use of MED it is not really meaningful to compare the MED value on -routes where the next AS on the paths differs. E.g., if AS Y also had a -route for some destination via AS Z in addition to the routes from AS X, and -AS Z had also set a MED, it wouldn't make sense for AS Y to compare AS Z's -MED values to those of AS X. The MED values have been set by different -administrators, with different frames of reference. - -The default behaviour of BGP therefore is to not compare MED values across -routes received from different neighbouring ASes. In Frr this is done by -comparing the neighbouring, left-most AS in the received AS_PATHs of the -routes and only comparing MED if those are the same. - -@c TeXInfo uses the old, non-UTF-8 capable, pdftex, and so -@c doesn't render TeX the unicode precedes character correctly in PDF, etc. -@c Using a TeX code on the other hand doesn't work for non-TeX outputs -@c (plaintext, e.g.). So, use an output-conditional macro. - -@iftex -@macro mprec{} -@math{\\prec} -@end macro -@end iftex - -@ifnottex -@macro mprec{} -@math{≺} -@end macro -@end ifnottex - -Unfortunately, this behaviour of MED, of sometimes being compared across -routes and sometimes not, depending on the properties of those other routes, -means MED can cause the order of preference over all the routes to be -undefined. That is, given routes A, B, and C, if A is preferred to B, and B -is preferred to C, then a well-defined order should mean the preference is -transitive (in the sense of orders @footnote{For some set of objects to have -an order, there @emph{must} be some binary ordering relation that is defined -for @emph{every} combination of those objects, and that relation @emph{must} -be transitive. I.e.@:, if the relation operator is @mprec{}, and if -a @mprec{} b and b @mprec{} c then that relation must carry over -and it @emph{must} be that a @mprec{} c for the objects to have an -order. The ordering relation may allow for equality, i.e. -a @mprec{} b and b @mprec{} a may both be true amd imply that -a and b are equal in the order and not distinguished by it, in -which case the set has a partial order. Otherwise, if there is an order, -all the objects have a distinct place in the order and the set has a total -order.}) and that A would be preferred to C. - -However, when MED is involved this need not be the case. With MED it is -possible that C is actually preferred over A. So A is preferred to B, B is -preferred to C, but C is preferred to A. This can be true even where BGP -defines a deterministic ``most preferred'' route out of the full set of -A,B,C. With MED, for any given set of routes there may be a -deterministically preferred route, but there need not be any way to arrange -them into any order of preference. With unmodified MED, the order of -preference of routes literally becomes undefined. - -That MED can induce non-transitive preferences over routes can cause issues. -Firstly, it may be perceived to cause routing table churn locally at -speakers; secondly, and more seriously, it may cause routing instability in -iBGP topologies, where sets of speakers continually oscillate between -different paths. - -The first issue arises from how speakers often implement routing decisions. -Though BGP defines a selection process that will deterministically select -the same route as best at any given speaker, even with MED, that process -requires evaluating all routes together. For performance and ease of -implementation reasons, many implementations evaluate route preferences in a -pair-wise fashion instead. Given there is no well-defined order when MED is -involved, the best route that will be chosen becomes subject to -implementation details, such as the order the routes are stored in. That -may be (locally) non-deterministic, e.g.@: it may be the order the routes -were received in. - -This indeterminism may be considered undesirable, though it need not cause -problems. It may mean additional routing churn is perceived, as sometimes -more updates may be produced than at other times in reaction to some event . - -This first issue can be fixed with a more deterministic route selection that -ensures routes are ordered by the neighbouring AS during selection. -@xref{bgp deterministic-med}. This may reduce the number of updates as -routes are received, and may in some cases reduce routing churn. Though, it -could equally deterministically produce the largest possible set of updates -in response to the most common sequence of received updates. - -A deterministic order of evaluation tends to imply an additional overhead of -sorting over any set of n routes to a destination. The implementation of -deterministic MED in Frr scales significantly worse than most sorting -algorithms at present, with the number of paths to a given destination. -That number is often low enough to not cause any issues, but where there are -many paths, the deterministic comparison may quickly become increasingly -expensive in terms of CPU. - -Deterministic local evaluation can @emph{not} fix the second, more major, -issue of MED however. Which is that the non-transitive preference of routes -MED can cause may lead to routing instability or oscillation across multiple -speakers in iBGP topologies. This can occur with full-mesh iBGP, but is -particularly problematic in non-full-mesh iBGP topologies that further -reduce the routing information known to each speaker. This has primarily -been documented with iBGP route-reflection topologies. However, any -route-hiding technologies potentially could also exacerbate oscillation with -MED. - -This second issue occurs where speakers each have only a subset of routes, -and there are cycles in the preferences between different combinations of -routes - as the undefined order of preference of MED allows - and the routes -are distributed in a way that causes the BGP speakers to 'chase' those -cycles. This can occur even if all speakers use a deterministic order of -evaluation in route selection. - -E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and -from speaker 3 in AS Y; while speaker 5 in AS A might receive that route -from speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 -at speaker 3. I.e, using ASN:ID:MED to label the speakers: - -@example - - /---------------\ - X:2------|--A:4-------A:5--|-Y:1:200 - Y:3:100--|-/ | - \---------------/ - -@end example - -Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then -based on the RFC4271 decision process speaker 4 will choose X:2 over -Y:3:100, based on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. -Speaker 5 will continue to prefer Y:1:200 based on the ID, and advertise -this to speaker 4. Speaker 4 will now have the full set of routes, and the -Y:1:200 it receives from 5 will beat X:2, but when speaker 4 compares -Y:1:200 to Y:3:100 the MED check now becomes active as the ASes match, and -now Y:3:100 is preferred. Speaker 4 therefore now advertises Y:3:100 to 5, -which will also agrees that Y:3:100 is preferred to Y:1:200, and so -withdraws the latter route from 4. Speaker 4 now has only X:2 and Y:3:100, -and X:2 beats Y:3:100, and so speaker 4 implicitly updates its route to -speaker 5 to X:2. Speaker 5 sees that Y:1:200 beats X:2 based on the ID, -and advertises Y:1:200 to speaker 4, and the cycle continues. - -The root cause is the lack of a clear order of preference caused by how MED -sometimes is and sometimes is not compared, leading to this cycle in the -preferences between the routes: - -@example - - /---> X:2 ---beats---> Y:3:100 --\ - | | - | | - \---beats--- Y:1:200 <---beats---/ - -@end example - -This particular type of oscillation in full-mesh iBGP topologies can be -avoided by speakers preferring already selected, external routes rather than -choosing to update to new a route based on a post-MED metric (e.g. -router-ID), at the cost of a non-deterministic selection process. Frr -implements this, as do many other implementations, so long as it is not -overridden by setting @ref{bgp bestpath compare-routerid}, and see also -@ref{BGP decision process}, . - -However, more complex and insidious cycles of oscillation are possible with -iBGP route-reflection, which are not so easily avoided. These have been -documented in various places. See, e.g., @cite{McPherson, D. and Gill, V. -and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation -Condition", IETF RFC3345}, and @cite{Flavel, A. and M. Roughan, "Stable -and flexible iBGP", ACM SIGCOMM 2009}, and @cite{Griffin, T. and G. Wilfong, -"On the correctness of IBGP configuration", ACM SIGCOMM 2002} for concrete -examples and further references. - -There is as of this writing @emph{no} known way to use MED for its original -purpose; @emph{and} reduce routing information in iBGP topologies; -@emph{and} be sure to avoid the instability problems of MED due the -non-transitive routing preferences it can induce; in general on arbitrary -networks. - -There may be iBGP topology specific ways to reduce the instability risks, -even while using MED, e.g.@: by constraining the reflection topology and by -tuning IGP costs between route-reflector clusters, see RFC3345 for details. -In the near future, the Add-Path extension to BGP may also solve MED -oscillation while still allowing MED to be used as intended, by distributing -"best-paths per neighbour AS". This would be at the cost of distributing at -least as many routes to all speakers as a full-mesh iBGP would, if not more, -while also imposing similar CPU overheads as the "Deterministic MED" feature -at each Add-Path reflector. - -More generally, the instability problems that MED can introduce on more -complex, non-full-mesh, iBGP topologies may be avoided either by: - -@itemize - -@item -Setting @ref{bgp always-compare-med}, however this allows MED to be compared -across values set by different neighbour ASes, which may not produce -coherent desirable results, of itself. - -@item -Effectively ignoring MED by setting MED to the same value (e.g.@: 0) using -@ref{routemap set metric} on all received routes, in combination with -setting @ref{bgp always-compare-med} on all speakers. This is the simplest -and most performant way to avoid MED oscillation issues, where an AS is happy -not to allow neighbours to inject this problematic metric. - -@end itemize - -As MED is evaluated after the AS_PATH length check, another possible use for -MED is for intra-AS steering of routes with equal AS_PATH length, as an -extension of the last case above. As MED is evaluated before IGP metric, -this can allow cold-potato routing to be implemented to send traffic to -preferred hand-offs with neighbours, rather than the closest hand-off -according to the IGP metric. - -Note that even if action is taken to address the MED non-transitivity -issues, other oscillations may still be possible. E.g., on IGP cost if -iBGP and IGP topologies are at cross-purposes with each other - see the -Flavel and Roughan paper above for an example. Hence the guideline that the -iBGP topology should follow the IGP topology. - -@deffn {BGP} {bgp deterministic-med} {} -@anchor{bgp deterministic-med} - -Carry out route-selection in way that produces deterministic answers -locally, even in the face of MED and the lack of a well-defined order of -preference it can induce on routes. Without this option the preferred route -with MED may be determined largely by the order that routes were received -in. - -Setting this option will have a performance cost that may be noticeable when -there are many routes for each destination. Currently in Frr it is -implemented in a way that scales poorly as the number of routes per -destination increases. - -The default is that this option is not set. -@end deffn - -Note that there are other sources of indeterminism in the route selection -process, specifically, the preference for older and already selected routes -from eBGP peers, @xref{BGP decision process}. - -@deffn {BGP} {bgp always-compare-med} {} -@anchor{bgp always-compare-med} - -Always compare the MED on routes, even when they were received from -different neighbouring ASes. Setting this option makes the order of -preference of routes more defined, and should eliminate MED induced -oscillations. - -If using this option, it may also be desirable to use @ref{routemap set -metric} to set MED to 0 on routes received from external neighbours. - -This option can be used, together with @ref{routemap set metric} to use MED -as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., desired -exit points. -@end deffn - - - -@node BGP network -@section BGP network - -@menu -* BGP route:: -* Route Aggregation:: -* Redistribute to BGP:: -@end menu - -@node BGP route -@subsection BGP route - -@deffn {BGP} {network @var{A.B.C.D/M}} {} -This command adds the announcement network. -@example -@group -router bgp 1 - address-family ipv4 unicast - network 10.0.0.0/8 - exit-address-family -@end group -@end example -This configuration example says that network 10.0.0.0/8 will be -announced to all neighbors. Some vendors' routers don't advertise -routes if they aren't present in their IGP routing tables; @code{bgpd} -doesn't care about IGP routes when announcing its routes. -@end deffn - -@deffn {BGP} {no network @var{A.B.C.D/M}} {} -@end deffn - -@node Route Aggregation -@subsection Route Aggregation - -@deffn {BGP} {aggregate-address @var{A.B.C.D/M}} {} -This command specifies an aggregate address. -@end deffn - -@deffn {BGP} {aggregate-address @var{A.B.C.D/M} as-set} {} -This command specifies an aggregate address. Resulting routes include -AS set. -@end deffn - -@deffn {BGP} {aggregate-address @var{A.B.C.D/M} summary-only} {} -This command specifies an aggregate address. Aggreated routes will -not be announce. -@end deffn - -@deffn {BGP} {no aggregate-address @var{A.B.C.D/M}} {} -@end deffn - -@node Redistribute to BGP -@subsection Redistribute to BGP - -@deffn {BGP} {redistribute kernel} {} -Redistribute kernel route to BGP process. -@end deffn - -@deffn {BGP} {redistribute static} {} -Redistribute static route to BGP process. -@end deffn - -@deffn {BGP} {redistribute connected} {} -Redistribute connected route to BGP process. -@end deffn - -@deffn {BGP} {redistribute rip} {} -Redistribute RIP route to BGP process. -@end deffn - -@deffn {BGP} {redistribute ospf} {} -Redistribute OSPF route to BGP process. -@end deffn - -@deffn {BGP} {redistribute vpn} {} -Redistribute VNC routes to BGP process. -@end deffn - -@deffn {BGP} {update-delay @var{max-delay}} {} -@deffnx {BGP} {update-delay @var{max-delay} @var{establish-wait}} {} -This feature is used to enable read-only mode on BGP process restart or when -BGP process is cleared using 'clear ip bgp *'. When applicable, read-only mode -would begin as soon as the first peer reaches Established status and a timer -for max-delay seconds is started. - -During this mode BGP doesn't run any best-path or generate any updates to its -peers. This mode continues until: -1. All the configured peers, except the shutdown peers, have sent explicit EOR -(End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached -Established is considered an implicit-EOR. - If the establish-wait optional value is given, then BGP will wait for - peers to reach established from the begining of the update-delay till the - establish-wait period is over, i.e. the minimum set of established peers for - which EOR is expected would be peers established during the establish-wait - window, not necessarily all the configured neighbors. -2. max-delay period is over. -On hitting any of the above two conditions, BGP resumes the decision process -and generates updates to its peers. - -Default max-delay is 0, i.e. the feature is off by default. -@end deffn - -@deffn {BGP} {table-map @var{route-map-name}} {} -This feature is used to apply a route-map on route updates from BGP to Zebra. -All the applicable match operations are allowed, such as match on prefix, -next-hop, communities, etc. Set operations for this attach-point are limited -to metric and next-hop only. Any operation of this feature does not affect -BGPs internal RIB. - -Supported for ipv4 and ipv6 address families. It works on multi-paths as well, -however, metric setting is based on the best-path only. -@end deffn - -@node BGP Peer -@section BGP Peer - -@menu -* Defining Peer:: -* BGP Peer commands:: -* Peer filtering:: -@end menu - -@node Defining Peer -@subsection Defining Peer - -@deffn {BGP} {neighbor @var{peer} remote-as @var{asn}} {} -Creates a new neighbor whose remote-as is @var{asn}. @var{peer} -can be an IPv4 address or an IPv6 address. -@example -@group -router bgp 1 - neighbor 10.0.0.1 remote-as 2 -@end group -@end example -In this case my router, in AS-1, is trying to peer with AS-2 at -10.0.0.1. - -This command must be the first command used when configuring a neighbor. -If the remote-as is not specified, @command{bgpd} will complain like this: -@example -can't find neighbor 10.0.0.1 -@end example -@end deffn - -@node BGP Peer commands -@subsection BGP Peer commands - -In a @code{router bgp} clause there are neighbor specific configurations -required. - -@deffn {BGP} {neighbor @var{peer} shutdown} {} -@deffnx {BGP} {no neighbor @var{peer} shutdown} {} -Shutdown the peer. We can delete the neighbor's configuration by -@code{no neighbor @var{peer} remote-as @var{as-number}} but all -configuration of the neighbor will be deleted. When you want to -preserve the configuration, but want to drop the BGP peer, use this -syntax. -@end deffn - -@deffn {BGP} {neighbor @var{peer} ebgp-multihop} {} -@deffnx {BGP} {no neighbor @var{peer} ebgp-multihop} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} description ...} {} -@deffnx {BGP} {no neighbor @var{peer} description ...} {} -Set description of the peer. -@end deffn - -@deffn {BGP} {neighbor @var{peer} version @var{version}} {} -Set up the neighbor's BGP version. @var{version} can be @var{4}, -@var{4+} or @var{4-}. BGP version @var{4} is the default value used for -BGP peering. BGP version @var{4+} means that the neighbor supports -Multiprotocol Extensions for BGP-4. BGP version @var{4-} is similar but -the neighbor speaks the old Internet-Draft revision 00's Multiprotocol -Extensions for BGP-4. Some routing software is still using this -version. -@end deffn - -@deffn {BGP} {neighbor @var{peer} interface @var{ifname}} {} -@deffnx {BGP} {no neighbor @var{peer} interface @var{ifname}} {} -When you connect to a BGP peer over an IPv6 link-local address, you -have to specify the @var{ifname} of the interface used for the -connection. To specify IPv4 session addresses, see the -@code{neighbor @var{peer} update-source} command below. - -This command is deprecated and may be removed in a future release. Its -use should be avoided. -@end deffn - -@deffn {BGP} {neighbor @var{peer} next-hop-self [all]} {} -@deffnx {BGP} {no neighbor @var{peer} next-hop-self [all]} {} -This command specifies an announced route's nexthop as being equivalent -to the address of the bgp router if it is learned via eBGP. -If the optional keyword @code{all} is specified the modifiation is done -also for routes learned via iBGP. -@end deffn - -@deffn {BGP} {neighbor @var{peer} update-source @var{<ifname|address>}} {} -@deffnx {BGP} {no neighbor @var{peer} update-source} {} -Specify the IPv4 source address to use for the @acronym{BGP} session to this -neighbour, may be specified as either an IPv4 address directly or -as an interface name (in which case the @command{zebra} daemon MUST be running -in order for @command{bgpd} to be able to retrieve interface state). -@example -@group -router bgp 64555 - neighbor foo update-source 192.168.0.1 - neighbor bar update-source lo0 -@end group -@end example -@end deffn - -@deffn {BGP} {neighbor @var{peer} default-originate} {} -@deffnx {BGP} {no neighbor @var{peer} default-originate} {} -@command{bgpd}'s default is to not announce the default route (0.0.0.0/0) even it -is in routing table. When you want to announce default routes to the -peer, use this command. -@end deffn - -@deffn {BGP} {neighbor @var{peer} port @var{port}} {} -@deffnx {BGP} {neighbor @var{peer} port @var{port}} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} send-community} {} -@deffnx {BGP} {neighbor @var{peer} send-community} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} weight @var{weight}} {} -@deffnx {BGP} {no neighbor @var{peer} weight @var{weight}} {} -This command specifies a default @var{weight} value for the neighbor's -routes. -@end deffn - -@deffn {BGP} {neighbor @var{peer} maximum-prefix @var{number}} {} -@deffnx {BGP} {no neighbor @var{peer} maximum-prefix @var{number}} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} local-as @var{as-number}} {} -@deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend} {} -@deffnx {BGP} {neighbor @var{peer} local-as @var{as-number} no-prepend replace-as} {} -@deffnx {BGP} {no neighbor @var{peer} local-as} {} -Specify an alternate AS for this BGP process when interacting with the -specified peer. With no modifiers, the specified local-as is prepended to -the received AS_PATH when receiving routing updates from the peer, and -prepended to the outgoing AS_PATH (after the process local AS) when -transmitting local routes to the peer. - -If the no-prepend attribute is specified, then the supplied local-as is not -prepended to the received AS_PATH. - -If the replace-as attribute is specified, then only the supplied local-as is -prepended to the AS_PATH when transmitting local-route updates to this peer. - -Note that replace-as can only be specified if no-prepend is. - -This command is only allowed for eBGP peers. -@end deffn - -@deffn {BGP} {neighbor @var{peer} ttl-security hops @var{number}} {} -@deffnx {BGP} {no neighbor @var{peer} ttl-security hops @var{number}} {} -This command enforces Generalized TTL Security Mechanism (GTSM), as -specified in RFC 5082. With this command, only neighbors that are the -specified number of hops away will be allowed to become neighbors. This -command is mututally exclusive with @command{ebgp-multihop}. -@end deffn - -@node Peer filtering -@subsection Peer filtering - -@deffn {BGP} {neighbor @var{peer} distribute-list @var{name} [in|out]} {} -This command specifies a distribute-list for the peer. @var{direct} is -@samp{in} or @samp{out}. -@end deffn - -@deffn {BGP command} {neighbor @var{peer} prefix-list @var{name} [in|out]} {} -@end deffn - -@deffn {BGP command} {neighbor @var{peer} filter-list @var{name} [in|out]} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} route-map @var{name} [in|out]} {} -Apply a route-map on the neighbor. @var{direct} must be @code{in} or -@code{out}. -@end deffn - -@deffn {BGP} {bgp route-reflector allow-outbound-policy} {} -By default, attribute modification via route-map policy out is not reflected -on reflected routes. This option allows the modifications to be reflected as -well. Once enabled, it affects all reflected routes. -@end deffn - -@c ----------------------------------------------------------------------- -@node BGP Peer Group -@section BGP Peer Group - -@deffn {BGP} {neighbor @var{word} peer-group} {} -This command defines a new peer group. -@end deffn - -@deffn {BGP} {neighbor @var{peer} peer-group @var{word}} {} -This command bind specific peer to peer group @var{word}. -@end deffn - -@node BGP Address Family -@section BGP Address Family - -Multiprotocol BGP enables BGP to carry routing information for multiple -Network Layer protocols. BGP supports multiple Address Family -Identifier (AFI), namely IPv4 and IPv6. Support is also provided for -multiple sets of per-AFI information via Subsequent Address Family -Identifiers (SAFI). In addition to unicast information, VPN information -@cite{RFC4364} and @cite{RFC4659}, and Encapsulation attribute -@cite{RFC5512} is supported. - -@deffn {Command} {show ip bgp ipv4 vpn} {} -@deffnx {Command} {show ipv6 bgp ipv6 vpn} {} -Print active IPV4 or IPV6 routes advertised via the VPN SAFI. -@end deffn - -@deffn {Command} {show bgp ipv4 vpn summary} {} -@deffnx {Command} {show bgp ipv6 vpn summary} {} -Print a summary of neighbor connections for the specified AFI/SAFI combination. -@end deffn - -@c ----------------------------------------------------------------------- -@node Autonomous System -@section Autonomous System - -The @acronym{AS,Autonomous System} number is one of the essential -element of BGP. BGP is a distance vector routing protocol, and the -AS-Path framework provides distance vector metric and loop detection to -BGP. @cite{RFC1930, Guidelines for creation, selection, and -registration of an Autonomous System (AS)} provides some background on -the concepts of an AS. - -The AS number is a two octet value, ranging in value from 1 to 65535. -The AS numbers 64512 through 65535 are defined as private AS numbers. -Private AS numbers must not to be advertised in the global Internet. - -@menu -* Display BGP Routes by AS Path:: -* AS Path Access List:: -* Using AS Path in Route Map:: -* Private AS Numbers:: -@end menu - -@node Display BGP Routes by AS Path -@subsection Display BGP Routes by AS Path - -To show BGP routes which has specific AS path information @code{show -ip bgp} command can be used. - -@deffn Command {show bgp @{ipv4|ipv6@} regexp @var{line}} {} -This commands displays BGP routes that matches a regular -expression @var{line} (@pxref{BGP Regular Expressions}). -@end deffn - -@node AS Path Access List -@subsection AS Path Access List - -AS path access list is user defined AS path. - -@deffn {Command} {ip as-path access-list @var{word} @{permit|deny@} @var{line}} {} -This command defines a new AS path access list. -@end deffn - -@deffn {Command} {no ip as-path access-list @var{word}} {} -@deffnx {Command} {no ip as-path access-list @var{word} @{permit|deny@} @var{line}} {} -@end deffn - -@node Using AS Path in Route Map -@subsection Using AS Path in Route Map - -@deffn {Route Map} {match as-path @var{word}} {} -@end deffn - -@deffn {Route Map} {set as-path prepend @var{as-path}} {} -Prepend the given string of AS numbers to the AS_PATH. -@end deffn - -@deffn {Route Map} {set as-path prepend last-as @var{num}} {} -Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. -@end deffn - -@node Private AS Numbers -@subsection Private AS Numbers - -@c ----------------------------------------------------------------------- -@node BGP Communities Attribute -@section BGP Communities Attribute - -BGP communities attribute is widely used for implementing policy -routing. Network operators can manipulate BGP communities attribute -based on their network policy. BGP communities attribute is defined -in @cite{RFC1997, BGP Communities Attribute} and -@cite{RFC1998, An Application of the BGP Community Attribute -in Multi-home Routing}. It is an optional transitive attribute, -therefore local policy can travel through different autonomous system. - -Communities attribute is a set of communities values. Each -communities value is 4 octet long. The following format is used to -define communities value. - -@table @code -@item AS:VAL -This format represents 4 octet communities value. @code{AS} is high -order 2 octet in digit format. @code{VAL} is low order 2 octet in -digit format. This format is useful to define AS oriented policy -value. For example, @code{7675:80} can be used when AS 7675 wants to -pass local policy value 80 to neighboring peer. -@item internet -@code{internet} represents well-known communities value 0. -@item no-export -@code{no-export} represents well-known communities value @code{NO_EXPORT}@* -@r{(0xFFFFFF01)}. All routes carry this value must not be advertised -to outside a BGP confederation boundary. If neighboring BGP peer is -part of BGP confederation, the peer is considered as inside a BGP -confederation boundary, so the route will be announced to the peer. -@item no-advertise -@code{no-advertise} represents well-known communities value -@code{NO_ADVERTISE}@*@r{(0xFFFFFF02)}. All routes carry this value -must not be advertise to other BGP peers. -@item local-AS -@code{local-AS} represents well-known communities value -@code{NO_EXPORT_SUBCONFED} @r{(0xFFFFFF03)}. All routes carry this -value must not be advertised to external BGP peers. Even if the -neighboring router is part of confederation, it is considered as -external BGP peer, so the route will not be announced to the peer. -@end table - - When BGP communities attribute is received, duplicated communities -value in the communities attribute is ignored and each communities -values are sorted in numerical order. - -@menu -* BGP Community Lists:: -* Numbered BGP Community Lists:: -* BGP Community in Route Map:: -* Display BGP Routes by Community:: -* Using BGP Communities Attribute:: -@end menu - -@node BGP Community Lists -@subsection BGP Community Lists - - BGP community list is a user defined BGP communites attribute list. -BGP community list can be used for matching or manipulating BGP -communities attribute in updates. - -There are two types of community list. One is standard community -list and another is expanded community list. Standard community list -defines communities attribute. Expanded community list defines -communities attribute string with regular expression. Standard -community list is compiled into binary format when user define it. -Standard community list will be directly compared to BGP communities -attribute in BGP updates. Therefore the comparison is faster than -expanded community list. - -@deffn Command {ip community-list standard @var{name} @{permit|deny@} @var{community}} {} -This command defines a new standard community list. @var{community} -is communities value. The @var{community} is compiled into community -structure. We can define multiple community list under same name. In -that case match will happen user defined order. Once the -community list matches to communities attribute in BGP updates it -return permit or deny by the community list definition. When there is -no matched entry, deny will be returned. When @var{community} is -empty it matches to any routes. -@end deffn - -@deffn Command {ip community-list expanded @var{name} @{permit|deny@} @var{line}} {} -This command defines a new expanded community list. @var{line} is a -string expression of communities attribute. @var{line} can be a -regular expression (@pxref{BGP Regular Expressions}) to match -the communities attribute in BGP updates. -@end deffn - -@deffn Command {no ip community-list @var{name}} {} -@deffnx Command {no ip community-list standard @var{name}} {} -@deffnx Command {no ip community-list expanded @var{name}} {} -These commands delete community lists specified by @var{name}. All of -community lists shares a single name space. So community lists can be -removed simpley specifying community lists name. -@end deffn - -@deffn {Command} {show ip community-list} {} -@deffnx {Command} {show ip community-list @var{name}} {} -This command displays current community list information. When -@var{name} is specified the specified community list's information is -shown. - -@example -# show ip community-list -Named Community standard list CLIST - permit 7675:80 7675:100 no-export - deny internet -Named Community expanded list EXPAND - permit : - -# show ip community-list CLIST -Named Community standard list CLIST - permit 7675:80 7675:100 no-export - deny internet -@end example -@end deffn - -@node Numbered BGP Community Lists -@subsection Numbered BGP Community Lists - -When number is used for BGP community list name, the number has -special meanings. Community list number in the range from 1 and 99 is -standard community list. Community list number in the range from 100 -to 199 is expanded community list. These community lists are called -as numbered community lists. On the other hand normal community lists -is called as named community lists. - -@deffn Command {ip community-list <1-99> @{permit|deny@} @var{community}} {} -This command defines a new community list. <1-99> is standard -community list number. Community list name within this range defines -standard community list. When @var{community} is empty it matches to -any routes. -@end deffn - -@deffn Command {ip community-list <100-199> @{permit|deny@} @var{community}} {} -This command defines a new community list. <100-199> is expanded -community list number. Community list name within this range defines -expanded community list. -@end deffn - -@deffn Command {ip community-list @var{name} @{permit|deny@} @var{community}} {} -When community list type is not specifed, the community list type is -automatically detected. If @var{community} can be compiled into -communities attribute, the community list is defined as a standard -community list. Otherwise it is defined as an expanded community -list. This feature is left for backward compability. Use of this -feature is not recommended. -@end deffn - -@node BGP Community in Route Map -@subsection BGP Community in Route Map - -In Route Map (@pxref{Route Map}), we can match or set BGP -communities attribute. Using this feature network operator can -implement their network policy based on BGP communities attribute. - -Following commands can be used in Route Map. - -@deffn {Route Map} {match community @var{word}} {} -@deffnx {Route Map} {match community @var{word} exact-match} {} -This command perform match to BGP updates using community list -@var{word}. When the one of BGP communities value match to the one of -communities value in community list, it is match. When -@code{exact-match} keyword is spcified, match happen only when BGP -updates have completely same communities value specified in the -community list. -@end deffn - -@deffn {Route Map} {set community none} {} -@deffnx {Route Map} {set community @var{community}} {} -@deffnx {Route Map} {set community @var{community} additive} {} -This command manipulate communities value in BGP updates. When -@code{none} is specified as communities value, it removes entire -communities attribute from BGP updates. When @var{community} is not -@code{none}, specified communities value is set to BGP updates. If -BGP updates already has BGP communities value, the existing BGP -communities value is replaced with specified @var{community} value. -When @code{additive} keyword is specified, @var{community} is appended -to the existing communities value. -@end deffn - -@deffn {Route Map} {set comm-list @var{word} delete} {} -This command remove communities value from BGP communities attribute. -The @var{word} is community list name. When BGP route's communities -value matches to the community list @var{word}, the communities value -is removed. When all of communities value is removed eventually, the -BGP update's communities attribute is completely removed. -@end deffn - -@node Display BGP Routes by Community -@subsection Display BGP Routes by Community - -To show BGP routes which has specific BGP communities attribute, -@code{show bgp @{ipv4|ipv6@}} command can be used. The -@var{community} and @var{community-list} subcommand can be used. - -@deffn Command {show bgp @{ipv4|ipv6@} community} {} -@deffnx Command {show bgp @{ipv4|ipv6@} community @var{community}} {} -@deffnx Command {show bgp @{ipv4|ipv6@} community @var{community} exact-match} {} -@code{show bgp @{ipv4|ipv6@} community} displays BGP routes which has communities -attribute. Where the address family can be IPv4 or IPv6 among others. When -@var{community} is specified, BGP routes that matches @var{community} value is -displayed. For this command, @code{internet} keyword can't be used for -@var{community} value. When @code{exact-match} is specified, it display only -routes that have an exact match. -@end deffn - -@deffn Command {show bgp @{ipv4|ipv6@} community-list @var{word}} {} -@deffnx Command {show bgp @{ipv4|ipv6@} community-list @var{word} exact-match} {} -This commands display BGP routes for the address family specified that matches -community list @var{word}. When @code{exact-match} is specified, display only -routes that have an exact match. -@end deffn - -@node Using BGP Communities Attribute -@subsection Using BGP Communities Attribute - -Following configuration is the most typical usage of BGP communities -attribute. AS 7675 provides upstream Internet connection to AS 100. -When following configuration exists in AS 7675, AS 100 networks -operator can set local preference in AS 7675 network by setting BGP -communities attribute to the updates. - -@example -router bgp 7675 - neighbor 192.168.0.1 remote-as 100 - address-family ipv4 unicast - neighbor 192.168.0.1 route-map RMAP in - exit-address-family -! -ip community-list 70 permit 7675:70 -ip community-list 70 deny -ip community-list 80 permit 7675:80 -ip community-list 80 deny -ip community-list 90 permit 7675:90 -ip community-list 90 deny -! -route-map RMAP permit 10 - match community 70 - set local-preference 70 -! -route-map RMAP permit 20 - match community 80 - set local-preference 80 -! -route-map RMAP permit 30 - match community 90 - set local-preference 90 -@end example - -Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675. -The route has communities value 7675:80 so when above configuration -exists in AS 7675, announced route's local preference will be set to -value 80. - -@example -router bgp 100 - network 10.0.0.0/8 - neighbor 192.168.0.2 remote-as 7675 - address-family ipv4 unicast - neighbor 192.168.0.2 route-map RMAP out - exit-address-family -! -ip prefix-list PLIST permit 10.0.0.0/8 -! -route-map RMAP permit 10 - match ip address prefix-list PLIST - set community 7675:80 -@end example - -Following configuration is an example of BGP route filtering using -communities attribute. This configuration only permit BGP routes -which has BGP communities value 0:80 or 0:90. Network operator can -put special internal communities value at BGP border router, then -limit the BGP routes announcement into the internal network. - -@example -router bgp 7675 - neighbor 192.168.0.1 remote-as 100 - address-family ipv4 unicast - neighbor 192.168.0.1 route-map RMAP in - exit-address-family -! -ip community-list 1 permit 0:80 0:90 -! -route-map RMAP permit in - match community 1 -@end example - -Following exmaple filter BGP routes which has communities value 1:1. -When there is no match community-list returns deny. To avoid -filtering all of routes, we need to define permit any at last. - -@example -router bgp 7675 - neighbor 192.168.0.1 remote-as 100 - address-family ipv4 unicast - neighbor 192.168.0.1 route-map RMAP in - exit-address-family -! -ip community-list standard FILTER deny 1:1 -ip community-list standard FILTER permit -! -route-map RMAP permit 10 - match community FILTER -@end example - -Communities value keyword @code{internet} has special meanings in -standard community lists. In below example @code{internet} act as -match any. It matches all of BGP routes even if the route does not -have communities attribute at all. So community list @code{INTERNET} -is same as above example's @code{FILTER}. - -@example -ip community-list standard INTERNET deny 1:1 -ip community-list standard INTERNET permit internet -@end example - -Following configuration is an example of communities value deletion. -With this configuration communities value 100:1 and 100:2 is removed -from BGP updates. For communities value deletion, only @code{permit} -community-list is used. @code{deny} community-list is ignored. - -@example -router bgp 7675 - neighbor 192.168.0.1 remote-as 100 - address-family ipv4 unicast - neighbor 192.168.0.1 route-map RMAP in - exit-address-family -! -ip community-list standard DEL permit 100:1 100:2 -! -route-map RMAP permit 10 - set comm-list DEL delete -@end example - -@c ----------------------------------------------------------------------- -@node BGP Extended Communities Attribute -@section BGP Extended Communities Attribute - -BGP extended communities attribute is introduced with MPLS VPN/BGP -technology. MPLS VPN/BGP expands capability of network infrastructure -to provide VPN functionality. At the same time it requires a new -framework for policy routing. With BGP Extended Communities Attribute -we can use Route Target or Site of Origin for implementing network -policy for MPLS VPN/BGP. - -BGP Extended Communities Attribute is similar to BGP Communities -Attribute. It is an optional transitive attribute. BGP Extended -Communities Attribute can carry multiple Extended Community value. -Each Extended Community value is eight octet length. - -BGP Extended Communities Attribute provides an extended range -compared with BGP Communities Attribute. Adding to that there is a -type field in each value to provides community space structure. - -There are two format to define Extended Community value. One is AS -based format the other is IP address based format. - -@table @code -@item AS:VAL -This is a format to define AS based Extended Community value. -@code{AS} part is 2 octets Global Administrator subfield in Extended -Community value. @code{VAL} part is 4 octets Local Administrator -subfield. @code{7675:100} represents AS 7675 policy value 100. -@item IP-Address:VAL -This is a format to define IP address based Extended Community value. -@code{IP-Address} part is 4 octets Global Administrator subfield. -@code{VAL} part is 2 octets Local Administrator subfield. -@code{10.0.0.1:100} represents -@end table - -@menu -* BGP Extended Community Lists:: -* BGP Extended Communities in Route Map:: -@end menu - -@node BGP Extended Community Lists -@subsection BGP Extended Community Lists - -Expanded Community Lists is a user defined BGP Expanded Community -Lists. - -@deffn Command {ip extcommunity-list standard @var{name} @{permit|deny@} @var{extcommunity}} {} -This command defines a new standard extcommunity-list. -@var{extcommunity} is extended communities value. The -@var{extcommunity} is compiled into extended community structure. We -can define multiple extcommunity-list under same name. In that case -match will happen user defined order. Once the extcommunity-list -matches to extended communities attribute in BGP updates it return -permit or deny based upon the extcommunity-list definition. When -there is no matched entry, deny will be returned. When -@var{extcommunity} is empty it matches to any routes. -@end deffn - -@deffn Command {ip extcommunity-list expanded @var{name} @{permit|deny@} @var{line}} {} -This command defines a new expanded extcommunity-list. @var{line} is -a string expression of extended communities attribute. @var{line} can -be a regular expression (@pxref{BGP Regular Expressions}) to match an -extended communities attribute in BGP updates. -@end deffn - -@deffn Command {no ip extcommunity-list @var{name}} {} -@deffnx Command {no ip extcommunity-list standard @var{name}} {} -@deffnx Command {no ip extcommunity-list expanded @var{name}} {} -These commands delete extended community lists specified by -@var{name}. All of extended community lists shares a single name -space. So extended community lists can be removed simpley specifying -the name. -@end deffn - -@deffn {Command} {show ip extcommunity-list} {} -@deffnx {Command} {show ip extcommunity-list @var{name}} {} -This command displays current extcommunity-list information. When -@var{name} is specified the community list's information is shown. - -@example -# show ip extcommunity-list -@end example -@end deffn - -@node BGP Extended Communities in Route Map -@subsection BGP Extended Communities in Route Map - -@deffn {Route Map} {match extcommunity @var{word}} {} -@end deffn - -@deffn {Route Map} {set extcommunity rt @var{extcommunity}} {} -This command set Route Target value. -@end deffn - -@deffn {Route Map} {set extcommunity soo @var{extcommunity}} {} -This command set Site of Origin value. -@end deffn - -@c ----------------------------------------------------------------------- -@node BGP Large Communities Attribute -@section BGP Large Communities Attribute - -The BGP Large Communities attribute was introduced in Feb 2017 with -@cite{RFC8092, BGP Large Communities Attribute}. - -The BGP Large Communities Attribute is similar to the BGP Communities -Attribute except that it has 3 components instead of two and each of -which are 4 octets in length. Large Communities bring additional -functionality and convenience over traditional communities, specifically -the fact that the @code{GLOBAL} part below is now 4 octets wide allowing -AS4 operators seamless use. - -@table @code -@item GLOBAL:LOCAL1:LOCAL2 -This is the format to define Large Community values. Referencing -@cite{RFC8195, Use of BGP Large Communities} the values are commonly -referred to as follows. -The @code{GLOBAL} part is a 4 octet Global Administrator field, common -use of this field is the operators AS number. -The @code{LOCAL1} part is a 4 octet Local Data Part 1 subfield referred -to as a function. -The @code{LOCAL2} part is a 4 octet Local Data Part 2 field and referred -to as the parameter subfield. @code{65551:1:10} represents AS 65551 -function 1 and parameter 10. -The referenced RFC above gives some guidelines on recommended usage. -@end table - -@menu -* BGP Large Community Lists:: -* BGP Large Communities in Route Map:: -@end menu - -@node BGP Large Community Lists -@subsection BGP Large Community Lists - -Two types of large community lists are supported, namely @code{standard} and -@code{expanded}. - -@deffn Command {ip large-community-list standard @var{name} @{permit|deny@} @var{large-community}} {} -This command defines a new standard large-community-list. -@var{large-community} is the Large Community value. We -can add multiple large communities under same name. In that case -the match will happen in the user defined order. Once the large-community-list -matches the Large Communities attribute in BGP updates it will return -permit or deny based upon the large-community-list definition. When -there is no matched entry, a deny will be returned. When @var{large-community} -is empty it matches any routes. -@end deffn - -@deffn Command {ip large-community-list expanded @var{name} @{permit|deny@} @var{line}} {} -This command defines a new expanded large-community-list. Where @var{line} is -a string matching expression, it will be compared to the entire Large Communities -attribute as a string, with each large-community in order from lowest to highest. -@var{line} can also be a regular expression which matches this Large -Community attribute. -@end deffn - -@deffn Command {no ip large-community-list @var{name}} {} -@deffnx Command {no ip large-community-list standard @var{name}} {} -@deffnx Command {no ip large-community-list expanded @var{name}} {} -These commands delete Large Community lists specified by -@var{name}. All Large Community lists share a single namespace. -This means Large Community lists can be removed by simply specifying the name. -@end deffn - -@deffn {Command} {show ip large-community-list} {} -@deffnx {Command} {show ip large-community-list @var{name}} {} -This command display current large-community-list information. When -@var{name} is specified the community list information is shown. -@end deffn - -@deffn {Command} {show ip bgp large-community-info} {} -This command displays the current large communities in use. -@end deffn - -@node BGP Large Communities in Route Map -@subsection BGP Large Communities in Route Map - -@deffn {Route Map} {match large-community @var{line}} {} -Where @var{line} can be a simple string to match, or a regular expression. -It is very important to note that this match occurs on the entire -large-community string as a whole, where each large-community is ordered -from lowest to highest. -@end deffn - -@deffn {Route Map} {set large-community @var{large-community}} {} -@deffnx {Route Map} {set large-community @var{large-community} @var{large-community}} {} -@deffnx {Route Map} {set large-community @var{large-community} additive} {} -These commands are used for setting large-community values. The first -command will overwrite any large-communities currently present. -The second specifies two large-communities, which overwrites the current -large-community list. The third will add a large-community value without -overwriting other values. Multiple large-community values can be specified. -@end deffn - -@c ----------------------------------------------------------------------- - -@node Displaying BGP information -@section Displaying BGP information - -@menu -* Showing BGP information:: -* Other BGP commands:: -@end menu - -@node Showing BGP information -@subsection Showing BGP information - -@deffn {Command} {show ip bgp} {} -@deffnx {Command} {show ip bgp @var{A.B.C.D}} {} -@deffnx {Command} {show ip bgp @var{X:X::X:X}} {} -This command displays BGP routes. When no route is specified it -display all of IPv4 BGP routes. -@end deffn - -@example -BGP table version is 0, local router ID is 10.1.1.1 -Status codes: s suppressed, d damped, h history, * valid, > best, i - internal -Origin codes: i - IGP, e - EGP, ? - incomplete - - Network Next Hop Metric LocPrf Weight Path -*> 1.1.1.1/32 0.0.0.0 0 32768 i - -Total number of prefixes 1 -@end example - -@deffn {Command} {show ip bgp regexp @var{line}} {} -This command displays BGP routes using AS path regular expression -(@pxref{BGP Regular Expressions}). -@end deffn - -@deffn Command {show ip bgp community @var{community}} {} -@deffnx Command {show ip bgp community @var{community} exact-match} {} -This command displays BGP routes using @var{community} (@pxref{Display -BGP Routes by Community}). -@end deffn - -@deffn Command {show ip bgp community-list @var{word}} {} -@deffnx Command {show ip bgp community-list @var{word} exact-match} {} -This command displays BGP routes using community list (@pxref{Display -BGP Routes by Community}). -@end deffn - -@deffn {Command} {show bgp @{ipv4|ipv6@} summary} {} -Show a bgp peer summary for the specified address family. -@end deffn - -@deffn {Command} {show bgp @{ipv4|ipv6@} neighbor [@var{peer}]} {} -This command shows information on a specific BGP @var{peer}. -@end deffn - -@deffn {Command} {show bgp @{ipv4|ipv6@} dampening dampened-paths} {} -Display paths suppressed due to dampening. -@end deffn - -@deffn {Command} {show bgp @{ipv4|ipv6@} dampening flap-statistics} {} -Display flap statistics of routes. -@end deffn - -@node Other BGP commands -@subsection Other BGP commands - -@deffn {Command} {clear bgp @{ipv4|ipv6@} *} {} -Clear all address family peers. -@end deffn - -@deffn {Command} {clear bgp @{ipv4|ipv6@} @var{peer}} {} -Clear peers which have addresses of X.X.X.X -@end deffn - -@deffn {Command} {clear bgp @{ipv4|ipv6@} @var{peer} soft in} {} -Clear peer using soft reconfiguration. -@end deffn - -@deffn {Command} {show debug} {} -@end deffn - -@deffn {Command} {debug event} {} -@end deffn - -@deffn {Command} {debug update} {} -@end deffn - -@deffn {Command} {debug keepalive} {} -@end deffn - -@deffn {Command} {no debug event} {} -@end deffn - -@deffn {Command} {no debug update} {} -@end deffn - -@deffn {Command} {no debug keepalive} {} -@end deffn - -@node Capability Negotiation -@section Capability Negotiation - -When adding IPv6 routing information exchange feature to BGP. There -were some proposals. @acronym{IETF,Internet Engineering Task Force} -@acronym{IDR, Inter Domain Routing} @acronym{WG, Working group} adopted -a proposal called Multiprotocol Extension for BGP. The specification -is described in @cite{RFC2283}. The protocol does not define new protocols. -It defines new attributes to existing BGP. When it is used exchanging -IPv6 routing information it is called BGP-4+. When it is used for -exchanging multicast routing information it is called MBGP. - -@command{bgpd} supports Multiprotocol Extension for BGP. So if remote -peer supports the protocol, @command{bgpd} can exchange IPv6 and/or -multicast routing information. - -Traditional BGP did not have the feature to detect remote peer's -capabilities, e.g. whether it can handle prefix types other than IPv4 -unicast routes. This was a big problem using Multiprotocol Extension -for BGP to operational network. @cite{RFC2842, Capabilities -Advertisement with BGP-4} adopted a feature called Capability -Negotiation. @command{bgpd} use this Capability Negotiation to detect -the remote peer's capabilities. If the peer is only configured as IPv4 -unicast neighbor, @command{bgpd} does not send these Capability -Negotiation packets (at least not unless other optional BGP features -require capability negotation). - -By default, Frr will bring up peering with minimal common capability -for the both sides. For example, local router has unicast and -multicast capabilitie and remote router has unicast capability. In -this case, the local router will establish the connection with unicast -only capability. When there are no common capabilities, Frr sends -Unsupported Capability error and then resets the connection. - -If you want to completely match capabilities with remote peer. Please -use @command{strict-capability-match} command. - -@deffn {BGP} {neighbor @var{peer} strict-capability-match} {} -@deffnx {BGP} {no neighbor @var{peer} strict-capability-match} {} -Strictly compares remote capabilities and local capabilities. If capabilities -are different, send Unsupported Capability error then reset connection. -@end deffn - -You may want to disable sending Capability Negotiation OPEN message -optional parameter to the peer when remote peer does not implement -Capability Negotiation. Please use @command{dont-capability-negotiate} -command to disable the feature. - -@deffn {BGP} {neighbor @var{peer} dont-capability-negotiate} {} -@deffnx {BGP} {no neighbor @var{peer} dont-capability-negotiate} {} -Suppress sending Capability Negotiation as OPEN message optional -parameter to the peer. This command only affects the peer is configured -other than IPv4 unicast configuration. -@end deffn - -When remote peer does not have capability negotiation feature, remote -peer will not send any capabilities at all. In that case, bgp -configures the peer with configured capabilities. - -You may prefer locally configured capabilities more than the negotiated -capabilities even though remote peer sends capabilities. If the peer -is configured by @command{override-capability}, @command{bgpd} ignores -received capabilities then override negotiated capabilities with -configured values. - -@deffn {BGP} {neighbor @var{peer} override-capability} {} -@deffnx {BGP} {no neighbor @var{peer} override-capability} {} -Override the result of Capability Negotiation with local configuration. -Ignore remote peer's capability value. -@end deffn - -@node Route Reflector -@section Route Reflector - -@deffn {BGP} {bgp cluster-id @var{a.b.c.d}} {} -@end deffn - -@deffn {BGP} {neighbor @var{peer} route-reflector-client} {} -@deffnx {BGP} {no neighbor @var{peer} route-reflector-client} {} -@end deffn - -@node Route Server -@section Route Server - -At an Internet Exchange point, many ISPs are connected to each other by -external BGP peering. Normally these external BGP connection are done by -@samp{full mesh} method. As with internal BGP full mesh formation, -this method has a scaling problem. - -This scaling problem is well known. Route Server is a method to resolve -the problem. Each ISP's BGP router only peers to Route Server. Route -Server serves as BGP information exchange to other BGP routers. By -applying this method, numbers of BGP connections is reduced from -O(n*(n-1)/2) to O(n). - -Unlike normal BGP router, Route Server must have several routing tables -for managing different routing policies for each BGP speaker. We call the -routing tables as different @code{view}s. @command{bgpd} can work as -normal BGP router or Route Server or both at the same time. - -@menu -* Multiple instance:: -* BGP instance and view:: -* Routing policy:: -* Viewing the view:: -@end menu - -@node Multiple instance -@subsection Multiple instance - -To enable multiple view function of @code{bgpd}, you must turn on -multiple instance feature beforehand. - -@deffn {Command} {bgp multiple-instance} {} -Enable BGP multiple instance feature. After this feature is enabled, -you can make multiple BGP instances or multiple BGP views. -@end deffn - -@deffn {Command} {no bgp multiple-instance} {} -Disable BGP multiple instance feature. You can not disable this feature -when BGP multiple instances or views exist. -@end deffn - -When you want to make configuration more Cisco like one, - -@deffn {Command} {bgp config-type cisco} {} -Cisco compatible BGP configuration output. -@end deffn - -When bgp config-type cisco is specified, - -``no synchronization'' is displayed. -``no auto-summary'' is displayed. - -``network'' and ``aggregate-address'' argument is displayed as -``A.B.C.D M.M.M.M'' - -Frr: network 10.0.0.0/8 -Cisco: network 10.0.0.0 - -Frr: aggregate-address 192.168.0.0/24 -Cisco: aggregate-address 192.168.0.0 255.255.255.0 - -Community attribute handling is also different. If there is no -configuration is specified community attribute and extended community -attribute are sent to neighbor. When user manually disable the -feature community attribute is not sent to the neighbor. In case of -@command{bgp config-type cisco} is specified, community attribute is not -sent to the neighbor by default. To send community attribute user has -to specify @command{neighbor A.B.C.D send-community} command. - -@example -! -router bgp 1 - neighbor 10.0.0.1 remote-as 1 - address-family ipv4 unicast - no neighbor 10.0.0.1 send-community - exit-address-family -! -router bgp 1 - neighbor 10.0.0.1 remote-as 1 - address-family ipv4 unicast - neighbor 10.0.0.1 send-community - exit-address-family -! -@end example - -@deffn {Command} {bgp config-type zebra} {} -Frr style BGP configuration. This is default. -@end deffn - -@node BGP instance and view -@subsection BGP instance and view - -BGP instance is a normal BGP process. The result of route selection -goes to the kernel routing table. You can setup different AS at the -same time when BGP multiple instance feature is enabled. - -@deffn {Command} {router bgp @var{as-number}} {} -Make a new BGP instance. You can use arbitrary word for the @var{name}. -@end deffn - -@example -@group -bgp multiple-instance -! -router bgp 1 - neighbor 10.0.0.1 remote-as 2 - neighbor 10.0.0.2 remote-as 3 -! -router bgp 2 - neighbor 10.0.0.3 remote-as 4 - neighbor 10.0.0.4 remote-as 5 -@end group -@end example - -BGP view is almost same as normal BGP process. The result of -route selection does not go to the kernel routing table. BGP view is -only for exchanging BGP routing information. - -@deffn {Command} {router bgp @var{as-number} view @var{name}} {} -Make a new BGP view. You can use arbitrary word for the @var{name}. This -view's route selection result does not go to the kernel routing table. -@end deffn - -With this command, you can setup Route Server like below. - -@example -@group -bgp multiple-instance -! -router bgp 1 view 1 - neighbor 10.0.0.1 remote-as 2 - neighbor 10.0.0.2 remote-as 3 -! -router bgp 2 view 2 - neighbor 10.0.0.3 remote-as 4 - neighbor 10.0.0.4 remote-as 5 -@end group -@end example - -@node Routing policy -@subsection Routing policy - -You can set different routing policy for a peer. For example, you can -set different filter for a peer. - -@example -@group -bgp multiple-instance -! -router bgp 1 view 1 - neighbor 10.0.0.1 remote-as 2 - address-family ipv4 unicast - neighbor 10.0.0.1 distribute-list 1 in - exit-address-family -! -router bgp 1 view 2 - neighbor 10.0.0.1 remote-as 2 - address-family ipv4 unicast - neighbor 10.0.0.1 distribute-list 2 in - exit-address-family -@end group -@end example - -This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view -2. When the update is inserted into view 1, distribute-list 1 is -applied. On the other hand, when the update is inserted into view 2, -distribute-list 2 is applied. - -@node Viewing the view -@subsection Viewing the view - -To display routing table of BGP view, you must specify view name. - -@deffn {Command} {show ip bgp view @var{name}} {} -Display routing table of BGP view @var{name}. -@end deffn - -@node BGP Regular Expressions -@section BGP Regular Expressions - -BGP regular expressions are based on @code{POSIX 1003.2} regular -expressions. The following description is just a quick subset of the -@code{POSIX} regular expressions. Adding to that, the special character -'_' is added. - -@table @code -@item . -Matches any single character. -@item * -Matches 0 or more occurrences of pattern. -@item + -Matches 1 or more occurrences of pattern. -@item ? -Match 0 or 1 occurrences of pattern. -@item ^ -Matches the beginning of the line. -@item $ -Matches the end of the line. -@item _ -Character @code{_} has special meanings in BGP regular expressions. -It matches to space and comma , and AS set delimiter @{ and @} and AS -confederation delimiter @code{(} and @code{)}. And it also matches to -the beginning of the line and the end of the line. So @code{_} can be -used for AS value boundaries match. This character technically evaluates -to @code{(^|[,@{@}() ]|$)}. -@end table - -@node How to set up a 6-Bone connection -@section How to set up a 6-Bone connection - - -@example -@group -zebra configuration -=================== -! -! Actually there is no need to configure zebra -! - -bgpd configuration -================== -! -! This means that routes go through zebra and into the kernel. -! -router zebra -! -! MP-BGP configuration -! -router bgp 7675 - bgp router-id 10.0.0.1 - neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as @var{as-number} -! - address-family ipv6 - network 3ffe:506::/32 - neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate - neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out - neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as @var{as-number} - neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out - exit-address-family -! -ipv6 access-list all permit any -! -! Set output nexthop address. -! -route-map set-nexthop permit 10 - match ipv6 address all - set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225 - set ipv6 nexthop local fe80::2c0:4fff:fe68:a225 -! -! logfile FILENAME is obsolete. Please use log file FILENAME - -log file bgpd.log -! -@end group -@end example - -@node Dump BGP packets and table -@section Dump BGP packets and table - -@deffn Command {dump bgp all @var{path} [@var{interval}]} {} -@deffnx Command {dump bgp all-et @var{path} [@var{interval}]} {} -@deffnx Command {no dump bgp all [@var{path}] [@var{interval}]} {} -Dump all BGP packet and events to @var{path} file. -If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. -The path @var{path} can be set with date and time formatting (strftime). -The type ‘all-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}). -(@pxref{Packet Binary Dump Format}) -@end deffn - -@deffn Command {dump bgp updates @var{path} [@var{interval}]} {} -@deffnx Command {dump bgp updates-et @var{path} [@var{interval}]} {} -@deffnx Command {no dump bgp updates [@var{path}] [@var{interval}]} {} -Dump only BGP updates messages to @var{path} file. -If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. -The path @var{path} can be set with date and time formatting (strftime). -The type ‘updates-et’ enables support for Extended Timestamp Header (@pxref{Packet Binary Dump Format}). -@end deffn - -@deffn Command {dump bgp routes-mrt @var{path}} {} -@deffnx Command {dump bgp routes-mrt @var{path} @var{interval}} {} -@deffnx Command {no dump bgp route-mrt [@var{path}] [@var{interval}]} {} -Dump whole BGP routing table to @var{path}. This is heavy process. -The path @var{path} can be set with date and time formatting (strftime). -If @var{interval} is set, a new file will be created for echo @var{interval} of seconds. -@end deffn - -Note: the interval variable can also be set using hours and minutes: 04h20m00. - - -@node BGP Configuration Examples -@section BGP Configuration Examples - -Example of a session to an upstream, advertising only one prefix to it. - -@example -router bgp 64512 - bgp router-id 10.236.87.1 - neighbor upstream peer-group - neighbor upstream remote-as 64515 - neighbor upstream capability dynamic - neighbor 10.1.1.1 peer-group upstream - neighbor 10.1.1.1 description ACME ISP - - address-family ipv4 unicast - network 10.236.87.0/24 - neighbor upstream prefix-list pl-allowed-adv out - exit-address-family -! -ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25 -ip prefix-list pl-allowed-adv seq 10 deny any - -@end example - -A more complex example. With upstream, peer and customer sessions. -Advertising global prefixes and NO_EXPORT prefixes and providing -actions for customer routes based on community values. Extensive use of -route-maps and the 'call' feature to support selective advertising of -prefixes. This example is intended as guidance only, it has NOT been -tested and almost certainly containts silly mistakes, if not serious -flaws. - -@example -router bgp 64512 - bgp router-id 10.236.87.1 - neighbor upstream capability dynamic - neighbor cust capability dynamic - neighbor peer capability dynamic - neighbor 10.1.1.1 remote-as 64515 - neighbor 10.1.1.1 peer-group upstream - neighbor 10.2.1.1 remote-as 64516 - neighbor 10.2.1.1 peer-group upstream - neighbor 10.3.1.1 remote-as 64517 - neighbor 10.3.1.1 peer-group cust-default - neighbor 10.3.1.1 description customer1 - neighbor 10.4.1.1 remote-as 64518 - neighbor 10.4.1.1 peer-group cust - neighbor 10.4.1.1 description customer2 - neighbor 10.5.1.1 remote-as 64519 - neighbor 10.5.1.1 peer-group peer - neighbor 10.5.1.1 description peer AS 1 - neighbor 10.6.1.1 remote-as 64520 - neighbor 10.6.1.1 peer-group peer - neighbor 10.6.1.1 description peer AS 2 - - address-family ipv4 unicast - network 10.123.456.0/24 - network 10.123.456.128/25 route-map rm-no-export - neighbor upstream route-map rm-upstream-out out - neighbor cust route-map rm-cust-in in - neighbor cust route-map rm-cust-out out - neighbor cust send-community both - neighbor peer route-map rm-peer-in in - neighbor peer route-map rm-peer-out out - neighbor peer send-community both - neighbor 10.3.1.1 prefix-list pl-cust1-network in - neighbor 10.4.1.1 prefix-list pl-cust2-network in - neighbor 10.5.1.1 prefix-list pl-peer1-network in - neighbor 10.6.1.1 prefix-list pl-peer2-network in - exit-address-family -! -ip prefix-list pl-default permit 0.0.0.0/0 -! -ip prefix-list pl-upstream-peers permit 10.1.1.1/32 -ip prefix-list pl-upstream-peers permit 10.2.1.1/32 -! -ip prefix-list pl-cust1-network permit 10.3.1.0/24 -ip prefix-list pl-cust1-network permit 10.3.2.0/24 -! -ip prefix-list pl-cust2-network permit 10.4.1.0/24 -! -ip prefix-list pl-peer1-network permit 10.5.1.0/24 -ip prefix-list pl-peer1-network permit 10.5.2.0/24 -ip prefix-list pl-peer1-network permit 192.168.0.0/24 -! -ip prefix-list pl-peer2-network permit 10.6.1.0/24 -ip prefix-list pl-peer2-network permit 10.6.2.0/24 -ip prefix-list pl-peer2-network permit 192.168.1.0/24 -ip prefix-list pl-peer2-network permit 192.168.2.0/24 -ip prefix-list pl-peer2-network permit 172.16.1/24 -! -ip as-path access-list asp-own-as permit ^$ -ip as-path access-list asp-own-as permit _64512_ -! -! ################################################################# -! Match communities we provide actions for, on routes receives from -! customers. Communities values of <our-ASN>:X, with X, have actions: -! -! 100 - blackhole the prefix -! 200 - set no_export -! 300 - advertise only to other customers -! 400 - advertise only to upstreams -! 500 - set no_export when advertising to upstreams -! 2X00 - set local_preference to X00 -! -! blackhole the prefix of the route -ip community-list standard cm-blackhole permit 64512:100 -! -! set no-export community before advertising -ip community-list standard cm-set-no-export permit 64512:200 -! -! advertise only to other customers -ip community-list standard cm-cust-only permit 64512:300 -! -! advertise only to upstreams -ip community-list standard cm-upstream-only permit 64512:400 -! -! advertise to upstreams with no-export -ip community-list standard cm-upstream-noexport permit 64512:500 -! -! set local-pref to least significant 3 digits of the community -ip community-list standard cm-prefmod-100 permit 64512:2100 -ip community-list standard cm-prefmod-200 permit 64512:2200 -ip community-list standard cm-prefmod-300 permit 64512:2300 -ip community-list standard cm-prefmod-400 permit 64512:2400 -ip community-list expanded cme-prefmod-range permit 64512:2... -! -! Informational communities -! -! 3000 - learned from upstream -! 3100 - learned from customer -! 3200 - learned from peer -! -ip community-list standard cm-learnt-upstream permit 64512:3000 -ip community-list standard cm-learnt-cust permit 64512:3100 -ip community-list standard cm-learnt-peer permit 64512:3200 -! -! ################################################################### -! Utility route-maps -! -! These utility route-maps generally should not used to permit/deny -! routes, i.e. they do not have meaning as filters, and hence probably -! should be used with 'on-match next'. These all finish with an empty -! permit entry so as not interfere with processing in the caller. -! -route-map rm-no-export permit 10 - set community additive no-export -route-map rm-no-export permit 20 -! -route-map rm-blackhole permit 10 - description blackhole, up-pref and ensure it cant escape this AS - set ip next-hop 127.0.0.1 - set local-preference 10 - set community additive no-export -route-map rm-blackhole permit 20 -! -! Set local-pref as requested -route-map rm-prefmod permit 10 - match community cm-prefmod-100 - set local-preference 100 -route-map rm-prefmod permit 20 - match community cm-prefmod-200 - set local-preference 200 -route-map rm-prefmod permit 30 - match community cm-prefmod-300 - set local-preference 300 -route-map rm-prefmod permit 40 - match community cm-prefmod-400 - set local-preference 400 -route-map rm-prefmod permit 50 -! -! Community actions to take on receipt of route. -route-map rm-community-in permit 10 - description check for blackholing, no point continuing if it matches. - match community cm-blackhole - call rm-blackhole -route-map rm-community-in permit 20 - match community cm-set-no-export - call rm-no-export - on-match next -route-map rm-community-in permit 30 - match community cme-prefmod-range - call rm-prefmod -route-map rm-community-in permit 40 -! -! ##################################################################### -! Community actions to take when advertising a route. -! These are filtering route-maps, -! -! Deny customer routes to upstream with cust-only set. -route-map rm-community-filt-to-upstream deny 10 - match community cm-learnt-cust - match community cm-cust-only -route-map rm-community-filt-to-upstream permit 20 -! -! Deny customer routes to other customers with upstream-only set. -route-map rm-community-filt-to-cust deny 10 - match community cm-learnt-cust - match community cm-upstream-only -route-map rm-community-filt-to-cust permit 20 -! -! ################################################################### -! The top-level route-maps applied to sessions. Further entries could -! be added obviously.. -! -! Customers -route-map rm-cust-in permit 10 - call rm-community-in - on-match next -route-map rm-cust-in permit 20 - set community additive 64512:3100 -route-map rm-cust-in permit 30 -! -route-map rm-cust-out permit 10 - call rm-community-filt-to-cust - on-match next -route-map rm-cust-out permit 20 -! -! Upstream transit ASes -route-map rm-upstream-out permit 10 - description filter customer prefixes which are marked cust-only - call rm-community-filt-to-upstream - on-match next -route-map rm-upstream-out permit 20 - description only customer routes are provided to upstreams/peers - match community cm-learnt-cust -! -! Peer ASes -! outbound policy is same as for upstream -route-map rm-peer-out permit 10 - call rm-upstream-out -! -route-map rm-peer-in permit 10 - set community additive 64512:3200 -@end example - -@include rpki.texi diff --git a/doc/cli.md b/doc/cli.md deleted file mode 100644 index 723237ebb..000000000 --- a/doc/cli.md +++ /dev/null @@ -1,557 +0,0 @@ -FRR Command Line Interface -========================== - -Definition Grammar ------------------- - -This is a reference for the syntax used when defining new CLI commands. An -example definition is: - -``` -DEFUN (command_name, - command_name_cmd, ---> "example <command|line [interface]> DEFINITION...", - <..doc strings..>) -``` - -The arrowed part is the definition string. - -Explicit syntax rules in Flex and Bison may be found in lib/command_lex.l and -lib/command_parse.y, respectively. If you can read BNF and regex those will be -more useful than this document. - -If the parser is throwing syntax or other errors and you can't figure out why, -it's unlikely to be a bug in the parser. If the error message is not useful, -please file a bug for a better error message. If all else fails, read the token -definitions in the lexer source and the Bison BNF in the parser source. - -Characters allowed in each token type: - -Tokens ------- -* `WORD` -- A token that begins with +, -, or a lowercase letter. It is - an unchanging part of the command and will only match itself. - Example: "show ip bgp", every token is a WORD. -* `IPV4` -- 'A.B.C.D', matches an IPv4 address. -* `IPV6` -- 'X:X::X:X', matches an IPv6 address. -* `IPV4_PREFIX` -- 'A.B.C.D/M', matches an IPv4 prefix in CIDR notation. -* `IPV6_PREFIX` -- 'X:X::X:X/M', matches an IPv6 prefix in CIDR notation. -* `MAC` -- 'M:A:C', matches a 48-bit mac address -* `MAC_PREFIX` -- 'M:A:C/M', matches a 48-bit mac address with a mask -* `VARIABLE` -- Begins with a capital letter. Matches any input. -* `RANGE` -- Numeric range delimited by parentheses, e.g. (-100 - 100) or - (10-20). Will only match numbers in the range. - -Rules ------ -* `<angle|brackets>` -- Contain sequences of tokens separated by pipes and - provide mutual exclusion. Sequences may contain - `<mutual|exclusion>` but not as the first token. - Disallowed: `"example <<a|b> c|d>"` - Allowed: `"example <a c|b c|d>"` -* `[square brackets]` -- Contains sequences of tokens that are optional (can be - omitted). `[<a|b>]` can be shortened to `[a|b]`. -* `{curly|braces}` -- similar to angle brackets, but instead of mutual - exclusion, curly braces indicate that one or more of the - pipe-separated sequences may be provided in any order. -* `VARIADICS...` -- Any token which accepts input (so anything except WORD) - and that occurs as the last token of a line may be - followed by an ellipsis, which indicates that input - matching the token may be repeated an unlimited number - of times. -* `$name` -- Specify a variable name for the preceding token. See - "Variable Names" below. - -Some general notes: - -* Options are allowed at the beginning of the command. The developer is - entreated to use these extremely sparingly. They are most useful for - implementing the 'no' form of configuration commands. Please think carefully - before using them for anything else. There is usually a better solution, even - if it is just separating out the command definition into separate ones. - -* The developer should judiciously apply separation of concerns when defining - CLI. CLI definitions for two unrelated or vaguely related commands or - configuration items should be defined in separate commands. Clarity is - preferred over LOC (within reason). - -* The maximum number of space-separated tokens that can be entered is presently - limited to 256. Please keep this limit in mind when implementing new CLI. - -Variable Names --------------- -The parser tries to fill the "varname" field on each token. This can happen -either manually or automatically. Manual specifications work by appending -`"$name"` after the input specifier: - -``` -foo bar$cmd WORD$name A.B.C.D$ip -``` - -Note that you can also assign variable names to fixed input tokens, this can -be useful if multiple commands share code. You can also use "$name" after a -multiple-choice option: - -``` -foo bar <A.B.C.D|X:X::X:X>$addr [optionA|optionB]$mode -``` - -The variable name is in this case assigned to the last token in each of the -branches. - -Automatic assignment of variable names works by applying the following rules: - -- manual names always have priority -- a "[no]" at the beginning receives "no" as varname on the "no" token -- VARIABLE tokens whose text is not "WORD" or "NAME" receive a cleaned lowercase - version of the token text as varname, e.g. "ROUTE-MAP" becomes "route_map". -- other variable tokens (i.e. everything except "fixed") receive the text of - the preceding fixed token as varname, if one can be found. E.g.: - "ip route A.B.C.D/M INTERFACE" assigns "route" to the "A.B.C.D/M" token. - -These rules should make it possible to avoid manual varname assignment in 90% -of the cases. - -DEFPY ------ - -`DEFPY(...)` is an enhanced version of `DEFUN()` which is preprocessed by -` python/clidef.py`. The python script parses the command definition string, -extracts variable names and types, and generates a C wrapper function that -parses the variables and passes them on. This means that in the CLI function -body, you will receive additional parameters with appropriate types. - -This is best explained by an example: - -``` -DEFPY(func, func_cmd, "[no] foo bar A.B.C.D (0-99)$num", "...help...") - -=> - -func(self, vty, argc, argv, /* standard CLI arguments */ - - const char *no, /* unparsed "no" */ - struct in_addr bar, /* parsed IP address */ - const char *bar_str, /* unparsed IP address */ - long num, /* parsed num */ - const char *num_str) /* unparsed num */ -``` - -Note that as documented in the previous section, "bar" is automatically -applied as variable name for "A.B.C.D". The python code then detects this -is an IP address argument and generates code to parse it into a -`struct in_addr`, passing it in `bar`. The raw value is passed in `bar_str`. -The range/number argument works in the same way with the explicitly given -variable name. - -### Type rules - -| Token(s) | Type | Value if omitted by user | -|--------------------------|-------------|--------------------------| -| `A.B.C.D` | `struct in_addr` | 0.0.0.0 | -| `X:X::X:X` | `struct in6_addr` | :: | -| `A.B.C.D + X:X::X:X` | `const union sockunion *` | NULL | -| `A.B.C.D/M` | `const struct prefix_ipv4 *` | NULL | -| `X:X::X:X/M` | `const struct prefix_ipv6 *` | NULL | -| `A.B.C.D/M + X:X::X:X/M` | `const struct prefix *` | NULL | -| `(0-9)` | `long` | 0 | -| `VARIABLE` | `const char *` | NULL | -| `word` | `const char *` | NULL | -| _all other_ | `const char *` | NULL | - -Note the following details: - -* not all parameters are pointers, some are passed as values. -* when the type is not `const char *`, there will be an extra `_str` argument - with type `const char *`. -* you can give a variable name not only to `VARIABLE` tokens but also to - `word` tokens (e.g. constant words). This is useful if some parts of a - command are optional. The type will be `const char *`. -* `[no]` will be passed as `const char *no`. -* pointers will be NULL when the argument is optional and the user did not - use it. -* if a parameter is not a pointer, but is optional and the user didn't use it, - the default value will be passed. Check the `_str` argument if you need to - determine whether the parameter was omitted. -* if the definition contains multiple parameters with the same variable name, - they will be collapsed into a single function parameter. The python code - will detect if the types are compatible (i.e. IPv4 + IPv6 variantes) and - choose a corresponding C type. -* the standard DEFUN parameters (self, vty, argc, argv) are still present and - can be used. A DEFUN can simply be **edited into a DEFPY without further - changes and it will still work**; this allows easy forward migration. -* a file may contain both DEFUN and DEFPY statements. - -### Getting a parameter dump - -The clidef.py script can be called to get a list of DEFUNs/DEFPYs with -the parameter name/type list: - -``` -lib/clippy python/clidef.py --all-defun --show lib/plist.c > /dev/null -``` - -The generated code is printed to stdout, the info dump to stderr. The -`--all-defun` argument will make it process DEFUN blocks as well as DEFPYs, -which is useful prior to converting some DEFUNs. **The dump does not list -the `_str` arguments** to keep the output shorter. - -Note that the clidef.py script cannot be run with python directly, it needs -to be run with _clippy_ since the latter makes the CLI parser available. - -### Include & Makefile requirements - -A source file that uses DEFPY needs to include the `_clippy.c` file **before -all DEFPY statements**: - -``` -/* GPL header */ -#include ... - -... - -#include "daemon/filename_clippy.c" - -DEFPY(...) -DEFPY(...) - -install_element(...) -``` - -This dependency needs to be marked in Makefile.am: (there is no ordering -requirement) - -``` -include ../common.am - -# ... - -# if linked into a LTLIBRARY (.la/.so): -filename.lo: filename_clippy.c - -# if linked into an executable or static library (.a): -filename.o: filename_clippy.c -``` - -Doc Strings ------------ -Each token in a command definition should be documented with a brief doc -string that informs a user of the meaning and/or purpose of the subsequent -command tree. These strings are provided as the last parameter to DEFUN macros, -concatenated together and separated by an escaped newline ('\n'). These are -best explained by example. - -``` -DEFUN (config_terminal, - config_terminal_cmd, - "configure terminal", - "Configuration from vty interface\n" - "Configuration terminal\n") -``` - -The last parameter is split into two lines for readability. Two newline -delimited doc strings are present, one for each token in the command. The -second string documents the functionality of the 'terminal' command in the -'configure' tree. - -Note that the first string, for 'configure' does not contain documentation for -'terminal'. This is because the CLI is best envisioned as a tree, with tokens -defining branches. An imaginary 'start' token is the root of every command in a -CLI node. Each subsequent written token descends into a subtree, so the -documentation for that token ideally summarizes all the functionality contained -in the subtree. - -A consequence of this structure is that the developer must be careful to use -the same doc strings when defining multiple commands that are part of the same -tree. Commands which share prefixes must share the same doc strings for those -prefixes. On startup the parser will generate warnings if it notices -inconsistent doc strings. Behavior is undefined; the same token may show up -twice in completions, with different doc strings, or it may show up once with a -random doc string. Parser warnings should be heeded and fixed to avoid -confusing users. - -The number of doc strings provided must be equal to the amount of tokens -present in the command definition, read left to right, ignoring any special -constructs. - -In the examples below, each arrowed token needs a doc string. - -``` - "show ip bgp" - ^ ^ ^ - - "command <foo|bar> [example]" - ^ ^ ^ ^ -``` - -Data Structures ---------------- -On startup, the CLI parser sequentially parses each command string definition -and constructs a directed graph with each token forming a node. This graph is -the basis of the entire CLI system. It is used to match user input in order to -generate command completions and match commands to functions. - -There is one graph per CLI node (not the same as a graph node in the CLI -graph). The CLI node struct keeps a reference to its graph (see lib/command.h). - -While most of the graph maintains the form of a tree, special constructs -outlined in the Rules section introduce some quirks. <>, [] and {} form -self-contained 'subgraphs'. Each subgraph is a tree except that all of the -'leaves' actually share a child node. This helps with minimizing graph size and -debugging. - -As an example, the subgraph generated by <foo|bar> looks like this: - - . - . - | - +----+---+ - +--- -+ FORK +----+ - | +--------+ | - +--v---+ +--v---+ - | foo | | bar | - +--+---+ +--+---+ - | +------+ | - +------> JOIN <-----+ - +---+--+ - | - . - . - -FORK and JOIN nodes are plumbing nodes that don't correspond to user input. -They're necessary in order to deduplicate these constructs where applicable. - -Options follow the same form, except that there is an edge from the FORK node -to the JOIN node. - -Keywords follow the same form, except that there is an edge from JOIN to FORK. -Because of this the CLI graph cannot be called acyclic. There is special logic -in the input matching code that keeps a stack of paths already taken through -the node in order to disallow following the same path more than once. - -Variadics are a bit special; they have an edge back to themselves, which allows -repeating the same input indefinitely. - -The leaves of the graph are nodes that have no out edges. These nodes are -special; their data section does not contain a token, as most nodes do, or -NULL, as in FORK/JOIN nodes, but instead has a pointer to a cmd_element. All -paths through the graph that terminate on a leaf are guaranteed to be defined -by that command. When a user enters a complete command, the command matcher -tokenizes the input and executes a DFS on the CLI graph. If it is -simultaneously able to exhaust all input (one input token per graph node), and -then find exactly one leaf connected to the last node it reaches, then the -input has matched the corresponding command and the command is executed. If it -finds more than one node, then the command is ambiguous (more on this in -deduplication). If it cannot exhaust all input, the command is unknown. If it -exhausts all input but does not find an edge node, the command is incomplete. - -The parser uses an incremental strategy to build the CLI graph for a node. Each -command is parsed into its own graph, and then this graph is merged into the -overall graph. During this merge step, the parser makes a best-effort attempt -to remove duplicate nodes. If it finds a node in the overall graph that is -equal to a node in the corresponding position in the command graph, it will -intelligently merge the properties from the node in the command graph into the -already-existing node. Subgraphs are also checked for isomorphism and merged -where possible. The definition of whether two nodes are 'equal' is based on the -equality of some set of token properties; read the parser source for the most -up-to-date definition of equality. - -When the parser is unable to deduplicate some complicated constructs, this -can result in two identical paths through separate parts of the graph. If -this occurs and the user enters input that matches these paths, they will -receive an 'ambiguous command' error and will be unable to execute the command. -Most of the time the parser can detect and warn about duplicate commands, but -it will not always be able to do this. Hence care should be taken before -defining a new command to ensure it is not defined elsewhere. - - -Command handlers ----------------- -The block that follows a CLI definition is executed when a user enters input -that matches the definition. Its function signature looks like this: - -int (*func) (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); - -The first argument is the command definition struct. The last argument is an -ordered array of tokens that correspond to the path taken through the graph, -and the argument just prior to that is the length of the array. - -The arrangement of the token array has changed from the prior incarnation of -the CLI system. In the old system, missing arguments were padded with NULLs so -that the same parts of a command would show up at the same indices regardless -of what was entered. The new system does not perform such padding and therefore -it is generally _incorrect_ to assume consistent indices in this array. As a -simple example: - -Command definition: -``` - command [foo] <bar|baz> -``` - -User enters: -``` - command foo bar -``` - -Array: -``` - [0] -> command - [1] -> foo - [2] -> bar -``` - -User enters: -``` - command baz -``` - -Array: -``` - [0] -> command - [1] -> baz -``` - - - -Command abbreviation & matching priority ----------------------------------------- -As in the prior implementation, it is possible for users to elide parts of -tokens when the CLI matcher does not need them to make an unambiguous match. -This is best explained by example. - -Command definitions: -``` - command dog cow - command dog crow -``` - -User input: -``` - c d c -> ambiguous command - c d co -> match "command dog cow" -``` - -In the new implementation, this functionality has improved. Where previously -the parser would stop at the first ambiguous token, it will now look ahead and -attempt to disambiguate based on tokens later on in the input string. - -Command definitions: -``` - show ip bgp A.B.C.D - show ipv6 bgp X:X::X:X -``` - -User enters: -``` - s i b 4.3.2.1 -> match "show ip bgp A.B.C.D" - s i b ::e0 -> match "show ipv6 bgp X:X::X:X" -``` - -Previously both of these commands would be ambiguous since 'i' does not -explicitly select either 'ip' or 'ipv6'. However, since the user later provides -a token that matches only one of the commands (an IPv4 or IPv6 address) the -parser is able to look ahead and select the appropriate command. This has some -implications for parsing the argv*[] that is passed to the command handler. - -Now consider a command definition such as: -``` - command <foo|VAR> -``` - -'foo' only matches the string 'foo', but 'VAR' matches any input, including -'foo'. Who wins? In situations like this the matcher will always choose the -'better' match, so 'foo' will win. - -Consider also: -``` - show <ip|ipv6> foo -``` - -User input: -``` - show ip foo -``` - -'ip' partially matches 'ipv6' but exactly matches 'ip', so 'ip' will win. - - -struct cmd_token ----------------- - -``` -/* Command token struct. */ -struct cmd_token -{ - enum cmd_token_type type; // token type - u_char attr; // token attributes - bool allowrepeat; // matcher allowed to match token repetitively? - - char *text; // token text - char *desc; // token description - long long min, max; // for ranges - char *arg; // user input that matches this token - char *varname; // variable name -}; -``` - -This struct is used in the CLI graph to match input against. It is also used to -pass user input to command handler functions, as it is frequently useful for -handlers to have access to that information. When a command is matched, the -sequence of cmd_tokens that form the matching path are duplicated and placed in -order into argv*[]. Before this happens the ->arg field is set to point at the -snippet of user input that matched it. - -For most nontrivial commands the handler function will need to determine which -of the possible matching inputs was entered. Previously this was done by -looking at the first few characters of input. This is now considered an -anti-pattern and should be avoided. Instead, the ->type or ->text fields for -this logic. The ->type field can be used when the possible inputs differ in -type. When the possible types are the same, use the ->text field. This field -has the full text of the corresponding token in the definition string and using -it makes for much more readable code. An example is helpful. - -Command definition: -``` - command <(1-10)|foo|BAR> -``` - -In this example, the user may enter any one of: - * an integer between 1 and 10 - * "foo" - * anything at all - -If the user enters "command f", then: - -``` -argv[1]->type == WORD_TKN -argv[1]->arg == "f" -argv[1]->text == "foo" -``` - -Range tokens have some special treatment; a token with ->type == RANGE_TKN will -have the ->min and ->max fields set to the bounding values of the range. - - -Permutations ------------- -Finally, it is sometimes useful to check all the possible combinations of input -that would match an arbitrary definition string. There is a tool in tools/ -called 'permutations' that reads CLI definition strings on stdin and prints out -all matching input permutations. It also dumps a text representation of the -graph, which is more useful for debugging than anything else. It looks like -this: - -``` -$ ./permutations "show [ip] bgp [<view|vrf> WORD]" - -show ip bgp view WORD -show ip bgp vrf WORD -show ip bgp -show bgp view WORD -show bgp vrf WORD -show bgp -``` - -This functionality is also built into VTY/VTYSH; the 'list permutations' -command will list all possible matching input permutations in the current CLI -node. diff --git a/doc/defines.texi.in b/doc/defines.texi.in deleted file mode 100644 index b2af89e40..000000000 --- a/doc/defines.texi.in +++ /dev/null @@ -1,21 +0,0 @@ -@c -*- texinfo -*- -@c @configure_input@ - -@c Set variables -@set PACKAGE_NAME @PACKAGE_NAME@ -@set PACKAGE_TARNAME @PACKAGE_TARNAME@ -@set PACKAGE_STRING @PACKAGE_STRING@ -@set PACKAGE_URL @PACKAGE_URL@ -@set PACKAGE_VERSION @PACKAGE_VERSION@ -@set AUTHORS Kunihiro Ishiguro, et al. -@set COPYRIGHT_YEAR 1999-2005 -@set COPYRIGHT_STR Copyright @copyright{} @value{COPYRIGHT_YEAR} @value{AUTHORS} - -@c These may vary with installation environment. -@set INSTALL_PREFIX_ETC @CFG_SYSCONF@ -@set INSTALL_PREFIX_SBIN @CFG_SBIN@ -@set INSTALL_PREFIX_STATE @CFG_STATE@ -@set INSTALL_PREFIX_MODULES @CFG_MODULE@ -@set INSTALL_USER @enable_user@ -@set INSTALL_GROUP @enable_group@ -@set INSTALL_VTY_GROUP @enable_vty_group@ diff --git a/doc/code/.gitignore b/doc/developer/.gitignore index 050553715..050553715 100644 --- a/doc/code/.gitignore +++ b/doc/developer/.gitignore diff --git a/doc/BGP-TypeCode b/doc/developer/BGP-TypeCode index b3218079c..b3218079c 100644 --- a/doc/BGP-TypeCode +++ b/doc/developer/BGP-TypeCode diff --git a/doc/Building_FRR_on_CentOS6.md b/doc/developer/Building_FRR_on_CentOS6.rst index 10830e501..1c53ea6ba 100644 --- a/doc/Building_FRR_on_CentOS6.md +++ b/doc/developer/Building_FRR_on_CentOS6.rst @@ -1,46 +1,67 @@ -Building FRR on CentOS 6 from Git Source +CentOS 6 ======================================== (As an alternative to this installation, you may prefer to create a FRR -rpm package yourself and install that package instead. See instructions -in redhat/README.rpm_build.md on how to build a rpm package) +rpm package yourself and install that package instead. See instructions +in redhat/README.rpm\_build.md on how to build a rpm package) -Instructions are tested with `CentOS 6.8` on `x86_64` platform +Instructions are tested with ``CentOS 6.8`` on ``x86_64`` platform + +Warning: +-------- +``CentOS 6`` is very old and not fully supported by the FRR community +anymore. Building FRR takes multiple manual steps to update the build +system with newer packages than what's available from the archives. +However, the built packages can still be installed afterwards on +a standard ``CentOS 6`` without any special packages. + +Support for CentOS 6 is now on a best-effort base by the community. CentOS 6 restrictions: ---------------------- -- PIMd is not supported on `CentOS 6`. Upgrade to `CentOS 7` if PIMd is - needed -- MPLS is not supported on `CentOS 6`. MPLS requires Linux Kernel 4.5 or - higher (LDP can be built, but may have limited use without MPLS) -- Zebra is unable to detect what bridge/vrf an interface is associcated - with (IFLA_INFO_SLAVE_KIND does not exist in the kernel headers, you - can use a newer kernel + headers to get this functionality) -- frr_reload.py will not work, as this requires Python 2.7, and CentOS 6 - only has 2.6. You can install Python 2.7 via IUS, but it won't work - properly unless you compile and install the ipaddr package for it. +- PIMd is not supported on ``CentOS 6``. Upgrade to ``CentOS 7`` if + PIMd is needed +- MPLS is not supported on ``CentOS 6``. MPLS requires Linux Kernel 4.5 + or higher (LDP can be built, but may have limited use without MPLS) +- Zebra is unable to detect what bridge/vrf an interface is associcated + with (IFLA\_INFO\_SLAVE\_KIND does not exist in the kernel headers, + you can use a newer kernel + headers to get this functionality) +- frr\_reload.py will not work, as this requires Python 2.7, and CentOS + 6 only has 2.6. You can install Python 2.7 via IUS, but it won't work + properly unless you compile and install the ipaddr package for it. +- Building the package requires Sphinx >= 1.1. Only a non-standard + package provides a newer sphinx and requires manual installation + (see below) + Install required packages ------------------------- Add packages: +:: + sudo yum install git autoconf automake libtool make gawk \ readline-devel texinfo net-snmp-devel groff pkgconfig \ json-c-devel pam-devel flex epel-release perl-XML-LibXML \ c-ares-devel -Install newer version of bison (CentOS 6 package source is too old) from +Install newer version of bison (CentOS 6 package source is too old) from CentOS 7 +:: + sudo yum install rpm-build curl -O http://vault.centos.org/7.0.1406/os/Source/SPackages/bison-2.7-4.el7.src.rpm rpmbuild --rebuild ./bison-2.7-4.el7.src.rpm sudo yum install ./rpmbuild/RPMS/x86_64/bison-2.7-4.el6.x86_64.rpm rm -rf rpmbuild -Install newer version of autoconf and automake (Package versions are too old) +Install newer version of autoconf and automake (Package versions are too +old) + +:: curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar xvf autoconf-2.69.tar.gz @@ -49,7 +70,7 @@ Install newer version of autoconf and automake (Package versions are too old) make sudo make install cd .. - + curl -O http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz tar xvf automake-1.15.tar.gz cd automake-1.15 @@ -58,35 +79,69 @@ Install newer version of autoconf and automake (Package versions are too old) sudo make install cd .. -Install `Python 2.7` in parallel to default 2.6. -Make sure you've install EPEL (`epel-release` as above). Then install current -`python27`, `python27-devel` and `pytest` +Install ``Python 2.7`` in parallel to default 2.6. Make sure you've +install EPEL (``epel-release`` as above). Then install current +``python27``, ``python27-devel`` and ``pytest`` + +:: sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm sudo rpm -ivh https://centos6.iuscommunity.org/ius-release.rpm sudo yum install python27 python27-pip python27-devel sudo pip2.7 install pytest -Please note that `CentOS 6` needs to keep python pointing to version 2.6 -for `yum` to keep working, so don't create a symlink for python2.7 to python +Please note that ``CentOS 6`` needs to keep python pointing to version +2.6 for ``yum`` to keep working, so don't create a symlink for python2.7 +to python + +Install newer ``Sphinx-Build`` based on ``Python 2.7`` + +Create a new repo ``/etc/yum.repos.d/puias6.repo`` with the following contents: + +:: + + ### Name: RPM Repository for RHEL 6 - PUIAS (used for Sphinx-Build) + ### URL: http://springdale.math.ias.edu/data/puias/computational + [puias-computational] + name = RPM Repository for RHEL 6 - Sphinx-Build + baseurl = http://springdale.math.ias.edu/data/puias/computational/$releasever/$basearch + #mirrorlist = + enabled = 1 + protect = 0 + gpgkey = + gpgcheck = 0 + +Update rpm database & Install newer sphinx + +:: + + sudo yum update + sudo yum install python27-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvt sudo useradd -u 92 -g 92 -M -r -G frrvt -s /sbin/nologin \ -c "FRR FRRouting suite" -d /var/run/frr frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -116,11 +171,15 @@ an example.) --enable-babeld \ --with-pkg-git-version \ --with-pkg-extra-version=-MyOwnFRRVersion - make - make check PYTHON=/usr/bin/python2.7 - sudo make install + make SPHINXBUILD=sphinx-build2.7 + make check PYTHON=/usr/bin/python2.7 SPHINXBUILD=sphinx-build2.7 + sudo make SPHINXBUILD=sphinx-build2.7 install + +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: -### Create empty FRR configuration files sudo mkdir /var/log/frr sudo mkdir /etc/frr sudo touch /etc/frr/zebra.conf @@ -138,20 +197,28 @@ an example.) sudo chown frr:frrvt /etc/frr/vtysh.conf sudo chmod 640 /etc/frr/*.conf -### Install daemon config file +Install daemon config file +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 644 redhat/daemons /etc/frr/ sudo chown frr:frr /etc/frr/daemons -### Edit /etc/frr/daemons as needed to select the required daemons +Edit /etc/frr/daemons as needed to select the required daemons +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Look for the section with `watchfrr_enable=...` and `zebra=...` etc. -Enable the daemons as required by changing the value to `yes` +Look for the section with ``watchfrr_enable=...`` and ``zebra=...`` etc. +Enable the daemons as required by changing the value to ``yes`` -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and set the following values (ignore the other +Edit ``/etc/sysctl.conf`` and set the following values (ignore the other settings) +:: + # Controls IP packet forwarding net.ipv4.ip_forward = 1 net.ipv6.conf.all.forwarding=1 @@ -161,14 +228,28 @@ settings) Load the modifed sysctl's on the system: +:: + sudo sysctl -p /etc/sysctl.d/90-routing-sysctl.conf -### Add init.d startup files +Add init.d startup files +~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 755 redhat/frr.init /etc/init.d/frr sudo chkconfig --add frr -### Enable frr daemon at startup +Enable frr daemon at startup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo chkconfig frr on -### Start FRR manually (or reboot) +Start FRR manually (or reboot) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo /etc/init.d/frr start diff --git a/doc/Building_FRR_on_CentOS7.md b/doc/developer/Building_FRR_on_CentOS7.rst index 38802483b..9807543e1 100644 --- a/doc/Building_FRR_on_CentOS7.md +++ b/doc/developer/Building_FRR_on_CentOS7.rst @@ -1,44 +1,53 @@ -Building FRR on CentOS 7 from Git Source +CentOS 7 ======================================== (As an alternative to this installation, you may prefer to create a FRR rpm package yourself and install that package instead. See instructions -in redhat/README.rpm_build.md on how to build a rpm package) +in redhat/README.rpm\_build.md on how to build a rpm package) CentOS 7 restrictions: ---------------------- -- MPLS is not supported on `CentOS 7` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use - without MPLS) - +- MPLS is not supported on ``CentOS 7`` with default kernel. MPLS + requires Linux Kernel 4.5 or higher (LDP can be built, but may have + limited use without MPLS) + Install required packages ------------------------- Add packages: +:: + sudo yum install git autoconf automake libtool make gawk \ readline-devel texinfo net-snmp-devel groff pkgconfig \ json-c-devel pam-devel bison flex pytest c-ares-devel \ - perl-XML-LibXML python-devel systemd-devel + perl-XML-LibXML python-devel systemd-devel python-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvt sudo useradd -u 92 -g 92 -M -r -G frrvt -s /sbin/nologin \ -c "FRR FRRouting suite" -d /var/run/frr frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -73,7 +82,11 @@ an example.) make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /var/log/frr sudo mkdir /etc/frr sudo touch /etc/frr/zebra.conf @@ -92,20 +105,28 @@ an example.) sudo chown frr:frrvt /etc/frr/vtysh.conf sudo chmod 640 /etc/frr/*.conf -### Install daemon config file +Install daemon config file +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 644 redhat/daemons /etc/frr/ sudo chown frr:frr /etc/frr/daemons -### Edit /etc/frr/daemons as needed to select the required daemons +Edit /etc/frr/daemons as needed to select the required daemons +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Look for the section with `watchfrr_enable=...` and `zebra=...` etc. -Enable the daemons as required by changing the value to `yes` +Look for the section with ``watchfrr_enable=...`` and ``zebra=...`` etc. +Enable the daemons as required by changing the value to ``yes`` -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Create a new file `/etc/sysctl.d/90-routing-sysctl.conf` with the +Create a new file ``/etc/sysctl.d/90-routing-sysctl.conf`` with the following content: +:: + # Sysctl for routing # # Routing: We need to forward packets @@ -114,17 +135,35 @@ following content: Load the modifed sysctl's on the system: +:: + sudo sysctl -p /etc/sysctl.d/90-routing-sysctl.conf -### Install frr Service and redhat init files +Install frr Service and redhat init files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 644 redhat/frr.service /usr/lib/systemd/system/frr.service sudo install -p -m 755 redhat/frr.init /usr/lib/frr/frr -### Register the systemd files +Register the systemd files +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo systemctl preset frr.service - -### Enable required frr at startup + +Enable required frr at startup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo systemctl enable frr -### Reboot or start FRR manually +Reboot or start FRR manually +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo systemctl start frr diff --git a/doc/Building_FRR_on_Debian8.md b/doc/developer/Building_FRR_on_Debian8.rst index a2dbbdb30..36ed0c4e6 100644 --- a/doc/Building_FRR_on_Debian8.md +++ b/doc/developer/Building_FRR_on_Debian8.rst @@ -1,33 +1,40 @@ -Building FRR on Debian 8 from Git Source +Debian 8 ======================================== Debian 8 restrictions: ---------------------- -- MPLS is not supported on `Debian 8` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use - without MPLS) +- MPLS is not supported on ``Debian 8`` with default kernel. MPLS + requires Linux Kernel 4.5 or higher (LDP can be built, but may have + limited use without MPLS) Install required packages ------------------------- Add packages: +:: + sudo apt-get install git autoconf automake libtool make gawk \ libreadline-dev texinfo libjson-c-dev pkg-config bison flex \ - python-pip libc-ares-dev python3-dev + python-pip libc-ares-dev python3-dev python3-sphinx + +Install newer pytest (>3.0) from pip -Install newer pytest (>3.0) from pip +:: - sudo pip install pytest + sudo pip install pytest Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo addgroup --system --gid 92 frr sudo addgroup --system --gid 85 frrvty @@ -35,10 +42,14 @@ any packages** --gecos "FRR suite" --shell /bin/false frr sudo usermod -a -G frrvty frr -### Download Source, configure and compile it +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -63,12 +74,15 @@ an example.) --enable-fpm \ --enable-ldpd \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo install -m 755 -o frr -g frr -d /var/log/frr sudo install -m 775 -o frr -g frrvty -d /etc/frr @@ -84,11 +98,14 @@ an example.) sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit ``/etc/sysctl.conf`` and uncomment the following values (ignore the other settings) +:: + # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 @@ -97,35 +114,43 @@ other settings) # based on Router Advertisements for this host net.ipv6.conf.all.forwarding=1 -**Reboot** or use `sysctl -p` to apply the same config to the running system +**Reboot** or use ``sysctl -p`` to apply the same config to the running +system -### Troubleshooting +Troubleshooting +~~~~~~~~~~~~~~~ **Local state directory** -The local state directory must exist and have the correct permissions applied -for the frrouting daemons to start. In the above ./configure example the -local state directory is set to /var/run/frr (--localstatedir=/var/run/frr) -Debian considers /var/run/frr to be temporary and this is removed after a -reboot. +The local state directory must exist and have the correct permissions +applied for the frrouting daemons to start. In the above ./configure +example the local state directory is set to /var/run/frr +(--localstatedir=/var/run/frr) Debian considers /var/run/frr to be +temporary and this is removed after a reboot. When using a different local state directory you need to create the new directory and change the ownership to the frr user, for example: +:: + mkdir /var/opt/frr chown frr /var/opt/frr **Shared library error** -If you try and start any of the frrouting daemons you may see the below error -due to the frrouting shared library directory not being found: +If you try and start any of the frrouting daemons you may see the below +error due to the frrouting shared library directory not being found: + +:: ./zebra: error while loading shared libraries: libfrr.so.0: cannot open shared object file: No such file or directory -The fix is to add the following line to /etc/ld.so.conf which will continue to -reference the library directory after the system reboots. To load the library -directory path immediately run the ldconfig command after adding the line to -the file eg: +The fix is to add the following line to /etc/ld.so.conf which will +continue to reference the library directory after the system reboots. To +load the library directory path immediately run the ldconfig command +after adding the line to the file eg: + +:: echo include /usr/local/lib >> /etc/ld.so.conf ldconfig diff --git a/doc/Building_FRR_on_Debian9.md b/doc/developer/Building_FRR_on_Debian9.rst index e2d424a3e..a1aa63236 100644 --- a/doc/Building_FRR_on_Debian9.md +++ b/doc/developer/Building_FRR_on_Debian9.rst @@ -1,4 +1,4 @@ -Building FRR on Debian 9 from Git Source +Debian 9 ======================================== Install required packages @@ -6,17 +6,22 @@ Install required packages Add packages: +:: + sudo apt-get install git autoconf automake libtool make \ libreadline-dev texinfo libjson-c-dev pkg-config bison flex \ - python-pip libc-ares-dev python3-dev python-pytest + python-pip libc-ares-dev python3-dev python-pytest python3-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo addgroup --system --gid 92 frr sudo addgroup --system --gid 85 frrvty @@ -24,10 +29,14 @@ any packages** --gecos "FRR suite" --shell /bin/false frr sudo usermod -a -G frrvty frr -### Download Source, configure and compile it +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr git checkout stable/3.0 @@ -53,12 +62,15 @@ an example.) --enable-fpm \ --enable-ldpd \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo install -m 755 -o frr -g frr -d /var/log/frr sudo install -m 755 -o frr -g frr -d /var/opt/frr @@ -75,11 +87,14 @@ an example.) sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit ``/etc/sysctl.conf`` and uncomment the following values (ignore the other settings) +:: + # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 @@ -88,21 +103,29 @@ other settings) # based on Router Advertisements for this host net.ipv6.conf.all.forwarding=1 -**Reboot** or use `sysctl -p` to apply the same config to the running system +**Reboot** or use ``sysctl -p`` to apply the same config to the running +system + +Troubleshooting +--------------- + +Shared library error +~~~~~~~~~~~~~~~~~~~~ -### Troubleshooting +If you try and start any of the frrouting daemons you may see the below +error due to the frrouting shared library directory not being found: -**Shared library error** +:: -If you try and start any of the frrouting daemons you may see the below error -due to the frrouting shared library directory not being found: + ./zebra: error while loading shared libraries: libfrr.so.0: cannot open + shared object file: No such file or directory - ./zebra: error while loading shared libraries: libfrr.so.0: cannot open shared object file: No such file or directory +The fix is to add the following line to /etc/ld.so.conf which will +continue to reference the library directory after the system reboots. To +load the library directory path immediately run the ldconfig command +after adding the line to the file eg: -The fix is to add the following line to /etc/ld.so.conf which will continue to -reference the library directory after the system reboots. To load the library -directory path immediately run the ldconfig command after adding the line to -the file eg: +:: - echo include /usr/local/lib >> /etc/ld.so.conf - ldconfig + echo include /usr/local/lib >> /etc/ld.so.conf + ldconfig diff --git a/doc/Building_FRR_on_Fedora24.md b/doc/developer/Building_FRR_on_Fedora24.rst index 0070fd153..ed81d3f59 100644 --- a/doc/Building_FRR_on_Fedora24.md +++ b/doc/developer/Building_FRR_on_Fedora24.rst @@ -1,37 +1,46 @@ -Building FRR on Fedora 24 from Git Source +Fedora 24 ========================================= (As an alternative to this installation, you may prefer to create a FRR rpm package yourself and install that package instead. See instructions -in redhat/README.rpm_build.md on how to build a rpm package) +in redhat/README.rpm\_build.md on how to build a rpm package) Install required packages ------------------------- Add packages: +:: + sudo dnf install git autoconf automake libtool make gawk \ readline-devel texinfo net-snmp-devel groff pkgconfig \ json-c-devel pam-devel perl-XML-LibXML pytest bison flex \ - c-ares-devel python3-devel + c-ares-devel python3-devel python3-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not +**This assumes you want to build and install FRR from source and not using any packages** -### Add frr groups and user +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvt sudo useradd -u 92 -g 92 -M -r -G frrvt -s /sbin/nologin \ -c "FRR FRRouting suite" -d /var/run/frr frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -60,12 +69,16 @@ an example.) --enable-eigrpd \ --enable-babeld \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /var/log/frr sudo mkdir /etc/frr sudo touch /etc/frr/zebra.conf @@ -85,21 +98,28 @@ an example.) sudo chown frr:frrvt /etc/frr/vtysh.conf sudo chmod 640 /etc/frr/*.conf -### Install daemon config file +Install daemon config file +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 644 redhat/daemons /etc/frr/ sudo chown frr:frr /etc/frr/daemons -### Edit /etc/frr/daemons as needed to select the required daemons +Edit /etc/frr/daemons as needed to select the required daemons +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Look for the section with `watchfrr_enable=...` and `zebra=...` etc. -Enable the daemons as required by changing the value to `yes` +Look for the section with ``watchfrr_enable=...`` and ``zebra=...`` etc. +Enable the daemons as required by changing the value to ``yes`` -### Enable IP & IPv6 forwarding (and MPLS) +Enable IP & IPv6 forwarding (and MPLS) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Create a new file `/etc/sysctl.d/90-routing-sysctl.conf` with the -following content: -(Please make sure to list all interfaces with required MPLS similar -to `net.mpls.conf.eth0.input=1`) +Create a new file ``/etc/sysctl.d/90-routing-sysctl.conf`` with the +following content: (Please make sure to list all interfaces with +required MPLS similar to ``net.mpls.conf.eth0.input=1``) + +:: # Sysctl for routing # @@ -115,9 +135,14 @@ to `net.mpls.conf.eth0.input=1`) Load the modifed sysctl's on the system: +:: + sudo sysctl -p /etc/sysctl.d/90-routing-sysctl.conf -Create a new file `/etc/modules-load.d/mpls.conf` with the following content: +Create a new file ``/etc/modules-load.d/mpls.conf`` with the following +content: + +:: # Load MPLS Kernel Modules mpls-router @@ -125,14 +150,28 @@ Create a new file `/etc/modules-load.d/mpls.conf` with the following content: And load the kernel modules on the running system: +:: + sudo modprobe mpls-router mpls-iptunnel -### Install frr Service and redhat init files +Install frr Service and redhat init files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo install -p -m 644 redhat/frr.service /usr/lib/systemd/system/frr.service sudo install -p -m 755 redhat/frr.init /usr/lib/frr/frr - -### Enable required frr at startup + +Enable required frr at startup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo systemctl enable frr -### Reboot or start FRR manually +Reboot or start FRR manually +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo systemctl start frr diff --git a/doc/Building_FRR_on_FreeBSD10.md b/doc/developer/Building_FRR_on_FreeBSD10.rst index ccae83a66..ccbe8c55c 100644 --- a/doc/Building_FRR_on_FreeBSD10.md +++ b/doc/developer/Building_FRR_on_FreeBSD10.rst @@ -1,46 +1,53 @@ -Building FRR on FreeBSD 10 from Git Source +FreeBSD 10 ========================================== FreeBSD 10 restrictions: ------------------------ -- MPLS is not supported on `FreeBSD`. MPLS requires a Linux Kernel - (4.5 or higher). LDP can be built, but may have limited use - without MPLS +- MPLS is not supported on ``FreeBSD``. MPLS requires a Linux Kernel + (4.5 or higher). LDP can be built, but may have limited use without + MPLS Install required packages ------------------------- -Add packages: -(Allow the install of the package managment tool if this is first package -install and asked) +Add packages: (Allow the install of the package managment tool if this +is first package install and asked) + +:: pkg install git autoconf automake libtool gmake gawk json-c pkgconf \ - bison flex py27-pytest c-ares python3 + bison flex py27-pytest c-ares python3 py-sphinx + +Make sure there is no /usr/bin/flex preinstalled (and use the newly +installed in /usr/local/bin): (FreeBSD frequently provides a older flex +as part of the base OS which takes preference in path) -Make sure there is no /usr/bin/flex preinstalled (and use the newly -installed in /usr/local/bin): -(FreeBSD frequently provides a older flex as part of the base OS which -takes preference in path) +:: rm -f /usr/bin/flex Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not +**This assumes you want to build and install FRR from source and not using any packages** -### Add frr group and user +Add frr group and user +~~~~~~~~~~~~~~~~~~~~~~ + +:: pw groupadd frr -g 101 pw groupadd frrvty -g 102 pw adduser frr -g 101 -u 101 -G 102 -c "FRR suite" \ -d /usr/local/etc/frr -s /usr/sbin/nologin -(You may prefer different options on configure statement. These are just +(You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -63,12 +70,16 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /usr/local/etc/frr sudo touch /usr/local/etc/frr/zebra.conf sudo touch /usr/local/etc/frr/bgpd.conf @@ -83,12 +94,16 @@ an example) sudo chown frr:frrvty /usr/local/etc/frr/vtysh.conf sudo chmod 640 /usr/local/etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add the following lines to the end of ``/etc/sysctl.conf``: -Add the following lines to the end of `/etc/sysctl.conf`: +:: # Routing: We need to forward packets net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 -**Reboot** or use `sysctl` to apply the same config to the running system +**Reboot** or use ``sysctl`` to apply the same config to the running +system diff --git a/doc/Building_FRR_on_FreeBSD11.md b/doc/developer/Building_FRR_on_FreeBSD11.rst index 71ccd149f..214fdbf9c 100644 --- a/doc/Building_FRR_on_FreeBSD11.md +++ b/doc/developer/Building_FRR_on_FreeBSD11.rst @@ -1,37 +1,42 @@ -Building FRR on FreeBSD 11 from Git Source +FreeBSD 11 ========================================== FreeBSD 11 restrictions: ------------------------ -- MPLS is not supported on `FreeBSD`. MPLS requires a Linux Kernel - (4.5 or higher). LDP can be built, but may have limited use - without MPLS +- MPLS is not supported on ``FreeBSD``. MPLS requires a Linux Kernel + (4.5 or higher). LDP can be built, but may have limited use without + MPLS Install required packages ------------------------- -Add packages: -(Allow the install of the package managment tool if this is first package -install and asked) +Add packages: (Allow the install of the package managment tool if this +is first package install and asked) + +:: pkg install git autoconf automake libtool gmake gawk json-c pkgconf \ - bison flex py27-pytest c-ares python3 + bison flex py27-pytest c-ares python3 py-sphinx + +Make sure there is no /usr/bin/flex preinstalled (and use the newly +installed in /usr/local/bin): (FreeBSD frequently provides a older flex +as part of the base OS which takes preference in path) -Make sure there is no /usr/bin/flex preinstalled (and use the newly -installed in /usr/local/bin): -(FreeBSD frequently provides a older flex as part of the base OS which -takes preference in path) +:: rm -f /usr/bin/flex Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not +**This assumes you want to build and install FRR from source and not using any packages** -### Add frr group and user +Add frr group and user +~~~~~~~~~~~~~~~~~~~~~~ + +:: pw groupadd frr -g 101 pw groupadd frrvty -g 102 @@ -41,6 +46,8 @@ using any packages** (You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -63,12 +70,16 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /usr/local/etc/frr sudo touch /usr/local/etc/frr/zebra.conf sudo touch /usr/local/etc/frr/bgpd.conf @@ -83,12 +94,16 @@ an example) sudo chown frr:frrvty /usr/local/etc/frr/vtysh.conf sudo chmod 640 /usr/local/etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add the following lines to the end of ``/etc/sysctl.conf``: -Add the following lines to the end of `/etc/sysctl.conf`: +:: # Routing: We need to forward packets net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 -**Reboot** or use `sysctl` to apply the same config to the running system +**Reboot** or use ``sysctl`` to apply the same config to the running +system diff --git a/doc/Building_FRR_on_FreeBSD9.md b/doc/developer/Building_FRR_on_FreeBSD9.rst index 8a09d8a4c..909b3a8d6 100644 --- a/doc/Building_FRR_on_FreeBSD9.md +++ b/doc/developer/Building_FRR_on_FreeBSD9.rst @@ -1,32 +1,39 @@ -Building FRR on FreeBSD 9 from Git Source +FreeBSD 9 ========================================= FreeBSD 9 restrictions: ----------------------- -- MPLS is not supported on `FreeBSD`. MPLS requires a Linux Kernel - (4.5 or higher). LDP can be built, but may have limited use - without MPLS - +- MPLS is not supported on ``FreeBSD``. MPLS requires a Linux Kernel + (4.5 or higher). LDP can be built, but may have limited use without + MPLS + Install required packages ------------------------- -Add packages: -(Allow the install of the package managment tool if this is first package -install and asked) +Add packages: (Allow the install of the package managment tool if this +is first package install and asked) + +:: pkg install -y git autoconf automake libtool gmake gawk \ pkgconf texinfo json-c bison flex py27-pytest c-ares \ - python3 + python3 py-sphinx Make sure there is no /usr/bin/flex preinstalled (and use the newly -installed in /usr/local/bin): -(FreeBSD frequently provides a older flex as part of the base OS which -takes preference in path) +installed in /usr/local/bin): (FreeBSD frequently provides a older flex +as part of the base OS which takes preference in path) + +:: rm -f /usr/bin/flex -For building with clang (instead of gcc), upgrade clang from 3.4 default to 3.6 *This is needed to build FreeBSD packages as well - for packages clang is default* (Clang 3.4 as shipped with FreeBSD 9 crashes during compile) +For building with clang (instead of gcc), upgrade clang from 3.4 default +to 3.6 *This is needed to build FreeBSD packages as well - for packages +clang is default* (Clang 3.4 as shipped with FreeBSD 9 crashes during +compile) + +:: pkg install clang36 pkg delete clang34 @@ -39,7 +46,10 @@ Get FRR, compile it and install it (from Git) **This assumes you want to build and install FRR from source and not using any packages** -### Add frr group and user +Add frr group and user +~~~~~~~~~~~~~~~~~~~~~~ + +:: pw groupadd frr -g 101 pw groupadd frrvty -g 102 @@ -49,6 +59,8 @@ using any packages** (You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -71,12 +83,16 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /usr/local/etc/frr sudo touch /usr/local/etc/frr/zebra.conf sudo touch /usr/local/etc/frr/bgpd.conf @@ -91,12 +107,16 @@ an example) sudo chown frr:frrvty /usr/local/etc/frr/vtysh.conf sudo chmod 640 /usr/local/etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add the following lines to the end of ``/etc/sysctl.conf``: -Add the following lines to the end of `/etc/sysctl.conf`: +:: # Routing: We need to forward packets net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 -**Reboot** or use `sysctl` to apply the same config to the running system +**Reboot** or use ``sysctl`` to apply the same config to the running +system diff --git a/doc/developer/Building_FRR_on_LEDE-OpenWRT.rst b/doc/developer/Building_FRR_on_LEDE-OpenWRT.rst new file mode 100644 index 000000000..b9ee9c51e --- /dev/null +++ b/doc/developer/Building_FRR_on_LEDE-OpenWRT.rst @@ -0,0 +1,108 @@ +OpenWRT/LEDE +============================================= + +- for the moment because of cross compile problems, master is not + supported, only up to 3.0 +- LDP can't be built because of missing Perl-XML-LibXML in OpenWRT/LEDE + tree + +Prepare build environment +------------------------- + +https://lede-project.org/docs/guide-developer/install-buildsystem + +for + +Ubuntu 12.04LTS: + +:: + + sudo apt-get install build-essential subversion git-core \ + libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc \ + libxml-parser-perl mercurial bzr ecj cvs unzip python3-sphinx + +Ubuntu 64bit: + +:: + + sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev \ + gawk gcc-multilib flex git-core gettext libssl-dev python3-sphinx + +Debian 8 Jessie: + +:: + + sudo apt-get install build-essential libncurses5-dev gawk git subversion \ + libssl-dev gettext unzip zlib1g-dev file python python3-sphinx + +Debian 9 Stretch: + +:: + + sudo apt-get install build-essential libncurses5-dev gawk git subversion \ + libssl-dev gettext zlib1g-dev python3-sphinx + +Centos x86-64 (some packages require EPEL): + +:: + + yum install subversion binutils bzip2 gcc gcc-c++ gawk gettext flex \ + ncurses-devel zlib-devel zlib-static make patch unzip glibc glibc-devel \ + perl-ExtUtils-MakeMaker glibc-static quilt ncurses-libs sed sdcc bison \ + intltool sharutils wget git-core openssl-devel xz python-sphinx + +Fedora 24 - 64Bit: + +:: + + dnf install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext git-core \ + unzip ncurses-devel ncurses-compat-libs zlib-devel zlib-static make \ + flex patch perl-ExtUtils-MakeMaker perl-Thread-Queue glibc glibc-devel \ + glibc-static quilt sed sdcc intltool sharutils bison wget openssl-devel \ + python3-sphinx + +Get LEDE Sources (from Git) +--------------------------- + +LEDE and OpenWRT is planned to remerge and won't cover the similar +OpenWRT build As normal user: git clone +https://git.lede-project.org/source.git lede cd lede ./scripts/feeds +update -a ./scripts/feeds install -a cd feeds/routing git pull origin +pull/319/head ln -s ../../../feeds/routing/frr/ +../../package/feeds/routing/ cd ../.. make menuconfig + +Select the needed target then select needed packages in Network -> +Routing and Redirection -> frr, exit and save + +:: + + make or make package/frr/compile + +It may be possible that on first build ``make package/frr/compile`` not +to work and it may be needed to run a ``make`` for the entire build +envronment, add V=s for debugging + +Work with sources +----------------- + +To update the rc1 version or add other options, the Makefile is found in +feeds/routing/frr + +edit: PKG\_VERSION:= PKG\_SOURCE\_VERSION:= + +Usage +----- + +Edit ``/usr/sbin/frr.init`` and add/remove the daemons name in section +DAEMONS= or don't install unneded packages For example: zebra bgpd ldpd +isisd nhrpd ospfd ospf6d pimd ripd ripngd + +Enable the serivce +~~~~~~~~~~~~~~~~~~ + +- service frr enable + +Start the service +~~~~~~~~~~~~~~~~~ + +- service frr start diff --git a/doc/Building_FRR_on_NetBSD6.md b/doc/developer/Building_FRR_on_NetBSD6.rst index 4fe7109bc..ce5c58045 100644 --- a/doc/Building_FRR_on_NetBSD6.md +++ b/doc/developer/Building_FRR_on_NetBSD6.rst @@ -1,50 +1,66 @@ -Building FRR on NetBSD 6 from Git Source +NetBSD 6 ======================================== NetBSD 6 restrictions: ---------------------- -- MPLS is not supported on `NetBSD`. MPLS requires a Linux Kernel - (4.5 or higher). LDP can be built, but may have limited use - without MPLS +- MPLS is not supported on ``NetBSD``. MPLS requires a Linux Kernel + (4.5 or higher). LDP can be built, but may have limited use without + MPLS Install required packages ------------------------- + Configure Package location: +:: + PKG_PATH="ftp://ftp.NetBSD.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All" export PKG_PATH Add packages: +:: + sudo pkg_add git autoconf automake libtool gmake gawk openssl \ - pkg-config json-c python27 py27-test python35 + pkg-config json-c python27 py27-test python35 py-sphinx Install SSL Root Certificates (for git https access): +:: + sudo pkg_add mozilla-rootcerts sudo touch /etc/openssl/openssl.cnf sudo mozilla-rootcerts install Select default Python and py.test +:: + sudo ln -s /usr/pkg/bin/python2.7 /usr/bin/python sudo ln -s /usr/pkg/bin/py.test-2.7 /usr/bin/py.test Get FRR, compile it and install it (from Git) ------------------------------------------------- +--------------------------------------------- + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -g 93 frrvty sudo useradd -g 92 -u 92 -G frrvty -c "FRR suite" \ -d /nonexistent -s /sbin/nologin frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -67,12 +83,16 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /var/log/frr sudo mkdir /usr/pkg/etc/frr sudo touch /usr/pkg/etc/frr/zebra.conf @@ -88,23 +108,35 @@ an example) sudo chown frr:frrvty /usr/pkg/etc/frr/*.conf sudo chmod 640 /usr/pkg/etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Add the following lines to the end of `/etc/sysctl.conf`: +Add the following lines to the end of ``/etc/sysctl.conf``: + +:: # Routing: We need to forward packets net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 -**Reboot** or use `sysctl` to apply the same config to the running system +**Reboot** or use ``sysctl`` to apply the same config to the running +system + +Install rc.d init files +~~~~~~~~~~~~~~~~~~~~~~~ + +:: -### Install rc.d init files cp pkgsrc/*.sh /etc/rc.d/ chmod 555 /etc/rc.d/*.sh -### Enable FRR processes +Enable FRR processes +~~~~~~~~~~~~~~~~~~~~ + (Enable the required processes only) +:: + echo "zebra=YES" >> /etc/rc.conf echo "bgpd=YES" >> /etc/rc.conf echo "ospfd=YES" >> /etc/rc.conf diff --git a/doc/Building_FRR_on_NetBSD7.md b/doc/developer/Building_FRR_on_NetBSD7.rst index 7fe9ad20c..eaaf87fd1 100644 --- a/doc/Building_FRR_on_NetBSD7.md +++ b/doc/developer/Building_FRR_on_NetBSD7.rst @@ -1,44 +1,57 @@ -Building FRR on NetBSD 7 from Git Source +NetBSD 7 ======================================== NetBSD 7 restrictions: ---------------------- -- MPLS is not supported on `NetBSD`. MPLS requires a Linux Kernel - (4.5 or higher). LDP can be built, but may have limited use - without MPLS +- MPLS is not supported on ``NetBSD``. MPLS requires a Linux Kernel + (4.5 or higher). LDP can be built, but may have limited use without + MPLS Install required packages ------------------------- +:: + sudo pkgin install git autoconf automake libtool gmake gawk openssl \ - pkg-config json-c python27 py27-test python35 + pkg-config json-c python27 py27-test python35 py-sphinx Install SSL Root Certificates (for git https access): +:: + sudo pkgin install mozilla-rootcerts sudo touch /etc/openssl/openssl.cnf sudo mozilla-rootcerts install Select default Python and py.test +:: + sudo ln -s /usr/pkg/bin/python2.7 /usr/bin/python sudo ln -s /usr/pkg/bin/py.test-2.7 /usr/bin/py.test Get FRR, compile it and install it (from Git) ------------------------------------------------- +--------------------------------------------- + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -g 93 frrvty sudo useradd -g 92 -u 92 -G frrvty -c "FRR suite" \ -d /nonexistent -s /sbin/nologin frr -### Download Source, configure and compile it +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -61,12 +74,16 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: + sudo mkdir /usr/pkg/etc/frr sudo touch /usr/pkg/etc/frr/zebra.conf sudo touch /usr/pkg/etc/frr/bgpd.conf @@ -81,23 +98,35 @@ an example) sudo chown frr:frrvty /usr/pkg/etc/frr/*.conf sudo chmod 640 /usr/pkg/etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Add the following lines to the end of ``/etc/sysctl.conf``: -Add the following lines to the end of `/etc/sysctl.conf`: +:: # Routing: We need to forward packets net.inet.ip.forwarding=1 net.inet6.ip6.forwarding=1 -**Reboot** or use `sysctl` to apply the same config to the running system +**Reboot** or use ``sysctl`` to apply the same config to the running +system + +Install rc.d init files +~~~~~~~~~~~~~~~~~~~~~~~ + +:: -### Install rc.d init files cp pkgsrc/*.sh /etc/rc.d/ chmod 555 /etc/rc.d/*.sh -### Enable FRR processes +Enable FRR processes +~~~~~~~~~~~~~~~~~~~~ + (Enable the required processes only) +:: + echo "zebra=YES" >> /etc/rc.conf echo "bgpd=YES" >> /etc/rc.conf echo "ospfd=YES" >> /etc/rc.conf diff --git a/doc/Building_FRR_on_OmniOS.md b/doc/developer/Building_FRR_on_OmniOS.rst index 6e4575f07..0eb2b9fec 100644 --- a/doc/Building_FRR_on_OmniOS.md +++ b/doc/developer/Building_FRR_on_OmniOS.rst @@ -1,23 +1,28 @@ -Building FRR on OmniOS (OpenSolaris) from Git Source +OmniOS (OpenSolaris) ==================================================== OmniOS restrictions: -------------------- -- MPLS is not supported on `OmniOS` or `Solaris`. MPLS requires a Linux - Kernel (4.5 or higher). LDP can be built, but may have limited use - without MPLS +- MPLS is not supported on ``OmniOS`` or ``Solaris``. MPLS requires a + Linux Kernel (4.5 or higher). LDP can be built, but may have limited + use without MPLS -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: routeadm -e ipv4-forwarding - routeadm -e ipv6-forwarding + routeadm -e ipv6-forwarding Install required packages ------------------------- Add packages: +:: + pkg install \ developer/build/autoconf \ developer/build/automake \ @@ -32,10 +37,12 @@ Add packages: library/idnkit/header-idnkit \ system/header \ system/library/math/header-math \ - git libtool gawk pkg-config + git libtool gawk pkg-config Add additional Solaris packages: +:: + pkgadd -d http://get.opencsw.org/now /opt/csw/bin/pkgutil -U /opt/csw/bin/pkgutil -y -i texinfo @@ -45,33 +52,50 @@ Add additional Solaris packages: Add libjson to Solaris equivalent of ld.so.conf +:: + crle -l /opt/csw/lib -u Add pytest: +:: + pip install pytest +Install Sphinx::: + + pip install sphinx + Select Python 2.7 as default (required for pytest) +:: + rm -f /usr/bin/python ln -s /opt/csw/bin/python2.7 /usr/bin/python -Fix PATH for all users and non-interactive sessions. Edit `/etc/default/login` -and add the following default PATH: +Fix PATH for all users and non-interactive sessions. Edit +``/etc/default/login`` and add the following default PATH: + +:: PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin:/opt/csw/bin -Edit `~/.profile` and add the following default PATH: +Edit ``~/.profile`` and add the following default PATH: + +:: PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin:/opt/csw/bin Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** -### Add frr group and user +Add frr group and user +~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo groupadd -g 93 frr sudo groupadd -g 94 frrvty @@ -81,6 +105,8 @@ any packages** (You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -106,12 +132,15 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check sudo gmake install -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: routeadm -e ipv4-forwarding - routeadm -e ipv6-forwarding + routeadm -e ipv6-forwarding diff --git a/doc/Building_FRR_on_OpenBSD6.md b/doc/developer/Building_FRR_on_OpenBSD6.rst index c1bfa5005..895048886 100644 --- a/doc/Building_FRR_on_OpenBSD6.md +++ b/doc/developer/Building_FRR_on_OpenBSD6.rst @@ -1,39 +1,52 @@ -Building FRR on OpenBSD 6 from Git Source +OpenBSD 6 ========================================= Install required packages ------------------------- -Configure PKG_PATH +Configure PKG\_PATH + +:: export PKG_PATH=http://ftp5.usa.openbsd.org/pub/OpenBSD/$(uname -r)/packages/$(machine -a)/ Add packages: +:: + pkg_add git autoconf-2.69p2 automake-1.15p0 libtool bison - pkg_add gmake gawk dejagnu openssl json-c py-test + pkg_add gmake gawk dejagnu openssl json-c py-test py-sphinx Select Python2.7 as default (required for pytest) +:: + ln -s /usr/local/bin/python2.7 /usr/local/bin/python Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** -### Add frr group and user +Add frr group and user +~~~~~~~~~~~~~~~~~~~~~~ + +:: groupadd -g 525 _frr groupadd -g 526 _frrvty useradd -g 525 -u 525 -c "FRR suite" -G _frrvty \ -d /nonexistent -s /sbin/nologin _frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example) +:: + git clone https://github.com/frrouting/frr.git frr cd frr export AUTOCONF_VERSION="2.69" @@ -56,12 +69,15 @@ an example) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion gmake gmake check doas gmake install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: doas mkdir /var/frr doas chown _frr:_frr /var/frr @@ -83,47 +99,65 @@ an example) doas chmod 750 /etc/frr doas chmod 640 /etc/frr/*.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Add the following lines to the end of `/etc/rc.conf`: +Add the following lines to the end of ``/etc/rc.conf``: - net.inet6.ip6.forwarding=1 # 1=Permit forwarding of IPv6 packets +:: + + net.inet6.ip6.forwarding=1 # 1=Permit forwarding of IPv6 packets net.inet6.ip6.mforwarding=1 # 1=Permit forwarding of IPv6 multicast packets net.inet6.ip6.multipath=1 # 1=Enable IPv6 multipath routing **Reboot** to apply the config to the system -### Enable MPLS Forwarding +Enable MPLS Forwarding +~~~~~~~~~~~~~~~~~~~~~~ + +To enable MPLS forwarding on a given interface, use the following +command: -To enable MPLS forwarding on a given interface, use the following command: +:: doas ifconfig em0 mpls -Alternatively, to make MPLS forwarding persistent across reboots, add the "mpls" -keyword in the hostname.* files of the desired interfaces. Example: +Alternatively, to make MPLS forwarding persistent across reboots, add +the "mpls" keyword in the hostname.\* files of the desired interfaces. +Example: + +:: cat /etc/hostname.em0 inet 10.0.1.1 255.255.255.0 mpls -### Install rc.d init files -(create them in /etc/rc.d - no example are included at this time with +Install rc.d init files +~~~~~~~~~~~~~~~~~~~~~~~ + +(create them in /etc/rc.d - no example are included at this time with FRR source) -Example (for zebra - store as `/etc/rc.d/frr_zebra.sh`) +Example (for zebra - store as ``/etc/rc.d/frr_zebra.sh``) + +:: #!/bin/sh # # $OpenBSD: frr_zebra.rc,v 1.1 2013/04/18 20:29:08 sthen Exp $ - + daemon="/usr/local/sbin/zebra -d" - + . /etc/rc.d/rc.subr - + rc_cmd $1 -### Enable FRR processes +Enable FRR processes +~~~~~~~~~~~~~~~~~~~~ + (Enable the required processes only) +:: + echo "frr_zebra=YES" >> /etc/rc.conf echo "frr_bgpd=YES" >> /etc/rc.conf echo "frr_ospfd=YES" >> /etc/rc.conf diff --git a/doc/Building_FRR_on_Ubuntu1204.md b/doc/developer/Building_FRR_on_Ubuntu1204.rst index 58aa167d5..68e476fec 100644 --- a/doc/Building_FRR_on_Ubuntu1204.md +++ b/doc/developer/Building_FRR_on_Ubuntu1204.rst @@ -1,40 +1,46 @@ -Building FRR on Ubuntu 12.04LTS from Git Source +Ubuntu 12.04LTS =============================================== -- MPLS is not supported on `Ubuntu 12.04` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use - without MPLS) - For an updated Ubuntu Kernel, see http://kernel.ubuntu.com/~kernel-ppa/mainline/ +- MPLS is not supported on ``Ubuntu 12.04`` with default kernel. MPLS + requires Linux Kernel 4.5 or higher (LDP can be built, but may have + limited use without MPLS) For an updated Ubuntu Kernel, see + http://kernel.ubuntu.com/~kernel-ppa/mainline/ Install required packages ------------------------- Add packages: +:: + apt-get install git autoconf automake libtool make gawk libreadline-dev \ texinfo libpam0g-dev dejagnu libjson0-dev pkg-config libpam0g-dev \ - libjson0-dev flex python-pip libc-ares-dev python3-dev + libjson0-dev flex python-pip libc-ares-dev python3-dev python3-sphinx + +Install newer bison from 14.04 package source (Ubuntu 12.04 package +source is too old) -Install newer bison from 14.04 package source (Ubuntu 12.04 package source -is too old) +:: mkdir builddir cd builddir wget http://archive.ubuntu.com/ubuntu/pool/main/b/bison/bison_3.0.2.dfsg-2.dsc wget http://archive.ubuntu.com/ubuntu/pool/main/b/bison/bison_3.0.2.dfsg.orig.tar.bz2 wget http://archive.ubuntu.com/ubuntu/pool/main/b/bison/bison_3.0.2.dfsg-2.debian.tar.gz - tar -jxvf bison_3.0.2.dfsg.orig.tar.bz2 + tar -jxvf bison_3.0.2.dfsg.orig.tar.bz2 cd bison-3.0.2.dfsg/ - tar xzf ../bison_3.0.2.dfsg-2.debian.tar.gz + tar xzf ../bison_3.0.2.dfsg-2.debian.tar.gz sudo apt-get build-dep bison debuild -b -uc -us cd .. - sudo dpkg -i ./libbison-dev_3.0.2.dfsg-2_amd64.deb ./bison_3.0.2.dfsg-2_amd64.deb + sudo dpkg -i ./libbison-dev_3.0.2.dfsg-2_amd64.deb ./bison_3.0.2.dfsg-2_amd64.deb cd .. rm -rf builddir Install newer version of autoconf and automake: +:: + wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz tar xvf autoconf-2.69.tar.gz cd autoconf-2.69 @@ -42,7 +48,7 @@ Install newer version of autoconf and automake: make sudo make install cd .. - + wget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.gz tar xvf automake-1.15.tar.gz cd automake-1.15 @@ -53,15 +59,20 @@ Install newer version of autoconf and automake: Install pytest: +:: + pip install pytest Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** -### Add frr groups and user +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvty @@ -69,10 +80,14 @@ any packages** --gecos "FRR suite" --shell /sbin/nologin frr sudo usermod -a -G frrvty frr -### Download Source, configure and compile it +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + (You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -95,12 +110,15 @@ an example.) --enable-rtadv \ --enable-fpm \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo install -m 755 -o frr -g frr -d /var/log/frr sudo install -m 775 -o frr -g frrvty -d /etc/frr @@ -116,11 +134,14 @@ an example.) sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit ``/etc/sysctl.conf`` and uncomment the following values (ignore the other settings) +:: + # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 @@ -129,27 +150,38 @@ other settings) # based on Router Advertisements for this host net.ipv6.conf.all.forwarding=1 -**Reboot** or use `sysctl -p` to apply the same config to the running system +**Reboot** or use ``sysctl -p`` to apply the same config to the running +system + +Install the init.d service +~~~~~~~~~~~~~~~~~~~~~~~~~~ -### Install the init.d service +:: sudo install -m 755 tools/frr /etc/init.d/frr sudo install -m 644 tools/etc/frr/daemons /etc/frr/daemons sudo install -m 644 tools/etc/frr/daemons.conf /etc/frr/daemons.conf sudo install -m 644 -o frr -g frr tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf - -### Enable daemons -Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. -For example. - - zebra=yes - bgpd=yes - ospfd=yes - ospf6d=yes - ripd=yes - ripngd=yes - isisd=yes - -### Start the init.d service -- /etc/init.d/frr start -- use `/etc/init.d/frr status` to check its status. + +Enable daemons +~~~~~~~~~~~~~~ + +| Edit ``/etc/frr/daemons`` and change the value from "no" to "yes" for + those daemons you want to start by systemd. +| For example. + +:: + + zebra=yes + bgpd=yes + ospfd=yes + ospf6d=yes + ripd=yes + ripngd=yes + isisd=yes + +Start the init.d service +~~~~~~~~~~~~~~~~~~~~~~~~ + +- /etc/init.d/frr start +- use ``/etc/init.d/frr status`` to check its status. diff --git a/doc/Building_FRR_on_Ubuntu1404.md b/doc/developer/Building_FRR_on_Ubuntu1404.rst index 8e6b38cc2..10944cb8e 100644 --- a/doc/Building_FRR_on_Ubuntu1404.md +++ b/doc/developer/Building_FRR_on_Ubuntu1404.rst @@ -1,27 +1,32 @@ -Building FRR on Ubuntu 14.04LTS from Git Source +Ubuntu 14.04LTS =============================================== -- MPLS is not supported on `Ubuntu 14.04` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use - without MPLS) - For an updated Ubuntu Kernel, see http://kernel.ubuntu.com/~kernel-ppa/mainline/ +- MPLS is not supported on ``Ubuntu 14.04`` with default kernel. MPLS + requires Linux Kernel 4.5 or higher (LDP can be built, but may have + limited use without MPLS) For an updated Ubuntu Kernel, see + http://kernel.ubuntu.com/~kernel-ppa/mainline/ Install required packages ------------------------- Add packages: +:: + apt-get install git autoconf automake libtool make gawk libreadline-dev \ texinfo dejagnu pkg-config libpam0g-dev libjson-c-dev bison flex \ - python-pytest libc-ares-dev python3-dev + python-pytest libc-ares-dev python3-dev python3-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvty @@ -29,10 +34,14 @@ any packages** --gecos "FRR suite" --shell /sbin/nologin frr sudo usermod -a -G frrvty frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -56,12 +65,15 @@ an example.) --enable-fpm \ --enable-ldpd \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo install -m 755 -o frr -g frr -d /var/log/frr sudo install -m 775 -o frr -g frrvty -d /etc/frr @@ -74,14 +86,17 @@ an example.) sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf - sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf -### Enable IP & IPv6 forwarding +Enable IP & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit ``/etc/sysctl.conf`` and uncomment the following values (ignore the other settings) +:: + # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 @@ -90,30 +105,35 @@ other settings) # based on Router Advertisements for this host net.ipv6.conf.all.forwarding=1 -**Reboot** or use `sysctl -p` to apply the same config to the running system -### Install the init.d service +**Reboot** or use ``sysctl -p`` to apply the same config to the running +system ### Install the init.d service + +:: sudo install -m 755 tools/frr /etc/init.d/frr sudo install -m 644 tools/etc/frr/daemons /etc/frr/daemons sudo install -m 644 tools/etc/frr/daemons.conf /etc/frr/daemons.conf sudo install -m 644 -o frr -g frr tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf - - -### Enable daemons - -Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. -For example. - - zebra=yes - bgpd=yes - ospfd=yes - ospf6d=yes - ripd=yes - ripngd=yes - isisd=yes - -### Start the init.d service -- /etc/init.d/frr start -- use `/etc/init.d/frr status` to check its status. - - + +Enable daemons +~~~~~~~~~~~~~~ + +| Edit ``/etc/frr/daemons`` and change the value from "no" to "yes" for + those daemons you want to start by systemd. +| For example. + +:: + + zebra=yes + bgpd=yes + ospfd=yes + ospf6d=yes + ripd=yes + ripngd=yes + isisd=yes + +Start the init.d service +~~~~~~~~~~~~~~~~~~~~~~~~ + +- /etc/init.d/frr start +- use ``/etc/init.d/frr status`` to check its status. diff --git a/doc/Building_FRR_on_Ubuntu1604.md b/doc/developer/Building_FRR_on_Ubuntu1604.rst index bdd0a9624..9c296f8ed 100644 --- a/doc/Building_FRR_on_Ubuntu1604.md +++ b/doc/developer/Building_FRR_on_Ubuntu1604.rst @@ -1,28 +1,33 @@ -Building FRR on Ubuntu 16.04LTS from Git Source +Ubuntu 16.04LTS =============================================== -- MPLS is not supported on `Ubuntu 16.04` with default kernel. MPLS requires - Linux Kernel 4.5 or higher (LDP can be built, but may have limited use - without MPLS) - For an updated Ubuntu Kernel, see - http://kernel.ubuntu.com/~kernel-ppa/mainline/ +- MPLS is not supported on ``Ubuntu 16.04`` with default kernel. MPLS + requires Linux Kernel 4.5 or higher (LDP can be built, but may have + limited use without MPLS) For an updated Ubuntu Kernel, see + http://kernel.ubuntu.com/~kernel-ppa/mainline/ Install required packages ------------------------- Add packages: +:: + apt-get install git autoconf automake libtool make gawk libreadline-dev \ texinfo dejagnu pkg-config libpam0g-dev libjson-c-dev bison flex \ - python-pytest libc-ares-dev python3-dev libsystemd-dev python-ipaddr + python-pytest libc-ares-dev python3-dev libsystemd-dev python-ipaddr \ + python3-sphinx Get FRR, compile it and install it (from Git) --------------------------------------------- -**This assumes you want to build and install FRR from source and not using -any packages** +**This assumes you want to build and install FRR from source and not +using any packages** + +Add frr groups and user +~~~~~~~~~~~~~~~~~~~~~~~ -### Add frr groups and user +:: sudo groupadd -g 92 frr sudo groupadd -r -g 85 frrvty @@ -30,10 +35,14 @@ any packages** --gecos "FRR suite" --shell /sbin/nologin frr sudo usermod -a -G frrvty frr -### Download Source, configure and compile it -(You may prefer different options on configure statement. These are just +Download Source, configure and compile it +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +(You may prefer different options on configure statement. These are just an example.) +:: + git clone https://github.com/frrouting/frr.git frr cd frr ./bootstrap.sh @@ -57,12 +66,15 @@ an example.) --enable-fpm \ --enable-systemd=yes \ --with-pkg-git-version \ - --with-pkg-extra-version=-MyOwnFRRVersion + --with-pkg-extra-version=-MyOwnFRRVersion make make check sudo make install -### Create empty FRR configuration files +Create empty FRR configuration files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:: sudo install -m 755 -o frr -g frr -d /var/log/frr sudo install -m 775 -o frr -g frrvty -d /etc/frr @@ -75,14 +87,17 @@ an example.) sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ripngd.conf sudo install -m 640 -o frr -g frr /dev/null /etc/frr/pimd.conf sudo install -m 640 -o frr -g frr /dev/null /etc/frr/ldpd.conf - sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf + sudo install -m 640 -o frr -g frr /dev/null /etc/frr/nhrpd.conf sudo install -m 640 -o frr -g frrvty /dev/null /etc/frr/vtysh.conf -### Enable IPv4 & IPv6 forwarding +Enable IPv4 & IPv6 forwarding +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and uncomment the following values (ignore the +Edit ``/etc/sysctl.conf`` and uncomment the following values (ignore the other settings) +:: + # Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1 @@ -91,10 +106,14 @@ other settings) # based on Router Advertisements for this host net.ipv6.conf.all.forwarding=1 -### Enable MPLS Forwarding (with Linux Kernel >= 4.5) +Enable MPLS Forwarding (with Linux Kernel >= 4.5) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Edit `/etc/sysctl.conf` and the following lines. Make sure to add a line -equal to `net.mpls.conf.eth0.input` or each interface used with MPLS +Edit ``/etc/sysctl.conf`` and the following lines. Make sure to add a +line equal to ``net.mpls.conf.eth0.input`` or each interface used with +MPLS + +:: # Enable MPLS Label processing on all interfaces net.mpls.conf.eth0.input=1 @@ -102,18 +121,24 @@ equal to `net.mpls.conf.eth0.input` or each interface used with MPLS net.mpls.conf.eth2.input=1 net.mpls.platform_labels=100000 -### Add MPLS kernel modules +Add MPLS kernel modules +~~~~~~~~~~~~~~~~~~~~~~~ + +Add the following lines to ``/etc/modules-load.d/modules.conf``: -Add the following lines to `/etc/modules-load.d/modules.conf`: +:: # Load MPLS Kernel Modules mpls-router mpls-iptunnel -**Reboot** or use `sysctl -p` to apply the same config to the running system +**Reboot** or use ``sysctl -p`` to apply the same config to the running +system +Install the systemd service (if rebooted from last step, change directory back to frr directory) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -### Install the systemd service (if rebooted from last step, change directory back to frr directory) +:: sudo install -m 644 tools/frr.service /etc/systemd/system/frr.service sudo install -m 644 tools/etc/default/frr /etc/default/frr @@ -122,10 +147,14 @@ Add the following lines to `/etc/modules-load.d/modules.conf`: sudo install -m 644 tools/etc/frr/frr.conf /etc/frr/frr.conf sudo install -m 644 -o frr -g frr tools/etc/frr/vtysh.conf /etc/frr/vtysh.conf -### Enable daemons +Enable daemons +~~~~~~~~~~~~~~ + +| Edit ``/etc/frr/daemons`` and change the value from "no" to "yes" for + those daemons you want to start by systemd. +| For example. -Edit `/etc/frr/daemons` and change the value from "no" to "yes" for those daemons you want to start by systemd. -For example. +:: zebra=yes bgpd=yes @@ -135,9 +164,13 @@ For example. ripngd=yes isisd=yes -### Enable the systemd service - - systemctl enable frr +Enable the systemd service +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- systemctl enable frr + +Start the systemd service +~~~~~~~~~~~~~~~~~~~~~~~~~ -### Start the systemd service -- systemctl start frr -- use `systemctl status frr` to check its status. +- systemctl start frr +- use ``systemctl status frr`` to check its status. diff --git a/doc/developer/Makefile b/doc/developer/Makefile new file mode 100644 index 000000000..9807a750b --- /dev/null +++ b/doc/developer/Makefile @@ -0,0 +1 @@ +include ../frr-sphinx.mk diff --git a/doc/OSPF-API.md b/doc/developer/OSPF-API.md index 5774300c0..5774300c0 100644 --- a/doc/OSPF-API.md +++ b/doc/developer/OSPF-API.md diff --git a/doc/developer/bgpd.rst b/doc/developer/bgpd.rst new file mode 100644 index 000000000..053c0779d --- /dev/null +++ b/doc/developer/bgpd.rst @@ -0,0 +1,8 @@ +BGPD +========================= + +.. toctree:: + :maxdepth: 2 + + next-hop-tracking + diff --git a/doc/developer/building.rst b/doc/developer/building.rst new file mode 100644 index 000000000..4715bca53 --- /dev/null +++ b/doc/developer/building.rst @@ -0,0 +1,22 @@ +Building FRR +========================= + +.. toctree:: + :maxdepth: 2 + + Building_FRR_on_LEDE-OpenWRT + Building_FRR_on_CentOS6 + Building_FRR_on_CentOS7 + Building_FRR_on_Debian8 + Building_FRR_on_Debian9 + Building_FRR_on_Fedora24 + Building_FRR_on_FreeBSD10 + Building_FRR_on_FreeBSD11 + Building_FRR_on_FreeBSD9 + Building_FRR_on_NetBSD6 + Building_FRR_on_NetBSD7 + Building_FRR_on_OmniOS + Building_FRR_on_OpenBSD6 + Building_FRR_on_Ubuntu1204 + Building_FRR_on_Ubuntu1404 + Building_FRR_on_Ubuntu1604 diff --git a/doc/developer/cli.rst b/doc/developer/cli.rst new file mode 100644 index 000000000..cff3d21ef --- /dev/null +++ b/doc/developer/cli.rst @@ -0,0 +1,723 @@ +Command Line Interface +====================== + +FRR features a flexible modal command line interface. Often when adding new +features or modifying existing code it is necessary to create or modify CLI +commands. FRR has a powerful internal CLI system that does most of the heavy +lifting for you. + +All definitions for the CLI system are exposed in ``lib/command.h``. In this +header there are a set of macros used to define commands. These macros are +collectively referred to as "DEFUNs", because of their syntax: + +:: + + DEFUN(command_name, + command_name_cmd, + "example command FOO...", + "Examples\n" + "CLI command\n" + "Argument\n") + { + // ...command handler... + } + +DEFUNs generally take four arguments which are expanded into the appropriate +constructs for hooking into the CLI. In order these are: + +- **Function name** - the name of the handler function for the command +- **Command name** - the identifier of the ``struct cmd_element`` for the + command. By convention this should be the function name with ``_cmd`` + appended. +- **Command definition** - an expression in FRR's CLI grammar that defines the + form of the command and its arguments, if any +- **Doc string** - a newline-delimited string that documents each element in + the command definition + +In the above example, ``command_name`` is the function name, +``command_name_cmd`` is the command name, ``"example..."`` is the definition +and the last argument is the doc string. The block following the macro is the +body of the handler function, details on which are presented later in this +section. + +In order to make the command show up to the user it must be installed into the +CLI graph. To do this, call: + +``install_element(NODE, &command_name_cmd);`` + +This will install the command into the specified CLI node. Usually these calls +are grouped together in a CLI initialization function for a set of commands, +and the DEFUNs themselves are grouped into the same source file to avoid +cluttering the codebase. The names of these files follow the form +``*_vty.[ch]`` by convention. Please do not scatter individual CLI commands in +the middle of source files; instead expose the necessary functions in a header +and place the command definition in a ``*_vty.[ch]`` file. + +Definition Grammar +------------------ + +FRR uses its own grammar for defining CLI commands. The grammar draws from +syntax commonly seen in \*nix manpages and should be fairly intuitive. The +parser is implemented in Bison and the lexer in Flex. These may be found in +``lib/command_lex.l`` and ``lib/command_parse.y``, respectively. + + **ProTip**: if you define a new command and find that the parser is + throwing syntax or other errors, the parser is the last place you want + to look. Bison is very stable and if it detects a syntax error, 99% of + the time it will be a syntax error in your definition. + +The formal grammar in BNF is given below. This is the grammar implemented in +the Bison parser. At runtime, the Bison parser reads all of the CLI strings and +builds a combined directed graph that is used to match and interpret user +input. + +Human-friendly explanations of how to use this grammar are given a bit later in +this section alongside information on the :ref:`cli-data-structures` constructed +by the parser. + +.. productionlist:: + command: `cmd_token_seq` + : `cmd_token_seq` `placeholder_token` "..." + cmd_token_seq: *empty* + : `cmd_token_seq` `cmd_token` + cmd_token: `simple_token` + : `selector` + simple_token: `literal_token` + : `placeholder_token` + literal_token: WORD `varname_token` + varname_token: "$" WORD + placeholder_token: `placeholder_token_real` `varname_token` + placeholder_token_real: IPV4 + : IPV4_PREFIX + : IPV6 + : IPV6_PREFIX + : VARIABLE + : RANGE + : MAC + : MAC_PREFIX + selector: "<" `selector_seq_seq` ">" `varname_token` + : "{" `selector_seq_seq` "}" `varname_token` + : "[" `selector_seq_seq` "]" `varname_token` + selector_seq_seq: `selector_seq_seq` "|" `selector_token_seq` + : `selector_token_seq` + selector_token_seq: `selector_token_seq` `selector_token` + : `selector_token` + selector_token: `selector` + : `simple_token` + +Tokens +~~~~~~ +The various capitalized tokens in the BNF above are in fact themselves +placeholders, but not defined as such in the formal grammar; the grammar +provides the structure, and the tokens are actually more like a type system for +the strings you write in your CLI definitions. A CLI definition string is +broken apart and each piece is assigned a type by the lexer based on a set of +regular expressions. The parser uses the type information to verify the string +and determine the structure of the CLI graph; additional metadata (such as the +raw text of each token) is encoded into the graph as it is constructed by the +parser, but this is merely a dumb copy job. + +Here is a brief summary of the various token types along with examples. + ++-----------------+-----------------+-------------------------------------------------------------+ +| Token type | Syntax | Description | ++=================+=================+=============================================================+ +| ``WORD`` | ``show ip bgp`` | Matches itself. In the given example every token is a WORD. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``IPV4`` | ``A.B.C.D`` | Matches an IPv4 address. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``IPV6`` | ``X:X::X:X`` | Matches an IPv6 address. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``IPV4_PREFIX`` | ``A.B.C.D/M`` | Matches an IPv4 prefix in CIDR notation. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``IPV6_PREFIX`` | ``X:X::X:X/M`` | Matches an IPv6 prefix in CIDR notation. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``MAC`` | ``M:A:C`` | Matches a 48-bit mac address. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``MAC_PREFIX`` | ``M:A:C/M`` | Matches a 48-bit mac address with a mask. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``VARIABLE`` | ``FOOBAR`` | Matches anything. | ++-----------------+-----------------+-------------------------------------------------------------+ +| ``RANGE`` | ``(X-Y)`` | Matches numbers in the range X..Y inclusive. | ++-----------------+-----------------+-------------------------------------------------------------+ + +When presented with user input, the parser will search over all defined +commands in the current context to find a match. It is aware of the various +types of user input and has a ranking system to help disambiguate commands. For +instance, suppose the following commands are defined in the user's current +context: + +:: + + example command FOO + example command (22-49) + example command A.B.C.D/X + +The following table demonstrates the matcher's choice for a selection of +possible user input. + ++-----------------------------+---------------------------+--------------------------------------------------------------------------------------------------------------+ +| Input | Matched command | Reason | ++=============================+===========================+==============================================================================================================+ +| example command eLi7eH4xx0r | example command FOO | ``eLi7eH4xx0r`` is not an integer or IPv4 prefix, | +| | | but FOO is a variable and matches all input. | ++-----------------------------+---------------------------+--------------------------------------------------------------------------------------------------------------+ +| example command 42 | example command (22-49) | ``42`` is not an IPv4 prefix. It does match both | +| | | ``(22-49)`` and ``FOO``, but RANGE tokens are more specific and have a higher priority than VARIABLE tokens. | ++-----------------------------+---------------------------+--------------------------------------------------------------------------------------------------------------+ +| example command 10.3.3.0/24 | example command A.B.C.D/X | The user entered an IPv4 prefix, which is best matched by the last command. | ++-----------------------------+---------------------------+--------------------------------------------------------------------------------------------------------------+ + +Rules +~~~~~ + +There are also constructs which allow optional tokens, mutual exclusion, one-or-more selection and repetition. + +- ``<angle|brackets>`` -- Contain sequences of tokens separated by pipes and + provide mutual exclusion. User input matches at most one option. +- ``[square brackets]`` -- Contains sequences of tokens that can be omitted. + ``[<a|b>]`` can be shortened to ``[a|b]``. +- ``{curly|braces}`` -- similar to angle brackets, but instead of mutual + exclusion, curly braces indicate that one or more of the pipe-separated + sequences may be provided in any order. +- ``VARIADICS...`` -- Any token which accepts input (anything except WORD) + which occurs as the last token of a line may be followed by an ellipsis, + which indicates that input matching the token may be repeated an unlimited + number of times. +- ``$name`` -- Specify a variable name for the preceding token. See + "Variable Names" below. + +Some general notes: + +- Options are allowed at the beginning of the command. The developer is + entreated to use these extremely sparingly. They are most useful for + implementing the 'no' form of configuration commands. Please think carefully + before using them for anything else. There is usually a better solution, even + if it is just separating out the command definition into separate ones. +- The developer should judiciously apply separation of concerns when defining + commands. CLI definitions for two unrelated or vaguely related commands or + configuration items should be defined in separate commands. Clarity is + preferred over LOC (within reason). +- The maximum number of space-separated tokens that can be entered is + presently limited to 256. Please keep this limit in mind when + implementing new CLI. + +Variable Names +-------------- + +The parser tries to fill the "varname" field on each token. This can +happen either manually or automatically. Manual specifications work by +appending ``"$name"`` after the input specifier: + +:: + + foo bar$cmd WORD$name A.B.C.D$ip + +Note that you can also assign variable names to fixed input tokens, this +can be useful if multiple commands share code. You can also use "$name" +after a multiple-choice option: + +:: + + foo bar <A.B.C.D|X:X::X:X>$addr [optionA|optionB]$mode + +The variable name is in this case assigned to the last token in each of +the branches. + +Automatic assignment of variable names works by applying the following +rules: + +- manual names always have priority +- a "[no]" at the beginning receives "no" as varname on the "no" token +- VARIABLE tokens whose text is not "WORD" or "NAME" receive a cleaned + lowercase version of the token text as varname, e.g. "ROUTE-MAP" + becomes "route\_map". +- other variable tokens (i.e. everything except "fixed") receive the + text of the preceding fixed token as varname, if one can be found. + E.g.: "ip route A.B.C.D/M INTERFACE" assigns "route" to the + "A.B.C.D/M" token. + +These rules should make it possible to avoid manual varname assignment +in 90% of the cases. + +DEFPY +----- + +``DEFPY(...)`` is an enhanced version of ``DEFUN()`` which is +preprocessed by ``python/clidef.py``. The python script parses the +command definition string, extracts variable names and types, and +generates a C wrapper function that parses the variables and passes them +on. This means that in the CLI function body, you will receive +additional parameters with appropriate types. + +This is best explained by an example: + +:: + + DEFPY(func, func_cmd, "[no] foo bar A.B.C.D (0-99)$num", "...help...") + + => + + func(self, vty, argc, argv, /* standard CLI arguments */ + + const char *no, /* unparsed "no" */ + struct in_addr bar, /* parsed IP address */ + const char *bar_str, /* unparsed IP address */ + long num, /* parsed num */ + const char *num_str) /* unparsed num */ + +Note that as documented in the previous section, "bar" is automatically +applied as variable name for "A.B.C.D". The python code then detects +this is an IP address argument and generates code to parse it into a +``struct in_addr``, passing it in ``bar``. The raw value is passed in +``bar_str``. The range/number argument works in the same way with the +explicitly given variable name. + +Type rules +~~~~~~~~~~ + ++-----------------------------+--------------------------------+--------------------------+ +| Token(s) | Type | Value if omitted by user | ++=============================+================================+==========================+ +| ``A.B.C.D`` | ``struct in_addr`` | 0.0.0.0 | ++-----------------------------+--------------------------------+--------------------------+ +| ``X:X::X:X`` | ``struct in6_addr`` | \:: | ++-----------------------------+--------------------------------+--------------------------+ +| ``A.B.C.D + X:X::X:X`` | ``const union sockunion *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| ``A.B.C.D/M`` | ``const struct prefix_ipv4 *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| ``X:X::X:X/M`` | ``const struct prefix_ipv6 *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| ``A.B.C.D/M + X:X::X:X/M`` | ``const struct prefix *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| ``(0-9)`` | ``long`` | 0 | ++-----------------------------+--------------------------------+--------------------------+ +| ``VARIABLE`` | ``const char *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| ``word`` | ``const char *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ +| *all other* | ``const char *`` | NULL | ++-----------------------------+--------------------------------+--------------------------+ + +Note the following details: + +- Not all parameters are pointers, some are passed as values. +- When the type is not ``const char *``, there will be an extra + ``_str`` argument with type ``const char *``. +- You can give a variable name not only to ``VARIABLE`` tokens but also + to ``word`` tokens (e.g. constant words). This is useful if some + parts of a command are optional. The type will be ``const char *``. +- ``[no]`` will be passed as ``const char *no``. +- Pointers will be NULL when the argument is optional and the user did + not use it. +- If a parameter is not a pointer, but is optional and the user didn't + use it, the default value will be passed. Check the ``_str`` argument + if you need to determine whether the parameter was omitted. +- If the definition contains multiple parameters with the same variable + name, they will be collapsed into a single function parameter. The + python code will detect if the types are compatible (i.e. IPv4 + IPv6 + variantes) and choose a corresponding C type. +- The standard DEFUN parameters (self, vty, argc, argv) are still + present and can be used. A DEFUN can simply be **edited into a DEFPY + without further changes and it will still work**; this allows easy + forward migration. +- A file may contain both DEFUN and DEFPY statements. + +Getting a parameter dump +~~~~~~~~~~~~~~~~~~~~~~~~ + +The clidef.py script can be called to get a list of DEFUNs/DEFPYs with +the parameter name/type list: + +:: + + lib/clippy python/clidef.py --all-defun --show lib/plist.c > /dev/null + +The generated code is printed to stdout, the info dump to stderr. The +``--all-defun`` argument will make it process DEFUN blocks as well as +DEFPYs, which is useful prior to converting some DEFUNs. **The dump does +not list the ``_str`` arguments** to keep the output shorter. + +Note that the clidef.py script cannot be run with python directly, it +needs to be run with *clippy* since the latter makes the CLI parser +available. + +Include & Makefile requirements +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A source file that uses DEFPY needs to include the ``_clippy.c`` file +**before all DEFPY statements**: + +:: + + /* GPL header */ + #include ... + + ... + + #include "daemon/filename_clippy.c" + + DEFPY(...) + DEFPY(...) + + install_element(...) + +This dependency needs to be marked in Makefile.am: (there is no ordering +requirement) + +:: + + include ../common.am + + # ... + + # if linked into a LTLIBRARY (.la/.so): + filename.lo: filename_clippy.c + + # if linked into an executable or static library (.a): + filename.o: filename_clippy.c + +Doc Strings +----------- + +Each token in a command definition should be documented with a brief doc string +that informs a user of the meaning and/or purpose of the subsequent command +tree. These strings are provided as the last parameter to DEFUN macros, +concatenated together and separated by an escaped newline (\n). These are best +explained by example. + +:: + + DEFUN (config_terminal, + config_terminal_cmd, + "configure terminal", + "Configuration from vty interface\n" + "Configuration terminal\n") + +The last parameter is split into two lines for readability. Two newline +delimited doc strings are present, one for each token in the command. +The second string documents the functionality of the 'terminal' command +in the 'configure' tree. + +Note that the first string, for 'configure' does not contain +documentation for 'terminal'. This is because the CLI is best envisioned +as a tree, with tokens defining branches. An imaginary 'start' token is +the root of every command in a CLI node. Each subsequent written token +descends into a subtree, so the documentation for that token ideally +summarizes all the functionality contained in the subtree. + +A consequence of this structure is that the developer must be careful to +use the same doc strings when defining multiple commands that are part +of the same tree. Commands which share prefixes must share the same doc +strings for those prefixes. On startup the parser will generate warnings +if it notices inconsistent doc strings. Behavior is undefined; the same +token may show up twice in completions, with different doc strings, or +it may show up once with a random doc string. Parser warnings should be +heeded and fixed to avoid confusing users. + +The number of doc strings provided must be equal to the amount of tokens +present in the command definition, read left to right, ignoring any +special constructs. + +In the examples below, each arrowed token needs a doc string. + +:: + + "show ip bgp" + ^ ^ ^ + + "command <foo|bar> [example]" + ^ ^ ^ ^ + +.. _cli-data-structures: + +Data Structures +--------------- + +On startup, the CLI parser sequentially parses each command string +definition and constructs a directed graph with each token forming a +node. This graph is the basis of the entire CLI system. It is used to +match user input in order to generate command completions and match +commands to functions. + +There is one graph per CLI node (not the same as a graph node in the CLI +graph). The CLI node struct keeps a reference to its graph (see +lib/command.h). + +While most of the graph maintains the form of a tree, special constructs +outlined in the Rules section introduce some quirks. <>, [] and {} form +self-contained 'subgraphs'. Each subgraph is a tree except that all of +the 'leaves' actually share a child node. This helps with minimizing +graph size and debugging. + +As a working example, here is the graph of the following command: :: + + show [ip] bgp neighbors [<A.B.C.D|X:X::X:X|WORD>] [json] + +.. figure:: ../figures/cligraph.svg + :align: center + + Graph of example CLI command + + +``FORK`` and ``JOIN`` nodes are plumbing nodes that don't correspond to user +input. They're necessary in order to deduplicate these constructs where +applicable. + +Options follow the same form, except that there is an edge from the ``FORK`` +node to the ``JOIN`` node. Since all of the subgraphs in the example command +are optional, all of them have this edge. + +Keywords follow the same form, except that there is an edge from ``JOIN`` to +``FORK``. Because of this the CLI graph cannot be called acyclic. There is +special logic in the input matching code that keeps a stack of paths already +taken through the node in order to disallow following the same path more than +once. + +Variadics are a bit special; they have an edge back to themselves, which allows +repeating the same input indefinitely. + +The leaves of the graph are nodes that have no out edges. These nodes are +special; their data section does not contain a token, as most nodes do, or +NULL, as in ``FORK``/``JOIN`` nodes, but instead has a pointer to a +cmd\_element. All paths through the graph that terminate on a leaf are +guaranteed to be defined by that command. When a user enters a complete +command, the command matcher tokenizes the input and executes a DFS on the CLI +graph. If it is simultaneously able to exhaust all input (one input token per +graph node), and then find exactly one leaf connected to the last node it +reaches, then the input has matched the corresponding command and the command +is executed. If it finds more than one node, then the command is ambiguous +(more on this in deduplication). If it cannot exhaust all input, the command is +unknown. If it exhausts all input but does not find an edge node, the command +is incomplete. + +The parser uses an incremental strategy to build the CLI graph for a node. Each +command is parsed into its own graph, and then this graph is merged into the +overall graph. During this merge step, the parser makes a best-effort attempt +to remove duplicate nodes. If it finds a node in the overall graph that is +equal to a node in the corresponding position in the command graph, it will +intelligently merge the properties from the node in the command graph into the +already-existing node. Subgraphs are also checked for isomorphism and merged +where possible. The definition of whether two nodes are 'equal' is based on the +equality of some set of token properties; read the parser source for the most +up-to-date definition of equality. + +When the parser is unable to deduplicate some complicated constructs, this can +result in two identical paths through separate parts of the graph. If this +occurs and the user enters input that matches these paths, they will receive an +'ambiguous command' error and will be unable to execute the command. Most of +the time the parser can detect and warn about duplicate commands, but it will +not always be able to do this. Hence care should be taken before defining a +new command to ensure it is not defined elsewhere. + +Command handlers +---------------- + +The block that follows a CLI definition is executed when a user enters +input that matches the definition. Its function signature looks like +this: + +:: + + int (*func) (const struct cmd_element *, struct vty *, int, struct cmd_token *[]); + +The first argument is the command definition struct. The last argument +is an ordered array of tokens that correspond to the path taken through +the graph, and the argument just prior to that is the length of the +array. + +The arrangement of the token array has changed from the prior +incarnation of the CLI system. In the old system, missing arguments were +padded with NULLs so that the same parts of a command would show up at +the same indices regardless of what was entered. The new system does not +perform such padding and therefore it is generally *incorrect* to assume +consistent indices in this array. As a simple example: + +Command definition: + +:: + + command [foo] <bar|baz> + +User enters: + +:: + + command foo bar + +Array: + +:: + + [0] -> command + [1] -> foo + [2] -> bar + +User enters: + +:: + + command baz + +Array: + +:: + + [0] -> command + [1] -> baz + +Command abbreviation & matching priority +---------------------------------------- + +As in the prior implementation, it is possible for users to elide parts +of tokens when the CLI matcher does not need them to make an unambiguous +match. This is best explained by example. + +Command definitions: + +:: + + command dog cow + command dog crow + +User input: + +:: + + c d c -> ambiguous command + c d co -> match "command dog cow" + +In the new implementation, this functionality has improved. Where +previously the parser would stop at the first ambiguous token, it will +now look ahead and attempt to disambiguate based on tokens later on in +the input string. + +Command definitions: + +:: + + show ip bgp A.B.C.D + show ipv6 bgp X:X::X:X + +User enters: + +:: + + s i b 4.3.2.1 -> match "show ip bgp A.B.C.D" + s i b ::e0 -> match "show ipv6 bgp X:X::X:X" + +Previously both of these commands would be ambiguous since 'i' does not +explicitly select either 'ip' or 'ipv6'. However, since the user later +provides a token that matches only one of the commands (an IPv4 or IPv6 +address) the parser is able to look ahead and select the appropriate +command. This has some implications for parsing the argv\*[] that is +passed to the command handler. + +Now consider a command definition such as: + +:: + + command <foo|VAR> + +'foo' only matches the string 'foo', but 'VAR' matches any input, +including 'foo'. Who wins? In situations like this the matcher will +always choose the 'better' match, so 'foo' will win. + +Consider also: + +:: + + show <ip|ipv6> foo + +User input: + +:: + + show ip foo + +'ip' partially matches 'ipv6' but exactly matches 'ip', so 'ip' will +win. + +struct cmd\_token +----------------- + +:: + + /* Command token struct. */ + struct cmd_token + { + enum cmd_token_type type; // token type + u_char attr; // token attributes + bool allowrepeat; // matcher allowed to match token repetitively? + + char *text; // token text + char *desc; // token description + long long min, max; // for ranges + char *arg; // user input that matches this token + char *varname; // variable name + }; + +This struct is used in the CLI graph to match input against. It is also +used to pass user input to command handler functions, as it is +frequently useful for handlers to have access to that information. When +a command is matched, the sequence of cmd\_tokens that form the matching +path are duplicated and placed in order into argv\*[]. Before this +happens the ->arg field is set to point at the snippet of user input +that matched it. + +For most nontrivial commands the handler function will need to determine +which of the possible matching inputs was entered. Previously this was +done by looking at the first few characters of input. This is now +considered an anti-pattern and should be avoided. Instead, the ->type or +->text fields for this logic. The ->type field can be used when the +possible inputs differ in type. When the possible types are the same, +use the ->text field. This field has the full text of the corresponding +token in the definition string and using it makes for much more readable +code. An example is helpful. + +Command definition: + +:: + + command <(1-10)|foo|BAR> + +In this example, the user may enter any one of: \* an integer between 1 +and 10 \* "foo" \* anything at all + +If the user enters "command f", then: + +:: + + argv[1]->type == WORD_TKN + argv[1]->arg == "f" + argv[1]->text == "foo" + +Range tokens have some special treatment; a token with ->type == +RANGE\_TKN will have the ->min and ->max fields set to the bounding +values of the range. + +Permutations +------------ + +Finally, it is sometimes useful to check all the possible combinations +of input that would match an arbitrary definition string. There is a +tool in tools/ called 'permutations' that reads CLI definition strings +on stdin and prints out all matching input permutations. It also dumps a +text representation of the graph, which is more useful for debugging +than anything else. It looks like this: + +:: + + $ ./permutations "show [ip] bgp [<view|vrf> WORD]" + + show ip bgp view WORD + show ip bgp vrf WORD + show ip bgp + show bgp view WORD + show bgp vrf WORD + show bgp + +This functionality is also built into VTY/VTYSH; the 'list permutations' +command will list all possible matching input permutations in the +current CLI node. diff --git a/doc/code/conf.py b/doc/developer/conf.py index 38be7f2fc..e2293b2a6 100644 --- a/doc/code/conf.py +++ b/doc/developer/conf.py @@ -24,7 +24,10 @@ import re # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +needs_sphinx = '1.0' + +# prolog for various variable substitutions +rst_prolog = '' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -36,7 +39,7 @@ templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] +# source_suffix = ['.rst'] source_suffix = '.rst' # The encoding of source files. @@ -59,14 +62,51 @@ version = u'?.?' # The full version, including alpha/beta/rc tags. release = u'?.?-?' + +# ----------------------------------------------------------------------------- +# Extract values from codebase for substitution into docs. +# ----------------------------------------------------------------------------- + +# Various installation prefixes. Reasonable defaults are set where possible. +# Values are overridden by logic below. +replace_vars = { + 'AUTHORS': 'Kunihiro Ishiguro, et al.', + 'COPYRIGHT_YEAR': '1999-2005', + 'COPYRIGHT_STR': None, + 'PACKAGE_NAME': project.lower(), + 'PACKAGE_TARNAME': project.lower(), + 'PACKAGE_STRING': None, + 'PACKAGE_URL': 'https://frrouting.org/', + 'PACKAGE_VERSION': None, + 'INSTALL_PREFIX_ETC': None, + 'INSTALL_PREFIX_SBIN': None, + 'INSTALL_PREFIX_STATE': None, + 'INSTALL_PREFIX_MODULES': None, + 'INSTALL_USER': None, + 'INSTALL_GROUP': None, + 'INSTALL_VTY_GROUP': None, +} + +# extract version information, installation location, other stuff we need to +# use when building final documents val = re.compile('^S\["([^"]+)"\]="(.*)"$') with open('../../config.status', 'r') as cfgstatus: for ln in cfgstatus.readlines(): m = val.match(ln) - if m is None: continue - if m.group(1) == 'PACKAGE_VERSION': - release = m.group(2) - version = release.split('-')[0] + if not m or m.group(1) not in replace_vars.keys(): continue + replace_vars[m.group(1)] = m.group(2) + +# manually fill out some of these we can't get from config.status +replace_vars['COPYRIGHT_STR'] = "Copyright (c)" +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['COPYRIGHT_YEAR']) +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['AUTHORS']) +release = replace_vars['PACKAGE_VERSION'] +version = release.split('-')[0] + +# add substitutions to prolog +for key, value in replace_vars.items(): + rst_prolog += '.. |{0}| replace:: {1}\n'.format(key, value) + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -117,12 +157,14 @@ todo_include_todos = True # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'sphinx_rtd_theme' +html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +html_theme_options = { + 'sidebarbgcolor': '#374249' +} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] @@ -136,17 +178,17 @@ html_theme = 'sphinx_rtd_theme' # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +html_logo = '../figures/frr-icon.svg' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +html_favicon = '../figures/frr-logo-icon.png' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +#html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -231,13 +273,13 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'FRR.tex', u'FRR Documentation', + (master_doc, 'FRR.tex', u"FRR Developer's Manual", u'FRR', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +latex_logo = '../figures/frr-logo-medium.png' # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. @@ -261,7 +303,7 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (master_doc, 'frr', u'FRR Documentation', + (master_doc, 'frr', u"FRR Developer's Manual", [author], 1) ] @@ -275,7 +317,7 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'FRR', u'FRR Documentation', + (master_doc, 'frr', u"FRR Developer's Manual", author, 'FRR', 'One line description of project.', 'Miscellaneous'), ] @@ -291,3 +333,9 @@ texinfo_documents = [ # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False + +# custom extensions here +def setup(app): + # object type for FRR CLI commands, can be extended to document parent CLI + # node later on + app.add_object_type('clicmd', 'clicmd') diff --git a/doc/dev-modules.md b/doc/developer/dev-modules.md index 87bc96318..87bc96318 100644 --- a/doc/dev-modules.md +++ b/doc/developer/dev-modules.md diff --git a/doc/draft-zebra-00.ms b/doc/developer/draft-zebra-00.ms index 25994727a..25994727a 100644 --- a/doc/draft-zebra-00.ms +++ b/doc/developer/draft-zebra-00.ms diff --git a/doc/code/hooks.rst b/doc/developer/hooks.rst index 0afa297aa..0afa297aa 100644 --- a/doc/code/hooks.rst +++ b/doc/developer/hooks.rst diff --git a/doc/code/index.rst b/doc/developer/index.rst index 79647d0b9..acb05e281 100644 --- a/doc/code/index.rst +++ b/doc/developer/index.rst @@ -1,18 +1,13 @@ Welcome to FRR's documentation! =============================== -Contents: - .. toctree:: :maxdepth: 2 + workflow library - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + bgpd + building + ospf-api + ospf-sr diff --git a/doc/ldpd-basic-test-setup.md b/doc/developer/ldpd-basic-test-setup.md index b25a2b6d4..b25a2b6d4 100644 --- a/doc/ldpd-basic-test-setup.md +++ b/doc/developer/ldpd-basic-test-setup.md diff --git a/doc/code/library.rst b/doc/developer/library.rst index dd46021db..791aedb62 100644 --- a/doc/code/library.rst +++ b/doc/developer/library.rst @@ -6,5 +6,7 @@ libfrr library facilities memtypes hooks + cli + modules diff --git a/doc/code/memtypes.rst b/doc/developer/memtypes.rst index 62d211e86..d40ebe31c 100644 --- a/doc/code/memtypes.rst +++ b/doc/developer/memtypes.rst @@ -81,7 +81,7 @@ Definition >80% of cases. .. todo:: - + Daemons currently have ``daemon_memory.[ch]`` files listing all of their MTYPEs. This is not how it should be, most of these types should be moved into the appropriate files where they are used. diff --git a/doc/developer/modules.rst b/doc/developer/modules.rst new file mode 100644 index 000000000..b832413a6 --- /dev/null +++ b/doc/developer/modules.rst @@ -0,0 +1,123 @@ +Modules +======= + +FRR has facilities to load DSOs at startup via ``dlopen()``. These are used to +implement modules, such as SNMP and FPM. + +Limitations +----------- + +- can't load, unload, or reload during runtime. This just needs some + work and can probably be done in the future. +- doesn't fix any of the "things need to be changed in the code in the + library" issues. Most prominently, you can't add a CLI node because + CLI nodes are listed in the library... +- if your module crashes, the daemon crashes. Should be obvious. +- **does not provide a stable API or ABI**. Your module must match a + version of FRR and you may have to update it frequently to match + changes. +- **does not create a license boundary**. Your module will need to link + libzebra and include header files from the daemons, meaning it will + be GPL-encumbered. + +Installation +------------ + +Look for ``moduledir`` in ``configure.ac``, default is normally +``/usr/lib64/frr/modules`` but depends on ``--libdir`` / ``--prefix``. + +The daemon's name is prepended when looking for a module, e.g. "snmp" +tries to find "zebra\_snmp" first when used in zebra. This is just to +make it nicer for the user, with the snmp module having the same name +everywhere. + +Modules can be packaged separately from FRR. The SNMP and FPM modules +are good candidates for this because they have dependencies (net-snmp / +protobuf) that are not FRR dependencies. However, any distro packages +should have an "exact-match" dependency onto the FRR package. Using a +module from a different FRR version will probably blow up nicely. + +For snapcraft (and during development), modules can be loaded with full +path (e.g. -M ``$SNAP/lib/frr/modules/zebra_snmp.so``). Note that +libtool puts output files in the .libs directory, so during development +you have to use ``./zebra -M .libs/zebra_snmp.so``. + +Creating a module +----------------- + +... best to look at the existing SNMP or FPM modules. + +Basic boilerplate: + +:: + + #include "hook.h" + #include "module.h" + + static int + module_init (void) + { + hook_register(frr_late_init, module_late_init); + return 0; + } + + FRR_MODULE_SETUP( + .name = "my module", + .version = "0.0", + .description = "my module", + .init = module_init, + ) + +The ``frr_late_init`` hook will be called after the daemon has finished +its other startup and is about to enter the main event loop; this is the +best place for most initialisation. + +Compiler & Linker magic +----------------------- + +There's a ``THIS_MODULE`` (like in the Linux kernel), which uses +``visibility`` attributes to restrict it to the current module. If you +get a linker error with ``_frrmod_this_module``, there is some linker +SNAFU. This shouldn't be possible, though one way to get it would be to +not include libzebra (which provides a fallback definition for the +symbol). + +libzebra and the daemons each have their own ``THIS_MODULE``, as do all +loadable modules. In any other libraries (e.g. ``libfrrsnmp``), +``THIS_MODULE`` will use the definition in libzebra; same applies if the +main executable doesn't use ``FRR_DAEMON_INFO`` (e.g. all testcases). + +The deciding factor here is "what dynamic linker unit are you using the +symbol from." If you're in a library function and want to know who +called you, you can't use ``THIS_MODULE`` (because that'll just tell you +you're in the library). Put a macro around your function that adds +``THIS_MODULE`` in the *caller's code calling your function*. + +The idea is to use this in the future for module unloading. Hooks +already remember which module they were installed by, as groundwork for +a function that removes all of a module's installed hooks. + +There's also the ``frr_module`` symbol in modules, pretty much a +standard entry point for loadable modules. + +Hooks +----- + +Hooks are just points in the code where you can register your callback +to be called. The parameter list is specific to the hook point. Since +there is no stable API, the hook code has some extra type safety checks +making sure you get a compiler warning when the hook parameter list +doesn't match your callback. Don't ignore these warnings. + +Relation to MTYPE macros +------------------------ + +The MTYPE macros, while primarily designed to decouple MTYPEs from the +library and beautify the code, also work very nicely with loadable +modules -- both constructors and destructors are executed when +loading/unloading modules. + +This means there is absolutely no change required to MTYPEs, you can +just use them in a module and they will even clean up themselves when we +implement module unloading and an unload happens. In fact, it's +impossible to create a bug where unloading fails to de-register a MTYPE. diff --git a/doc/developer/next-hop-tracking.rst b/doc/developer/next-hop-tracking.rst new file mode 100644 index 000000000..284db1ef5 --- /dev/null +++ b/doc/developer/next-hop-tracking.rst @@ -0,0 +1,352 @@ +Next Hop Tracking +================== + +Next hop tracking is an optimization feature that reduces the processing time +involved in the BGP bestpath algorithm by monitoring changes to the routing +table. + +Background +----------- + +Recursive routes are of the form: + +:: + + p/m --> n + [Ex: 1.1.0.0/16 --> 2.2.2.2] + +where 'n' itself is resolved through another route as follows: + +:: + + p2/m --> h, interface + [Ex: 2.2.2.0/24 --> 3.3.3.3, eth0] + +Usually, BGP routes are recursive in nature and BGP nexthops get resolved +through an IGP route. IGP usually adds its routes pointing to an interface +(these are called non-recursive routes). + +When BGP receives a recursive route from a peer, it needs to validate the +nexthop. The path is marked valid or invalid based on the reachability status +of the nexthop. Nexthop validation is also important for BGP decision process +as the metric to reach the nexthop is a parameter to best path selection +process. + +As it goes with routing, this is a dynamic process. Route to the nexthop can +change. The nexthop can become unreachable or reachable. In the current BGP +implementation, the nexthop validation is done periodically in the scanner run. +The default scanner run interval is one minute. Every minute, the scanner task +walks the entire BGP table. It checks the validity of each nexthop with Zebra +(the routing table manager) through a request and response message exchange +between BGP and Zebra process. BGP process is blocked for that duration. The +mechanism has two major drawbacks: + +- The scanner task runs to completion. That can potentially starve the other + tasks for long periods of time, based on the BGP table size and number of + nexthops. + +- Convergence around routing changes that affect the nexthops can be long + (around a minute with the default intervals). The interval can be shortened + to achieve faster reaction time, but it makes the first problem worse, with + the scanner task consuming most of the CPU resources. + +The next-hop tracking feature makes this process event-driven. It eliminates +periodic nexthop validation and introduces an asynchronous communication path +between BGP and Zebra for route change notifications that can then be acted +upon. + +Goal +---- + +Stating the obvious, the main goal is to remove the two limitations we +discussed in the previous section. The goals, in a constructive tone, +are the following: + +- **Fairness**: the scanner run should not consume an unjustly high amount of + CPU time. This should give an overall good performance and response time to + other events (route changes, session events, IO/user interface). + +- **Convergence**: BGP must react to nexthop changes instantly and provide + sub-second convergence. This may involve diverting the routes from one + nexthop to another. + +Overview of changes +------------------------ + +The changes are in both BGP and Zebra modules. The short summary is +the following: + +- Zebra implements a registration mechanism by which clients can + register for next hop notification. Consequently, it maintains a + separate table, per (VRF, AF) pair, of next hops and interested + client-list per next hop. + +- When the main routing table changes in Zebra, it evaluates the next + hop table: for each next hop, it checks if the route table + modifications have changed its state. If so, it notifies the + interested clients. + +- BGP is one such client. It registers the next hops corresponding to + all of its received routes/paths. It also threads the paths against + each nexthop structure. + +- When BGP receives a next hop notification from Zebra, it walks the + corresponding path list. It makes them valid or invalid depending + on the next hop notification. It then re-computes best path for the + corresponding destination. This may result in re-announcing those + destinations to peers. + +Design +------ + +Modules +~~~~~~~ + +The core design introduces an "nht" (next hop tracking) module in BGP +and "rnh" (recursive nexthop) module in Zebra. The "nht" module +provides the following APIs: + ++----------------------------+--------------------------------------------------+ +| Function | Action | ++============================+==================================================+ +| bgp_find_or_add_nexthop() | find or add a nexthop in BGP nexthop table | ++----------------------------+--------------------------------------------------+ +| bgp_find_nexthop() | find a nexthop in BGP nexthop table | ++----------------------------+--------------------------------------------------+ +| bgp_parse_nexthop_update() | parse a nexthop update message coming from zebra | ++----------------------------+--------------------------------------------------+ + +The "rnh" module provides the following APIs: + ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| Function | Action | ++============================+==========================================================================================================+ +| zebra_add_rnh() | add a recursive nexthop | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_delete_rnh() | delete a recursive nexthop | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_lookup_rnh() | lookup a recursive nexthop | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_add_rnh_client() | register a client for nexthop notifications against a recursive nexthop | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_remove_rnh_client() | remove the client registration for a recursive nexthop | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_evaluate_rnh_table() | (re)evaluate the recursive nexthop table (most probably because the main routing table has changed). | ++----------------------------+----------------------------------------------------------------------------------------------------------+ +| zebra_cleanup_rnh_client() | Cleanup a client from the "rnh" module data structures (most probably because the client is going away). | ++----------------------------+----------------------------------------------------------------------------------------------------------+ + +4.2. Control flow + +The next hop registration control flow is the following: + +:: + + <==== BGP Process ====>|<==== Zebra Process ====> + | + receive module nht module | zserv module rnh module + ---------------------------------------------------------------------- + | | | + bgp_update_ | | | + main() | bgp_find_or_add_ | | + | nexthop() | | + | | | + | | zserv_nexthop_ | + | | register() | + | | | zebra_add_rnh() + | | | + + +The next hop notification control flow is the following: + +:: + + <==== Zebra Process ====>|<==== BGP Process ====> + | + rib module rnh module | zebra module nht module + ---------------------------------------------------------------------- + | | | + meta_queue_ | | | + process() | zebra_evaluate_ | | + | rnh_table() | | + | | | + | | bgp_read_nexthop_ | + | | update() | + | | | bgp_parse_ + | | | nexthop_update() + | | | + + +zclient message format +~~~~~~~~~~~~~~~~~~~~~~ + +ZEBRA_NEXTHOP_REGISTER and ZEBRA_NEXTHOP_UNREGISTER messages are +encoded in the following way: + +:: + + . 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | AF | prefix len | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . Nexthop prefix . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | AF | prefix len | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . Nexthop prefix . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + +``ZEBRA_NEXTHOP_UPDATE`` message is encoded as follows: + +:: + + . 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | AF | prefix len | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . Nexthop prefix getting resolved . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | metric | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | #nexthops | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | nexthop type | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . resolving Nexthop details . + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | nexthop type | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + . resolving Nexthop details . + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + +BGP data structure +~~~~~~~~~~~~~~~~~~ +Legend: + +:: + + /\ struct bgp_node: a BGP destination/route/prefix + \/ + + [ ] struct bgp_info: a BGP path (e.g. route received from a peer) + + _ + (_) struct bgp_nexthop_cache: a BGP nexthop + + /\ NULL + \/--+ ^ + | : + +--[ ]--[ ]--[ ]--> NULL + /\ : + \/--+ : + | : + +--[ ]--[ ]--> NULL + : + _ : + (_)........... + + +Zebra data structure +~~~~~~~~~~~~~~~~~~~~ + +RNH table:: + + O + / \ + O O + / \ + O O + + struct rnh + { + u_char flags; + struct route_entry *state; + struct list *client_list; + struct route_node *node; + }; + +User interface changes +~~~~~~~~~~~~~~~~~~~~~~ + +:: + + frr# show ip nht + 3.3.3.3 + resolved via kernel + via 11.0.0.6, swp1 + Client list: bgp(fd 12) + 11.0.0.10 + resolved via connected + is directly connected, swp2 + Client list: bgp(fd 12) + 11.0.0.18 + resolved via connected + is directly connected, swp4 + Client list: bgp(fd 12) + 11.11.11.11 + resolved via kernel + via 10.0.1.2, eth0 + Client list: bgp(fd 12) + + frr# show ip bgp nexthop + Current BGP nexthop cache: + 3.3.3.3 valid [IGP metric 0], #paths 3 + Last update: Wed Oct 16 04:43:49 2013 + + 11.0.0.10 valid [IGP metric 1], #paths 1 + Last update: Wed Oct 16 04:43:51 2013 + + 11.0.0.18 valid [IGP metric 1], #paths 2 + Last update: Wed Oct 16 04:43:47 2013 + + 11.11.11.11 valid [IGP metric 0], #paths 1 + Last update: Wed Oct 16 04:43:47 2013 + + frr# show ipv6 nht + frr# show ip bgp nexthop detail + + frr# debug bgp nht + frr# debug zebra nht + + 6. Sample test cases + + r2----r3 + / \ / + r1----r4 + + - Verify that a change in IGP cost triggers NHT + + shutdown the r1-r4 and r2-r4 links + + no shut the r1-r4 and r2-r4 links and wait for OSPF to come back + up + + We should be back to the original nexthop via r4 now + - Verify that a NH becoming unreachable triggers NHT + + Shutdown all links to r4 + - Verify that a NH becoming reachable triggers NHT + + no shut all links to r4 + +Future work +~~~~~~~~~~~ + +- route-policy for next hop validation (e.g. ignore default route) +- damping for rapid next hop changes +- prioritized handling of nexthop changes ((un)reachability vs. metric + changes) +- handling recursion loop, e.g:: + + 11.11.11.11/32 -> 12.12.12.12 + 12.12.12.12/32 -> 11.11.11.11 + 11.0.0.0/8 -> <interface> +- better statistics diff --git a/doc/developer/ospf-api.rst b/doc/developer/ospf-api.rst new file mode 100644 index 000000000..5f0b830c8 --- /dev/null +++ b/doc/developer/ospf-api.rst @@ -0,0 +1,388 @@ +OSPF API Documentation +====================== + +Disclaimer +---------- + +The OSPF daemon contains an API for application access to the LSA +database. This API was created by Ralph Keller, originally as patch for +Zebra. Unfortunately, the page containing documentation of the API is no +longer online. This page is an attempt to recreate documentation for the +API (with lots of help of the WayBackMachine) + +Introduction +------------ + +This page describes an API that allows external applications to access +the link-state database (LSDB) of the OSPF daemon. The implementation is +based on the OSPF code from FRRouting (forked from Quagga and formerly +Zebra) routing protocol suite and is subject to the GNU General Public +License. The OSPF API provides you with the following functionality: + +- Retrieval of the full or partial link-state database of the OSPF + daemon. This allows applications to obtain an exact copy of the LSDB + including router LSAs, network LSAs and so on. Whenever a new LSA + arrives at the OSPF daemon, the API module immediately informs the + application by sending a message. This way, the application is always + synchronized with the LSDB of the OSPF daemon. +- Origination of own opaque LSAs (of type 9, 10, or 11) which are then + distributed transparently to other routers within the flooding scope + and received by other applications through the OSPF API. + +Opaque LSAs, which are described in RFC 2370 , allow you to distribute +application-specific information within a network using the OSPF +protocol. The information contained in opaque LSAs is transparent for +the routing process but it can be processed by other modules such as +traffic engineering (e.g., MPLS-TE). + +Architecture +------------ + +The following picture depicts the architecture of the Quagga/Zebra +protocol suite. The OSPF daemon is extended with opaque LSA capabilities +and an API for external applications. The OSPF core module executes the +OSPF protocol by discovering neighbors and exchanging neighbor state. +The opaque module, implemented by Masahiko Endo, provides functions to +exchange opaque LSAs between routers. Opaque LSAs can be generated by +several modules such as the MPLS-TE module or the API server module. +These modules then invoke the opaque module to flood their data to +neighbors within the flooding scope. + +The client, which is an application potentially running on a different +node than the OSPF daemon, links against the OSPF API client library. +This client library establishes a socket connection with the API server +module of the OSPF daemon and uses this connection to retrieve LSAs and +originate opaque LSAs. + +.. figure:: ../figures/ospf_api_architecture.png + :alt: image + + image + +The OSPF API server module works like any other internal opaque module +(such as the MPLS-TE module), but listens to connections from external +applications that want to communicate with the OSPF daemon. The API +server module can handle multiple clients concurrently. + +One of the main objectives of the implementation is to make as little +changes to the existing Zebra code as possible. + +Installation & Configuration +---------------------------- + +Download FRRouting and unpack + +Configure your frr version (note that --enable-opaque-lsa also enables +the ospfapi server and ospfclient). + +:: + + % update-autotools + % sh ./configure --enable-opaque-lsa + % make + +This should also compile the client library and sample application in +ospfclient. + +Make sure that you have enabled opaque LSAs in your configuration. Add +the ospf opaque-lsa statement to your ospfd.conf: + +:: + + ! -*- ospf -*- + ! + ! OSPFd sample configuration file + ! + ! + hostname xxxxx + password xxxxx + + router ospf + router-id 10.0.0.1 + network 10.0.0.1/24 area 1 + neighbor 10.0.0.2 + network 10.0.1.2/24 area 1 + neighbor 10.0.1.1 + ospf opaque-lsa <============ add this statement! + +Usage +----- + +In the following we describe how you can use the sample application to +originate opaque LSAs. The sample application first registers with the +OSPF daemon the opaque type it wants to inject and then waits until the +OSPF daemon is ready to accept opaque LSAs of that type. Then the client +application originates an opaque LSA, waits 10 seconds and then updates +the opaque LSA with new opaque data. After another 20 seconds, the +client application deletes the opaque LSA from the LSDB. If the clients +terminates unexpectedly, the OSPF API module will remove all the opaque +LSAs that the application registered. Since the opaque LSAs are flooded +to other routers, we will see the opaque LSAs in all routers according +to the flooding scope of the opaque LSA. + +We have a very simple demo setup, just two routers connected with an ATM +point-to-point link. Start the modified OSPF daemons on two adjacent +routers. First run on msr2: + +:: + + > msr2:/home/keller/ospfapi/zebra/ospfd# ./ospfd -f /usr/local/etc/ospfd.conf + +And on the neighboring router msr3: + +:: + + > msr3:/home/keller/ospfapi/zebra/ospfd# ./ospfd -f /usr/local/etc/ospfd.conf + +Now the two routers form adjacency and start exchanging their databases. +Looking at the OSPF daemon of msr2 (or msr3), you see this: + +:: + + ospfd> show ip ospf database + + OSPF Router with ID (10.0.0.1) + + Router Link States (Area 0.0.0.1) + + Link ID ADV Router Age Seq# CkSum Link count + 10.0.0.1 10.0.0.1 55 0x80000003 0xc62f 2 + 10.0.0.2 10.0.0.2 55 0x80000003 0xe3e4 3 + + Net Link States (Area 0.0.0.1) + + Link ID ADV Router Age Seq# CkSum + 10.0.0.2 10.0.0.2 60 0x80000001 0x5fcb + +Now we start the sample main application that originates an opaque LSA. + +:: + + > cd ospfapi/apiclient + > ./main msr2 10 250 20 0.0.0.0 0.0.0.1 + +This originates an opaque LSA of type 10 (area local), with opaque type +250 (experimental), opaque id of 20 (chosen arbitrarily), interface +address 0.0.0.0 (which is used only for opaque LSAs type 9), and area +0.0.0.1 + +Again looking at the OSPF database you see: + +:: + + ospfd> show ip ospf database + + OSPF Router with ID (10.0.0.1) + + Router Link States (Area 0.0.0.1) + + Link ID ADV Router Age Seq# CkSum Link count + 10.0.0.1 10.0.0.1 437 0x80000003 0xc62f 2 + 10.0.0.2 10.0.0.2 437 0x80000003 0xe3e4 3 + + Net Link States (Area 0.0.0.1) + + Link ID ADV Router Age Seq# CkSum + 10.0.0.2 10.0.0.2 442 0x80000001 0x5fcb + + Area-Local Opaque-LSA (Area 0.0.0.1) + + Opaque-Type/Id ADV Router Age Seq# CkSum + 250.0.0.20 10.0.0.1 0 0x80000001 0x58a6 <=== opaque LSA + +You can take a closer look at this opaque LSA: + +:: + + ospfd> show ip ospf database opaque-area + + OSPF Router with ID (10.0.0.1) + + + Area-Local Opaque-LSA (Area 0.0.0.1) + + LS age: 4 + Options: 66 + LS Type: Area-Local Opaque-LSA + Link State ID: 250.0.0.20 (Area-Local Opaque-Type/ID) + Advertising Router: 10.0.0.1 + LS Seq Number: 80000001 + Checksum: 0x58a6 + Length: 24 + Opaque-Type 250 (Private/Experimental) + Opaque-ID 0x14 + Opaque-Info: 4 octets of data + Added using OSPF API: 4 octets of opaque data + Opaque data: 1 0 0 0 <==== counter is 1 + +Note that the main application updates the opaque LSA after 10 seconds, +then it looks as follows: + +:: + + ospfd> show ip ospf database opaque-area + + OSPF Router with ID (10.0.0.1) + + + Area-Local Opaque-LSA (Area 0.0.0.1) + + LS age: 1 + Options: 66 + LS Type: Area-Local Opaque-LSA + Link State ID: 250.0.0.20 (Area-Local Opaque-Type/ID) + Advertising Router: 10.0.0.1 + LS Seq Number: 80000002 + Checksum: 0x59a3 + Length: 24 + Opaque-Type 250 (Private/Experimental) + Opaque-ID 0x14 + Opaque-Info: 4 octets of data + Added using OSPF API: 4 octets of opaque data + Opaque data: 2 0 0 0 <==== counter is now 2 + +Note that the payload of the opaque LSA has changed as you can see +above. + +Then, again after another 20 seconds, the opaque LSA is flushed from the +LSDB. + +Important note: +^^^^^^^^^^^^^^^ + +In order to originate an opaque LSA, there must be at least one active +opaque-capable neighbor. Thus, you cannot originate opaque LSAs of no +neighbors are present. If you try to originate even so no neighbor is +ready, you will receive a not ready error message. The reason for this +restriction is that it might be possible that some routers have an +identical opaque LSA from a previous origination in their LSDB that +unfortunately could not be flushed due to a crash, and now if the router +comes up again and starts originating a new opaque LSA, the new opaque +LSA is considered older since it has a lower sequence number and is +ignored by other routers (that consider the stalled opaque LSA as more +recent). However, if the originating router first synchronizes the +database before originating opaque LSAs, it will detect the older opaque +LSA and can flush it first. + +Protocol and Message Formats +---------------------------- + +If you are developing your own client application and you don't want to +make use of the client library (due to the GNU license restriction or +whatever reason), you can implement your own client-side message +handling. The OSPF API uses two connections between the client and the +OSPF API server: One connection is used for a synchronous request /reply +protocol and another connection is used for asynchronous notifications +(e.g., LSA update, neighbor status change). + +Each message begins with the following header: + +.. figure:: ../figures/ospf_api_msghdr.png + :alt: image + + image + +The message type field can take one of the following values: + ++-------------------------------+---------+ +| Messages to OSPF deamon | Value | ++===============================+=========+ +| MSG\_REGISTER\_OPAQUETYPE | 1 | ++-------------------------------+---------+ +| MSG\_UNREGISTER\_OPAQUETYPE | 2 | ++-------------------------------+---------+ +| MSG\_REGISTER\_EVENT | 3 | ++-------------------------------+---------+ +| MSG\_SYNC\_LSDB | 4 | ++-------------------------------+---------+ +| MSG\_ORIGINATE\_REQUEST | 5 | ++-------------------------------+---------+ +| MSG\_DELETE\_REQUEST | 6 | ++-------------------------------+---------+ + ++-----------------------------+---------+ +| Messages from OSPF deamon | Value | ++=============================+=========+ +| MSG\_REPLY | 10 | ++-----------------------------+---------+ +| MSG\_READY\_NOTIFY | 11 | ++-----------------------------+---------+ +| MSG\_LSA\_UPDATE\_NOTIFY | 12 | ++-----------------------------+---------+ +| MSG\_LSA\_DELETE\_NOTIFY | 13 | ++-----------------------------+---------+ +| MSG\_NEW\_IF | 14 | ++-----------------------------+---------+ +| MSG\_DEL\_IF | 15 | ++-----------------------------+---------+ +| MSG\_ISM\_CHANGE | 16 | ++-----------------------------+---------+ +| MSG\_NSM\_CHANGE | 17 | ++-----------------------------+---------+ + +The synchronous requests and replies have the following message formats: + +.. figure:: ../figures/ospf_api_msgs1.png + :alt: image + + image + +The origin field allows to select according to the following types of +origins: + ++-------------------------+---------+ +| Origin | Value | ++=========================+=========+ +| NON\_SELF\_ORIGINATED | 0 | ++-------------------------+---------+ +| SELF\_ORIGINATED | 1 | ++-------------------------+---------+ +| ANY\_ORIGIN | 2 | ++-------------------------+---------+ + +The reply message has on of the following error codes: + ++--------------------------+---------+ +| Error code | Value | ++==========================+=========+ +| API\_OK | 0 | ++--------------------------+---------+ +| API\_NOSUCHINTERFACE | -1 | ++--------------------------+---------+ +| API\_NOSUCHAREA | -2 | ++--------------------------+---------+ +| API\_NOSUCHLSA | -3 | ++--------------------------+---------+ +| API\_ILLEGALSATYPE | -4 | ++--------------------------+---------+ +| API\_ILLEGALOPAQUETYPE | -5 | ++--------------------------+---------+ +| API\_OPAQUETYPEINUSE | -6 | ++--------------------------+---------+ +| API\_NOMEMORY | -7 | ++--------------------------+---------+ +| API\_ERROR | -99 | ++--------------------------+---------+ +| API\_UNDEF | -100 | ++--------------------------+---------+ + +The asynchronous notifications have the following message formats: + +.. figure:: ../figures/ospf_api_msgs2.png + :alt: image + + image + +Original Acknowledgments from Ralph Keller +------------------------------------------ + +I would like to thank Masahiko Endo, the author of the opaque LSA +extension module, for his great support. His wonderful ASCII graphs +explaining the internal workings of this code, and his invaluable input +proved to be crucial in designing a useful API for accessing the link +state database of the OSPF daemon. Once, he even decided to take the +plane from Tokyo to Zurich so that we could actually meet and have +face-to-face discussions, which was a lot of fun. Clearly, without +Masahiko no API would ever be completed. I also would like to thank +Daniel Bauer who wrote an opaque LSA implementation too and was willing +to test the OSPF API code in one of his projects. diff --git a/doc/OSPF-SR.rst b/doc/developer/ospf-sr.rst index 299a7e1c8..3f8b549df 100644 --- a/doc/OSPF-SR.rst +++ b/doc/developer/ospf-sr.rst @@ -21,9 +21,9 @@ Supported Features Interoperability ---------------- -* tested on various topology including point-to-point and LAN interfaces +* Tested on various topology including point-to-point and LAN interfaces in a mix of Free Range Routing instance and Cisco IOS-XR 6.0.x -* check OSPF LSA conformity with latest wireshark release 2.5.0-rc +* Check OSPF LSA conformity with latest wireshark release 2.5.0-rc Implementation details ---------------------- @@ -196,17 +196,17 @@ yourself: :: - modprobe mpls_router - modprobe mpls_gso - modprobe mpls_iptunnel + modprobe mpls_router + modprobe mpls_gso + modprobe mpls_iptunnel Then, you must activate MPLS on the interface you would used: :: - sysctl -w net.mpls.conf.enp0s9.input=1 - sysctl -w net.mpls.conf.lo.input=1 - sysctl -w net.mpls.platform_labels=1048575 + sysctl -w net.mpls.conf.enp0s9.input=1 + sysctl -w net.mpls.conf.lo.input=1 + sysctl -w net.mpls.platform_labels=1048575 The last line fix the maximum MPLS label value. @@ -215,8 +215,8 @@ enable with: :: - ip -M route - ip route + ip -M route + ip route The first command show the MPLS LFIB table while the second show the FIB table which contains route with MPLS label encapsulation. @@ -227,8 +227,8 @@ especially the `lo` one. For that purpose, disable RP filtering with: :: - systcl -w net.ipv4.conf.all.rp_filter=0 - sysctl -w net.ipv4.conf.lo.rp_filter=0 + systcl -w net.ipv4.conf.all.rp_filter=0 + sysctl -w net.ipv4.conf.lo.rp_filter=0 OSPFd ~~~~~ @@ -240,16 +240,16 @@ Routing. :: - router ospf - ospf router-id 192.168.1.11 - capability opaque - mpls-te on - mpls-te router-address 192.168.1.11 - router-info area 0.0.0.0 - segment-routing on - segment-routing global-block 10000 19999 - segment-routing node-msd 8 - segment-routing prefix 192.168.1.11/32 index 1100 + router ospf + ospf router-id 192.168.1.11 + capability opaque + mpls-te on + mpls-te router-address 192.168.1.11 + router-info area 0.0.0.0 + segment-routing on + segment-routing global-block 10000 19999 + segment-routing node-msd 8 + segment-routing prefix 192.168.1.11/32 index 1100 The first segment-routing statement enable it. The Second one set the SRGB, third line the MSD and finally, set the Prefix SID index for a given prefix. @@ -283,4 +283,3 @@ This work has been performed in the framework of the H2020-ICT-2014 project 5GEx (Grant Agreement no. 671636), which is partially funded by the European Commission. - diff --git a/doc/developer/workflow.rst b/doc/developer/workflow.rst new file mode 100644 index 000000000..e1101fd76 --- /dev/null +++ b/doc/developer/workflow.rst @@ -0,0 +1,657 @@ +.. _process-and-workflow: + +******************* +Process & Workflow +******************* + +FRR is a large project developed by many different groups. This section +documents standards for code style & quality, commit messages, pull requests +and best practices that all contributors are asked to follow. + +This chapter is "descriptive/post-factual" in that it documents pratices that +are in use; it is not "definitive/pre-factual" in prescribing practices. This +means that when a procedure changes, it is agreed upon, then put into practice, +and then documented here. If this document doesn't match reality, it's the +document that needs to be updated, not reality. + +Mailing Lists +============= + +The FRR development group maintains multiple mailing lists for use by the +community. Italicized lists are private. + ++----------------------------------+--------------------------------+ +| Topic | List | ++==================================+================================+ +| Development | dev@lists.frrouting.org | ++----------------------------------+--------------------------------+ +| Users & Operators | frog@lists.frrouting.org | ++----------------------------------+--------------------------------+ +| Announcements | announce@lists.frrouting.org | ++----------------------------------+--------------------------------+ +| *Security* | security@lists.frrouting.org | ++----------------------------------+--------------------------------+ +| *Technical Steering Committee* | tsc@lists.frrouting.org | ++----------------------------------+--------------------------------+ + +The Development list is used to discuss and document general issues related to +project development and governance. The public Slack instance, +frrouting.slack.com, and weekly technical meetings provide a higher bandwidth +channel for discussions. The results of such discussions must be reflected in +updates, as appropriate, to code (i.e., merges), `Github issues`_, and for +governance or process changes, updates to the Development list and either this +file or information posted at https://frrouting.org/. + + +Changelog +========= + +The changelog will be the base for the release notes. A changelog entry for +your changes is usually not required and will be added based on your commit +messages by the maintainers. However, you are free to include an update to the +changelog with some better description. + +Submitting Patches and Enhancements +=================================== + +FRR accepts patches from two sources: + +- Email (git format-patch) +- Github pull request + +Contributors are highly encouraged to use Github's fork-and-pr workflow. It is +easier for us to review it, test it, try it and discuss it on Github than it is +via email, thus your patch will get more attention more quickly on Github. + +The base branch for new contributions and non-critical bug fixes should be +``master``. Please ensure your pull request is based on this branch when you +submit it. + +Pre-submission Checklist +------------------------ + +- Format code (see `Code Formatting <#developers-guidelines>`__) +- Verify and acknowledge license (see `License for + contributions <#license-for-contributions>`__) +- Ensure you have properly signed off (see `Signing + Off <#signing-off>`__) +- Test building with various configurations: + + - ``buildtest.sh`` + +- Verify building source distribution: + + - ``make dist`` (and try rebuilding from the resulting tar file) + +- Run unit tests: + + - ``make test`` + +- Document Regression Runs and plans for continued maintenance of the + feature + +License for contributions +------------------------- + +FRR is under a “GPLv2 or later” license. Any code submitted must +be released under the same license (preferred) or any license which +allows redistribution under this GPLv2 license (eg MIT License). + +Signing Off +----------- + +Code submitted to FRR must be signed off. We have the same +requirements for using the signed-off-by process as the Linux kernel. In +short, you must include a signed-off-by tag in every patch. + +``Signed-off-by:`` this is a developer's certification that he or she +has the right to submit the patch for inclusion into the project. It is +an agreement to the Developer's Certificate of Origin (below). Code +without a proper signoff can not and will not be merged. + +If you are unfamiliar with this process, you should read the `official +policy at +kernel.org <https://www.kernel.org/doc/html/latest/process/submitting-patches.html>`__ +and you might find this article about `participating in the Linux +community on the Linux Foundation +website <http://www.linuxfoundation.org/content/how-participate-linux-community-0>`__ +to be a helpful resource. + +In short, when you sign off on a commit, you assert your agreement to +all of the following: + +:: + + Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part by + me, under the same open source license (unless I am permitted to + submit under a different license), as indicated in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +What do I submit my changes against? +------------------------------------ + +We've documented where we would like to have the different fixes applied +at +https://github.com/FRR/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F +If you are unsure where your submission goes, look at that document or +ask a project maintainer. + +Github pull requests +-------------------- + +The preferred method of submitting changes is a Github pull request. +Code submitted by pull request will be automatically tested by one or +more CI systems. Once the automated tests succeed, other developers will +review your code for quality and correctness. After any concerns are +resolved, your code will be merged into the branch it was submitted +against. + +Patch submission via mailing list +--------------------------------- + +As an alternative submission method, a patch can be mailed to the +development mailing list. Patches received on the mailing list will be +picked up by Patchwork and tested against the latest development branch. + +The recommended way to send the patch (or series of NN patches) to the +list is by using ``git send-email`` as follows (assuming they are the N +most recent commit(s) in your git history: + +:: + + git send-email -NN --annotate --to=dev@lists.frrouting.org + +If your commits do not already contain a ``Signed-off-by`` line, then +use the following command to add it (after making sure you agree to the +Developer Certificate of Origin as outlined above): + +:: + + git send-email -NN --annotate --signoff --to=dev@lists.frrouting.org + +Submitting multi-commit patches as a Github pull request is **strongly +encouraged** and increases the probability of your patch getting +reviewed and merged in a timely manner. + +After submitting your changes +----------------------------- + +- Watch for Continuous Integration (CI) Test results + + - You should automatically receive an email with the test results + within less than 2 hrs of the submission. If you don’t get the + email, then check status on the Github pull request. + - Please notify the development mailing list if you think something + doesn't work. + +- If the tests failed: + + - In general, expect the community to ignore the submission until + the tests pass. + - It is up to you to fix and resubmit. + + - This includes fixing existing unit (“make test”) tests if your + changes broke or changed them. + - It also includes fixing distribution packages for the failing + platforms (ie if new libraries are required). + - Feel free to ask for help on the development list. + + - Go back to the submission process and repeat until the tests pass. + +- If the tests pass: + + - Wait for reviewers. Someone will review your code or be assigned + to review your code. + - Respond to any comments or concerns the reviewer has. + - After all comments and concerns are addressed, expect your patch + to be merged. + +- Watch out for questions on the mailing list. At this time there will + be a manual code review and further (longer) tests by various + community members. +- Your submission is done once it is merged to the master branch. + +Git Structure +============= + +.. figure:: ../figures/git_branches.png + :align: center + :scale: 55% + :alt: Merging Git branches into a central trunk + + Rough outline of FRR development workflow + +The master Git for FRR resides on `GitHub`_. + +There is one main branch for development, ``master``. For each major release +(2.0, 3.0 etc) a new release branch is created based on the master. Subsequent +point releases based on a major branch are marked by tagging. + +Programming Languages, Tools and Libraries +========================================== + +The core of FRR is written in C (gcc or clang supported) and makes +use of GNU compiler extensions. A few non-essential scripts are +implemented in Perl and Python. FRR requires the following tools +to build distribution packages: automake, autoconf, texinfo, libtool and +gawk and various libraries (i.e. libpam and libjson-c). + +If your contribution requires a new library or other tool, then please +highlight this in your description of the change. Also make sure it’s +supported by all FRR platform OSes or provide a way to build +without the library (potentially without the new feature) on the other +platforms. + +Documentation should be written in reStructuredText. Sphinx extensions may be +utilized but pure ReST is preferred where possible. See +:ref:`documentation`. + + +Coding Practices & Style +======================== + +Commit messages +--------------- + +Commit messages should be formatted in the same way as Linux kernel +commit messages. The format is roughly + +:: + + dir: short summary + + extended summary + +``dir`` should be the top level source directory under which the change +was made. For example, a change in bgpd/rfapi would be formatted as::: + + bgpd: short summary + +The first line should be no longer than 50 characters. Subsequent lines +should be wrapped to 72 characters. + +Source file header +------------------ + +New files need to have a Copyright header (see `License for +contributions <#license-for-contributions>`__ above) added to the file. +Preferred form of the header is as follows: + +:: + + /* + * Title/Function of file + * Copyright (C) YEAR Author’s Name + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + #include <zebra.h> + +Adding copyright claims to existing files +----------------------------------------- + +When adding copyright claims for modifications to an existing file, +please preface the claim with "Portions: " on a line before it and +indent the "Copyright ..." string. If such a case already exists, add +your indented claim immediately after. E.g.: + +:: + + Portions: + Copyright (C) 2010 Entity A .... + Copyright (C) 2016 Your name [optional brief change description] + +Code formatting +--------------- + +FRR uses Linux kernel style except where noted below. Code which does +not comply with these style guidelines will not be accepted. + +To assist with compliance, in the project root there is a .clang-format +configuration file which can be used with the ``clang-format`` tool from +the LLVM project. In the ``tools/`` directory there is a Python script +named ``indent.py`` that wraps clang-format and handles some edge cases +specific to FRR. If you are submitting a new file, it is recommended to +run that script over the new file after ensuring that the latest stable +release of ``clang-format`` is in your PATH. + +**Whitespace changes in untouched parts of the code are not acceptable +in patches that change actual code.** To change/fix formatting issues, +please create a separate patch that only does formatting changes and +nothing else. + +Kernel and BSD styles are documented externally: + +- https://www.kernel.org/doc/html/latest/process/coding-style.html +- http://man.openbsd.org/style + +For GNU coding style, use ``indent`` with the following invocation: + +:: + + indent -nut -nfc1 file_for_submission.c + +Exceptions +^^^^^^^^^^ + +FRR project code comes from a variety of sources, so there are some +stylistic exceptions in place. They are organized here by branch. + +For ``master`` +"""""""""""""" + +BSD coding style applies to: + +- ``ldpd/`` + +``babeld`` uses, approximately, the following style: + +- K&R style braces +- Indents are 4 spaces +- Function return types are on their own line + +For ``stable/3.0`` and ``stable/2.0`` +""""""""""""""""""""""""""""""""""""" + +GNU coding style apply to the following parts: + +- ``lib/`` +- ``zebra/`` +- ``bgpd/`` +- ``ospfd/`` +- ``ospf6d/`` +- ``isisd/`` +- ``ripd/`` +- ``ripngd/`` +- ``vtysh/`` + +BSD coding style applies to: + +- ``ldpd/`` + +Compile-time conditional code +----------------------------- + +Many users access FRR via binary packages from 3rd party sources; +compile-time code puts inclusion/exclusion in the hands of the package +maintainer. Please think very carefully before making code conditional +at compile time, as it increases regression testing, maintenance +burdens, and user confusion. In particular, please avoid gratuitous +``--enable-…`` switches to the configure script - in general, code +should be of high quality and in working condition, or it shouldn’t be +in FRR at all. + +When code must be compile-time conditional, try have the compiler make +it conditional rather than the C pre-processor so that it will still be +checked by the compiler, even if disabled. For example, + +:: + + if (SOME_SYMBOL) + frobnicate(); + +is preferred to + +:: + + #ifdef SOME_SYMBOL + frobnicate (); + #endif /* SOME_SYMBOL */ + +Note that the former approach requires ensuring that ``SOME_SYMBOL`` +will be defined (watch your ``AC_DEFINE``\ s). + +Debug-guards in code +-------------------- + +Debugging statements are an important methodology to allow developers to +fix issues found in the code after it has been released. The caveat here +is that the developer must remember that people will be using the code +at scale and in ways that can be unexpected for the original +implementor. As such debugs **MUST** be guarded in such a way that they +can be turned off. FRR has the ability to turn on/off debugs from the +CLI and it is expected that the developer will use this convention to +allow control of their debugs. + +CLI changes +----------- + +CLI's are a complicated ugly beast. Additions or changes to the CLI +should use a DEFUN to encapsulate one setting as much as is possible. +Additionally as new DEFUN's are added to the system, documentation +should be provided for the new commands. + +Backwards Compatibility +----------------------- + +As a general principle, changes to CLI and code in the lib/ directory +should be made in a backwards compatible fashion. This means that +changes that are purely stylistic in nature should be avoided, e.g., +renaming an existing macro or library function name without any +functional change. When adding new parameters to common functions, it is +also good to consider if this too should be done in a backward +compatible fashion, e.g., by preserving the old form in addition to +adding the new form. + +This is not to say that minor or even major functional changes to CLI +and common code should be avoided, but rather that the benefit gained +from a change should be weighed against the added cost/complexity to +existing code. Also, that when making such changes, it is good to +preserve compatibility when possible to do so without introducing +maintenance overhead/cost. It is also important to keep in mind, +existing code includes code that may reside in private repositories (and +is yet to be submitted) or code that has yet to be migrated from Quagga +to FRR. + +That said, compatibility measures can (and should) be removed when +either: + +- they become a significant burden, e.g. when data structures change + and the compatibility measure would need a complex adaptation layer + or becomes flat-out impossible +- some measure of time (dependent on the specific case) has passed, so + that the compatibility grace period is considered expired. + +In all cases, compatibility pieces should be marked with +compiler/preprocessor annotations to print warnings at compile time, +pointing to the appropriate update path. A ``-Werror`` build should fail +if compatibility bits are used. + +Miscellaneous +------------- + +When in doubt, follow the guidelines in the Linux kernel style guide, or +ask on the development mailing list / public Slack instance. + + +.. _documentation: + +Documentation +============= + +FRR uses Sphinx+RST as its documentation system. The document you are currently +reading was generated by Sphinx from RST source in +:file:`doc/developer/workflow.rst`. The documentation is structured as follows: + ++-----------------------+--------------------------------------------------------------+ +| Directory | Contents | ++=======================+==============================================================+ +| :file:`doc/user` | User documentation; configuration guides; protocol overviews | ++-----------------------+--------------------------------------------------------------+ +| :file:`doc/developer` | Developer's documentation; API specs; datastructures; | +| | architecture overviews; project management procedure | ++-----------------------+--------------------------------------------------------------+ +| :file:`doc/manpages` | Source for manpages | ++-----------------------+--------------------------------------------------------------+ +| :file:`doc/figures` | Images and diagrams | ++-----------------------+--------------------------------------------------------------+ + +Each of these directories, with the exception of :file:`doc/figures`, contains +a Sphinx-generated Makefile and configuration script :file:`conf.py` used to +set various document parameters. The makefile can be used for a variety of +targets; invoke `make help` in any of these directories for a listing of +available output formats. For convenience, there is a top-level +:file:`Makefile.am` that has targets for PDF and HTML documentation for both +developer and user documentation, respectively. That makefile is also +responsible for building manual pages packed with distribution builds. + +Indent and styling should follow existing conventions: + +- 3 spaces for indents under directives +- Cross references may contain only lowercase alphanumeric characters and + hyphens ('-') +- Lines wrapped to 80 characters where possible + +Characters for header levels should follow Python documentation guide: + +- ``#`` with overline, for parts +- ``*`` with overline, for chapters +- ``=``, for sections +- ``-``, for subsections +- ``^``, for subsubsections +- ``"``, for paragraphs + +After you have made your changes, please make sure that you can invoke +``make latexpdf`` and ``make html`` with no warnings. + +The documentation is currently incomplete and needs love. If you find a broken +cross-reference, figure, dead hyperlink, style issue or any other nastiness we +gladly accept documentation patches. + +To build the docs, please ensure you have installed a recent version of +`Sphinx <http://www.sphinx-doc.org/en/stable/install.html>`_. If you want to +build LaTeX or PDF docs, you will also need a full LaTeX distribution +installed. + +Code +---- + +FRR is a large and complex software project developed by many different people +over a long period of time. Without adequate documentation, it can be +exceedingly difficult to understand code segments, APIs and other interfaces. +In the interest of keeping the project healthy and maintainable, you should +make every effort to document your code so that other people can understand +what it does without needing to closely read the code itself. + +Some specific guidelines that contributors should follow are: + +- Functions exposed in header files should have descriptive comments above + their signatures in the header file. At a minimum, a function comment should + contain information about the return value, parameters, and a general summary + of the function's purpose. Documentation on parameter values can be omitted + if it is (very) obvious what they are used for. + + Function comments must follow the style for multiline comments laid out in + the kernel style guide. + + Example: + + .. code-block:: c + + /* + * Determines whether or not a string is cool. + * + * @param text - the string to check for coolness + * @param is_clccfc - whether capslock is cruise control for cool + * @return 7 if the text is cool, 0 otherwise + */ + int check_coolness(const char *text, bool is_clccfc); + + The Javadoc-style annotations are not required, but you should still strive + to make it equally clear what parameters and return values are used for. + +- Static functions should have descriptive comments in the same form as above + if what they do is not immediately obvious. Use good engineering judgement + when deciding whether a comment is necessary. If you are unsure, document + your code. +- Global variables, static or not, should have a comment describing their use. +- **For new code in lib/, these guidelines are hard requirements.** + +If you make significant changes to portions of the codebase covered in the +Developer's Manual, add a major subsystem or feature, or gain arcane mastery of +some undocumented or poorly documented part of the codebase, please document +your work so others can benefit. If you add a major feature or introduce a new +API, please document the architecture and API to the best of your abilities in +the Developer's Manual, using good judgement when choosing where to place it. + +Finally, if you come across some code that is undocumented and feel like +going above and beyond, document it! We absolutely appreciate and accept +patches that document previously undocumented code. + +User +---- + +If you are contributing code that adds significant user-visible functionality +please document how to use it in :file:`doc/user`. Use good judgement when +choosing where to place documentation. For example, instructions on how to use +your implementation of a new BGP draft should go in the BGP chapter instead of +being its own chapter. If you are adding a new protocol daemon, please create a +new chapter. + +When documenting CLI please use a combination of the ``.. index::`` and +``.. clicmd::`` directives. For example, the command :clicmd:`show pony` would +be documented as follows: + +.. code-block:: rest + + .. index:: show pony + .. clicmd:: show pony + + Prints an ASCII pony. Example output::: + + >>\. + /_ )`. + / _)`^)`. _.---. _ + (_,' \ `^-)"" `.\ + | | \ + \ / | + / \ /.___.'\ (\ (_ + < ,"|| \ |`. \`-' + \\ () )| )/ + hjw |_>|> /_] // + /_] /_] + +When documented this way, CLI commands can be cross referenced with the +``:clicmd:`` inline markup like so: + +.. code-block:: rest + + :clicmd:`show pony` + +This is very helpful for users who want to quickly remind themselves what a +particular command does. + +.. _GitHub: https://github.com/frrouting/frr +.. _GitHub issues: https://github.com/frrouting/frr/issues diff --git a/doc/eigrpd.8.in b/doc/eigrpd.8.in deleted file mode 100644 index ecac972bc..000000000 --- a/doc/eigrpd.8.in +++ /dev/null @@ -1,122 +0,0 @@ -.TH EIGRPD 8 "6 May 2017" "@PACKAGE_FULLNAME@ EIGRP daemon" "Version @PACKAGE_VERSION@" -.SH NAME -eigrpd \- a EIGRP routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B eigrpd -[ -.B \-dhrv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B eigrpd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B eigrpd -command: -.SH OPTIONS -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/eigrpd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When eigrpd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart eigrpd. The default is \fB\fI@CFG_STATE@/eigrpd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the eigrpd VTY will listen on. This defaults to -2602, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the eigrpd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-r\fR, \fB\-\-retain\fR -When the program terminates, retain routes added by \fBeigrpd\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR module may be available for -\fBeigrpd\fR, if the package was built with SNMP support. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/eigrpd -The default location of the -.B eigrpd -binary. -.TP -.BI @CFG_SYSCONF@/eigrpd.conf -The default location of the -.B eigrpd -config file. -.TP -.BI $(PWD)/eigrpd.log -If the -.B eigrpd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBeigrpd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The eigrpd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBeigrpd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B eigrpd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. diff --git a/doc/eigrpd.texi b/doc/eigrpd.texi deleted file mode 100644 index a3a82bbef..000000000 --- a/doc/eigrpd.texi +++ /dev/null @@ -1,216 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node EIGRP -@chapter EIGRP - -EIGRP -- Routing Information Protocol is widely deployed interior gateway -routing protocol. EIGRP was developed in the 1990's. EIGRP is a -@dfn{distance-vector} protocol and is based on the @dfn{dual} algorithms. -As a distance-vector protocol, the EIGRP router send updates to its -neighbors as networks change, thus allowing the convergence to a -known topology. - -@command{eigrpd} supports EIGRP as described in RFC7868 - -@menu -* Starting and Stopping eigrpd:: -* EIGRP Configuration:: -* How to Announce EIGRP routes:: -* Show EIGRP Information:: -* EIGRP Debug Commands:: -@end menu - -@node Starting and Stopping eigrpd -@section Starting and Stopping eigrpd - -The default configuration file name of @command{eigrpd}'s is -@file{eigrpd.conf}. When invocation @command{eigrpd} searches directory -@value{INSTALL_PREFIX_ETC}. If @file{eigrpd.conf} is not there next -search current directory. If an integrated config is specified -configuration is written into frr.conf - -The EIGRP protocol requires interface information -maintained by @command{zebra} daemon. So running @command{zebra} -is mandatory to run @command{eigrpd}. Thus minimum sequence for running -EIGRP is like below: - -@example -@group -# zebra -d -# eigrpd -d -@end group -@end example - -Please note that @command{zebra} must be invoked before @command{eigrpd}. - -To stop @command{eigrpd}. Please use @command{kill `cat -/var/run/eigrpd.pid`}. Certain signals have special meanings to @command{eigrpd}. - -@table @samp -@item SIGHUP -@item SIGUSR1 -Rotate @command{eigrpd} Rotate the logfile. -@item SIGINT -@itemx SIGTERM -@command{eigrpd} sweeps all installed EIGRP routes then terminates properly. -@end table - -@command{eigrpd} invocation options. Common options that can be specified -(@pxref{Common Invocation Options}). - -@table @samp -@item -r -@itemx --retain -When the program terminates, retain routes added by @command{eigrpd}. -@end table - -@node EIGRP Configuration -@section EIGRP Configuration - -@deffn Command {router eigrp (1-65535)} {} -The @code{router eigrp} command is necessary to enable EIGRP. To disable -EIGRP, use the @code{no router eigrp (1-65535)} command. EIGRP must be enabled before carrying out any of the EIGRP commands. -@end deffn - -@deffn Command {no router eigrp (1-65535)} {} -Disable EIGRP. -@end deffn - -@deffn {EIGRP Command} {network @var{network}} {} -@deffnx {EIGRP Command} {no network @var{network}} {} -Set the EIGRP enable interface by @var{network}. The interfaces which -have addresses matching with @var{network} are enabled. - -This group of commands either enables or disables EIGRP interfaces between -certain numbers of a specified network address. For example, if the -network for 10.0.0.0/24 is EIGRP enabled, this would result in all the -addresses from 10.0.0.0 to 10.0.0.255 being enabled for EIGRP. The @code{no -network} command will disable EIGRP for the specified network. -@end deffn - -Below is very simple EIGRP configuration. Interface @code{eth0} and -interface which address match to @code{10.0.0.0/8} are EIGRP enabled. - -@example -@group -! -router eigrp 1 - network 10.0.0.0/8 -! -@end group -@end example - -Passive interface - -@deffn {EIGRP command} {passive-interface (@var{IFNAME}|default)} {} -@deffnx {EIGRP command} {no passive-interface @var{IFNAME}} {} -This command sets the specified interface to passive mode. On passive mode -interface, all receiving packets are ignored and eigrpd does -not send either multicast or unicast EIGRP packets except to EIGRP neighbors -specified with @code{neighbor} command. The interface may be specified -as @var{default} to make eigrpd default to passive on all interfaces. - -The default is to be passive on all interfaces. -@end deffn - -@node How to Announce EIGRP route -@section How to Announce EIGRP route - -@deffn {EIGRP command} {redistribute kernel} {} -@deffnx {EIGRP command} {redistribute kernel metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)} {} -@deffnx {EIGRP command} {no redistribute kernel} {} -@code{redistribute kernel} redistributes routing information from -kernel route entries into the EIGRP tables. @code{no redistribute kernel} -disables the routes. -@end deffn - -@deffn {EIGRP command} {redistribute static} {} -@deffnx {EIGRP command} {redistribute static metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)} {} -@deffnx {EIGRP command} {no redistribute static} {} -@code{redistribute static} redistributes routing information from -static route entries into the EIGRP tables. @code{no redistribute static} -disables the routes. -@end deffn - -@deffn {EIGRP command} {redistribute connected} {} -@deffnx {EIGRP command} {redistribute connected metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)} {} -@deffnx {EIGRP command} {no redistribute connected} {} -Redistribute connected routes into the EIGRP tables. @code{no -redistribute connected} disables the connected routes in the EIGRP tables. -This command redistribute connected of the interface which EIGRP disabled. -The connected route on EIGRP enabled interface is announced by default. -@end deffn - -@deffn {EIGRP command} {redistribute ospf} {} -@deffnx {EIGRP command} {redistribute ospf metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)} {} -@deffnx {EIGRP command} {no redistribute ospf} {} -@code{redistribute ospf} redistributes routing information from -ospf route entries into the EIGRP tables. @code{no redistribute ospf} -disables the routes. -@end deffn - -@deffn {EIGRP command} {redistribute bgp} {} -@deffnx {EIGRP command} {redistribute bgp metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)} {} -@deffnx {EIGRP command} {no redistribute bgp} {} -@code{redistribute bgp} redistributes routing information from -bgp route entries into the EIGRP tables. @code{no redistribute bgp} -disables the routes. -@end deffn - -@node Show EIGRP Information -@section Show EIGRP Information - -To display EIGRP routes. - -@deffn Command {show ip eigrp topology} {} -Show EIGRP routes. -@end deffn - -The command displays all EIGRP routes. - -@c Exmaple here. - -@deffn Command {show ip eigrp topology} {} -The command displays current EIGRP status -@end deffn - -@example -@group -eigrpd> @b{show ip eigrp topology} -# show ip eigrp topo - -EIGRP Topology Table for AS(4)/ID(0.0.0.0) - -Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply - r - reply Status, s - sia Status - -P 10.0.2.0/24, 1 successors, FD is 256256, serno: 0 - via Connected, enp0s3 -@end group -@end example - -@node EIGRP Debug Commands -@section EIGRP Debug Commands - -Debug for EIGRP protocol. - -@deffn Command {debug eigrp packets} {} -Debug eigrp packets -@end deffn - -@code{debug eigrp} will show EIGRP packets that are sent and recevied. - -@deffn Command {debug eigrp transmit} {} -Debug eigrp transmit events -@end deffn - -@code{debug eigrp transmit} will display detailed information about the EIGRP transmit events. - -@deffn Command {show debugging eigrp} {} -Display @command{eigrpd}'s debugging option. -@end deffn - -@code{show debugging eigrp} will show all information currently set for eigrpd -debug. diff --git a/doc/figures/cligraph.svg b/doc/figures/cligraph.svg new file mode 100644 index 000000000..a1dd01702 --- /dev/null +++ b/doc/figures/cligraph.svg @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> +<!-- Generated by graphviz version 2.38.0 (20140413.2041) + --> +<!-- Title: %3 Pages: 1 --> +<svg width="300pt" height="980pt" + viewBox="0.00 0.00 299.50 980.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> +<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 976)"> +<title>%3</title> +<polygon fill="white" stroke="none" points="-4,4 -4,-976 295.5,-976 295.5,4 -4,4"/> +<!-- n0xd46960 --> +<g id="node1" class="node"><title>n0xd46960</title> +<polygon fill="#ccffcc" stroke="black" points="158,-972 86,-972 86,-936 158,-936 158,-972"/> +<text text-anchor="start" x="94" y="-952.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">START_TKN</text> +</g> +<!-- n0xd46be0 --> +<g id="node2" class="node"><title>n0xd46be0</title> +<polygon fill="#ffffff" stroke="black" points="159,-900 85,-900 85,-864 159,-864 159,-900"/> +<text text-anchor="start" x="93" y="-885.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">WORD_TKN</text> +<text text-anchor="start" x="101.5" y="-875.2" font-family="Fira Mono" font-size="9.00">"</text> +<text text-anchor="start" x="105.5" y="-875.2" font-family="Fira Mono" font-weight="bold" font-size="11.00" fill="#0055ff">show</text> +<text text-anchor="start" x="138.5" y="-875.2" font-family="Fira Mono" font-size="9.00">"</text> +</g> +<!-- n0xd46960->n0xd46be0 --> +<g id="edge1" class="edge"><title>n0xd46960->n0xd46be0</title> +<path fill="none" stroke="black" d="M122,-935.697C122,-927.983 122,-918.712 122,-910.112"/> +<polygon fill="black" stroke="black" points="125.5,-910.104 122,-900.104 118.5,-910.104 125.5,-910.104"/> +</g> +<!-- n0xd47f80 --> +<g id="node3" class="node"><title>n0xd47f80</title> +<polygon fill="#aaddff" stroke="black" points="156.5,-828 87.5,-828 87.5,-792 156.5,-792 156.5,-828"/> +<text text-anchor="start" x="95.5" y="-808.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">FORK_TKN</text> +</g> +<!-- n0xd46be0->n0xd47f80 --> +<g id="edge2" class="edge"><title>n0xd46be0->n0xd47f80</title> +<path fill="none" stroke="black" d="M122,-863.697C122,-855.983 122,-846.712 122,-838.112"/> +<polygon fill="black" stroke="black" points="125.5,-838.104 122,-828.104 118.5,-838.104 125.5,-838.104"/> +</g> +<!-- n0xd47c70 --> +<g id="node4" class="node"><title>n0xd47c70</title> +<polygon fill="#ffffff" stroke="black" points="127,-756 53,-756 53,-720 127,-720 127,-756"/> +<text text-anchor="start" x="61" y="-741.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">WORD_TKN</text> +<text text-anchor="start" x="80.5" y="-731.2" font-family="Fira Mono" font-size="9.00">"</text> +<text text-anchor="start" x="84.5" y="-731.2" font-family="Fira Mono" font-weight="bold" font-size="11.00" fill="#0055ff">ip</text> +<text text-anchor="start" x="95.5" y="-731.2" font-family="Fira Mono" font-size="9.00">"</text> +</g> +<!-- n0xd47f80->n0xd47c70 --> +<g id="edge3" class="edge"><title>n0xd47f80->n0xd47c70</title> +<path fill="none" stroke="black" d="M114.09,-791.697C110.447,-783.728 106.046,-774.1 102.006,-765.264"/> +<polygon fill="black" stroke="black" points="105.16,-763.744 97.8191,-756.104 98.7936,-766.654 105.16,-763.744"/> +</g> +<!-- n0xd484c0 --> +<g id="node5" class="node"><title>n0xd484c0</title> +<polygon fill="#ddaaff" stroke="black" points="153.5,-684 90.5,-684 90.5,-648 153.5,-648 153.5,-684"/> +<text text-anchor="start" x="98.5" y="-664.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">JOIN_TKN</text> +</g> +<!-- n0xd47f80->n0xd484c0 --> +<g id="edge20" class="edge"><title>n0xd47f80->n0xd484c0</title> +<path fill="none" stroke="black" d="M127.824,-791.56C130.931,-781.33 134.431,-768.08 136,-756 138.06,-740.133 138.06,-735.867 136,-720 134.897,-711.506 132.839,-702.434 130.634,-694.24"/> +<polygon fill="black" stroke="black" points="133.945,-693.087 127.824,-684.44 127.216,-695.017 133.945,-693.087"/> +</g> +<!-- n0xd47c70->n0xd484c0 --> +<g id="edge4" class="edge"><title>n0xd47c70->n0xd484c0</title> +<path fill="none" stroke="black" d="M97.9101,-719.697C101.553,-711.728 105.954,-702.1 109.994,-693.264"/> +<polygon fill="black" stroke="black" points="113.206,-694.654 114.181,-684.104 106.84,-691.744 113.206,-694.654"/> +</g> +<!-- n0xd47ca0 --> +<g id="node6" class="node"><title>n0xd47ca0</title> +<polygon fill="#ffffff" stroke="black" points="159,-612 85,-612 85,-576 159,-576 159,-612"/> +<text text-anchor="start" x="93" y="-597.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">WORD_TKN</text> +<text text-anchor="start" x="106.5" y="-587.2" font-family="Fira Mono" font-size="9.00">"</text> +<text text-anchor="start" x="110.5" y="-587.2" font-family="Fira Mono" font-weight="bold" font-size="11.00" fill="#0055ff">bgp</text> +<text text-anchor="start" x="133.5" y="-587.2" font-family="Fira Mono" font-size="9.00">"</text> +</g> +<!-- n0xd484c0->n0xd47ca0 --> +<g id="edge5" class="edge"><title>n0xd484c0->n0xd47ca0</title> +<path fill="none" stroke="black" d="M122,-647.697C122,-639.983 122,-630.712 122,-622.112"/> +<polygon fill="black" stroke="black" points="125.5,-622.104 122,-612.104 118.5,-622.104 125.5,-622.104"/> +</g> +<!-- n0xd48540 --> +<g id="node7" class="node"><title>n0xd48540</title> +<polygon fill="#ffffff" stroke="black" points="164.5,-540 79.5,-540 79.5,-504 164.5,-504 164.5,-540"/> +<text text-anchor="start" x="93" y="-525.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">WORD_TKN</text> +<text text-anchor="start" x="87.5" y="-515.2" font-family="Fira Mono" font-size="9.00">"</text> +<text text-anchor="start" x="91.5" y="-515.2" font-family="Fira Mono" font-weight="bold" font-size="11.00" fill="#0055ff">neighbors</text> +<text text-anchor="start" x="152.5" y="-515.2" font-family="Fira Mono" font-size="9.00">"</text> +</g> +<!-- n0xd47ca0->n0xd48540 --> +<g id="edge6" class="edge"><title>n0xd47ca0->n0xd48540</title> +<path fill="none" stroke="black" d="M122,-575.697C122,-567.983 122,-558.712 122,-550.112"/> +<polygon fill="black" stroke="black" points="125.5,-550.104 122,-540.104 118.5,-550.104 125.5,-550.104"/> +</g> +<!-- n0xd490c0 --> +<g id="node8" class="node"><title>n0xd490c0</title> +<polygon fill="#aaddff" stroke="black" points="156.5,-468 87.5,-468 87.5,-432 156.5,-432 156.5,-468"/> +<text text-anchor="start" x="95.5" y="-448.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">FORK_TKN</text> +</g> +<!-- n0xd48540->n0xd490c0 --> +<g id="edge7" class="edge"><title>n0xd48540->n0xd490c0</title> +<path fill="none" stroke="black" d="M122,-503.697C122,-495.983 122,-486.712 122,-478.112"/> +<polygon fill="black" stroke="black" points="125.5,-478.104 122,-468.104 118.5,-478.104 125.5,-478.104"/> +</g> +<!-- n0xd48fc0 --> +<g id="node9" class="node"><title>n0xd48fc0</title> +<polygon fill="#ffffff" stroke="black" points="64,-396 0,-396 0,-360 64,-360 64,-396"/> +<text text-anchor="start" x="8" y="-380.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">IPV4_TKN</text> +<text text-anchor="start" x="15" y="-371.8" font-family="Fira Mono" font-size="9.00">A.B.C.D</text> +</g> +<!-- n0xd490c0->n0xd48fc0 --> +<g id="edge8" class="edge"><title>n0xd490c0->n0xd48fc0</title> +<path fill="none" stroke="black" d="M99.7528,-431.697C88.4181,-422.881 74.4698,-412.032 62.1811,-402.474"/> +<polygon fill="black" stroke="black" points="64.0336,-399.481 53.9913,-396.104 59.736,-405.007 64.0336,-399.481"/> +</g> +<!-- n0xd491e0 --> +<g id="node10" class="node"><title>n0xd491e0</title> +<polygon fill="#ddaaff" stroke="black" points="153.5,-324 90.5,-324 90.5,-288 153.5,-288 153.5,-324"/> +<text text-anchor="start" x="98.5" y="-304.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">JOIN_TKN</text> +</g> +<!-- n0xd490c0->n0xd491e0 --> +<g id="edge19" class="edge"><title>n0xd490c0->n0xd491e0</title> +<path fill="none" stroke="black" d="M117.536,-431.953C115.065,-421.63 112.248,-408.153 111,-396 109.366,-380.084 109.366,-375.916 111,-360 111.877,-351.455 113.531,-342.255 115.294,-333.958"/> +<polygon fill="black" stroke="black" points="118.743,-334.573 117.536,-324.047 111.915,-333.028 118.743,-334.573"/> +</g> +<!-- n0xd49340 --> +<g id="node15" class="node"><title>n0xd49340</title> +<polygon fill="#ffffff" stroke="black" points="184,-396 120,-396 120,-360 184,-360 184,-396"/> +<text text-anchor="start" x="128" y="-380.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">IPV6_TKN</text> +<text text-anchor="start" x="135" y="-371.8" font-family="Fira Mono" font-size="9.00">X:X::X:X</text> +</g> +<!-- n0xd490c0->n0xd49340 --> +<g id="edge15" class="edge"><title>n0xd490c0->n0xd49340</title> +<path fill="none" stroke="black" d="M129.416,-431.697C132.794,-423.813 136.87,-414.304 140.623,-405.546"/> +<polygon fill="black" stroke="black" points="143.947,-406.675 144.67,-396.104 137.513,-403.917 143.947,-406.675"/> +</g> +<!-- n0xd49480 --> +<g id="node16" class="node"><title>n0xd49480</title> +<polygon fill="#ffffff" stroke="black" points="291.5,-396 202.5,-396 202.5,-360 291.5,-360 291.5,-396"/> +<text text-anchor="start" x="210.5" y="-380.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">VARIABLE_TKN</text> +<text text-anchor="start" x="233" y="-371.8" font-family="Fira Mono" font-size="9.00">WORD</text> +</g> +<!-- n0xd490c0->n0xd49480 --> +<g id="edge17" class="edge"><title>n0xd490c0->n0xd49480</title> +<path fill="none" stroke="black" d="M152.578,-431.876C169.074,-422.639 189.624,-411.131 207.336,-401.212"/> +<polygon fill="black" stroke="black" points="209.289,-404.13 216.304,-396.19 205.869,-398.022 209.289,-404.13"/> +</g> +<!-- n0xd48fc0->n0xd491e0 --> +<g id="edge9" class="edge"><title>n0xd48fc0->n0xd491e0</title> +<path fill="none" stroke="black" d="M54.2472,-359.697C65.5819,-350.881 79.5302,-340.032 91.8189,-330.474"/> +<polygon fill="black" stroke="black" points="94.264,-333.007 100.009,-324.104 89.9664,-327.481 94.264,-333.007"/> +</g> +<!-- n0xd496e0 --> +<g id="node11" class="node"><title>n0xd496e0</title> +<polygon fill="#aaddff" stroke="black" points="156.5,-252 87.5,-252 87.5,-216 156.5,-216 156.5,-252"/> +<text text-anchor="start" x="95.5" y="-232.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">FORK_TKN</text> +</g> +<!-- n0xd491e0->n0xd496e0 --> +<g id="edge10" class="edge"><title>n0xd491e0->n0xd496e0</title> +<path fill="none" stroke="black" d="M122,-287.697C122,-279.983 122,-270.712 122,-262.112"/> +<polygon fill="black" stroke="black" points="125.5,-262.104 122,-252.104 118.5,-262.104 125.5,-262.104"/> +</g> +<!-- n0xd495e0 --> +<g id="node12" class="node"><title>n0xd495e0</title> +<polygon fill="#ffffff" stroke="black" points="127,-180 53,-180 53,-144 127,-144 127,-180"/> +<text text-anchor="start" x="61" y="-165.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">WORD_TKN</text> +<text text-anchor="start" x="73.5" y="-155.2" font-family="Fira Mono" font-size="9.00">"</text> +<text text-anchor="start" x="77.5" y="-155.2" font-family="Fira Mono" font-weight="bold" font-size="11.00" fill="#0055ff">json</text> +<text text-anchor="start" x="102.5" y="-155.2" font-family="Fira Mono" font-size="9.00">"</text> +</g> +<!-- n0xd496e0->n0xd495e0 --> +<g id="edge11" class="edge"><title>n0xd496e0->n0xd495e0</title> +<path fill="none" stroke="black" d="M114.09,-215.697C110.447,-207.728 106.046,-198.1 102.006,-189.264"/> +<polygon fill="black" stroke="black" points="105.16,-187.744 97.8191,-180.104 98.7936,-190.654 105.16,-187.744"/> +</g> +<!-- n0xd497c0 --> +<g id="node13" class="node"><title>n0xd497c0</title> +<polygon fill="#ddaaff" stroke="black" points="153.5,-108 90.5,-108 90.5,-72 153.5,-72 153.5,-108"/> +<text text-anchor="start" x="98.5" y="-88.8" font-family="Fira Mono" font-weight="bold" font-size="9.00">JOIN_TKN</text> +</g> +<!-- n0xd496e0->n0xd497c0 --> +<g id="edge14" class="edge"><title>n0xd496e0->n0xd497c0</title> +<path fill="none" stroke="black" d="M127.824,-215.56C130.931,-205.33 134.431,-192.08 136,-180 138.06,-164.133 138.06,-159.867 136,-144 134.897,-135.506 132.839,-126.434 130.634,-118.24"/> +<polygon fill="black" stroke="black" points="133.945,-117.087 127.824,-108.44 127.216,-119.017 133.945,-117.087"/> +</g> +<!-- n0xd495e0->n0xd497c0 --> +<g id="edge12" class="edge"><title>n0xd495e0->n0xd497c0</title> +<path fill="none" stroke="black" d="M97.9101,-143.697C101.553,-135.728 105.954,-126.1 109.994,-117.264"/> +<polygon fill="black" stroke="black" points="113.206,-118.654 114.181,-108.104 106.84,-115.744 113.206,-118.654"/> +</g> +<!-- end0xd49900 --> +<g id="node14" class="node"><title>end0xd49900</title> +<polygon fill="#ffddaa" stroke="black" points="149,-36 95,-36 95,-0 149,-0 149,-36"/> +<text text-anchor="start" x="112.5" y="-15.8" font-family="Fira Mono" font-size="9.00">end</text> +</g> +<!-- n0xd497c0->end0xd49900 --> +<g id="edge13" class="edge"><title>n0xd497c0->end0xd49900</title> +<path fill="none" stroke="black" d="M122,-71.6966C122,-63.9827 122,-54.7125 122,-46.1124"/> +<polygon fill="black" stroke="black" points="125.5,-46.1043 122,-36.1043 118.5,-46.1044 125.5,-46.1043"/> +</g> +<!-- n0xd49340->n0xd491e0 --> +<g id="edge16" class="edge"><title>n0xd49340->n0xd491e0</title> +<path fill="none" stroke="black" d="M144.584,-359.697C141.206,-351.813 137.13,-342.304 133.377,-333.546"/> +<polygon fill="black" stroke="black" points="136.487,-331.917 129.33,-324.104 130.053,-334.675 136.487,-331.917"/> +</g> +<!-- n0xd49480->n0xd491e0 --> +<g id="edge18" class="edge"><title>n0xd49480->n0xd491e0</title> +<path fill="none" stroke="black" d="M216.422,-359.876C199.926,-350.639 179.376,-339.131 161.664,-329.212"/> +<polygon fill="black" stroke="black" points="163.131,-326.022 152.696,-324.19 159.711,-332.13 163.131,-326.022"/> +</g> +</g> +</svg> diff --git a/doc/fig-normal-processing.dia b/doc/figures/fig-normal-processing.dia index c9e8e6835..c9e8e6835 100644 --- a/doc/fig-normal-processing.dia +++ b/doc/figures/fig-normal-processing.dia diff --git a/doc/fig-normal-processing.png b/doc/figures/fig-normal-processing.png Binary files differindex e4b8fdcc1..e4b8fdcc1 100644 --- a/doc/fig-normal-processing.png +++ b/doc/figures/fig-normal-processing.png diff --git a/doc/fig-normal-processing.txt b/doc/figures/fig-normal-processing.txt index 01f0e1791..01f0e1791 100644 --- a/doc/fig-normal-processing.txt +++ b/doc/figures/fig-normal-processing.txt diff --git a/doc/fig-rs-processing.dia b/doc/figures/fig-rs-processing.dia index b2bf213da..b2bf213da 100644 --- a/doc/fig-rs-processing.dia +++ b/doc/figures/fig-rs-processing.dia diff --git a/doc/fig-rs-processing.png b/doc/figures/fig-rs-processing.png Binary files differindex 1f77263b1..1f77263b1 100644 --- a/doc/fig-rs-processing.png +++ b/doc/figures/fig-rs-processing.png diff --git a/doc/fig-rs-processing.txt b/doc/figures/fig-rs-processing.txt index eafe1468f..eafe1468f 100644 --- a/doc/fig-rs-processing.txt +++ b/doc/figures/fig-rs-processing.txt diff --git a/doc/fig-vnc-commercial-route-reflector.dia b/doc/figures/fig-vnc-commercial-route-reflector.dia index 0da5bd1c8..0da5bd1c8 100644 --- a/doc/fig-vnc-commercial-route-reflector.dia +++ b/doc/figures/fig-vnc-commercial-route-reflector.dia diff --git a/doc/fig-vnc-commercial-route-reflector.png b/doc/figures/fig-vnc-commercial-route-reflector.png Binary files differindex ca8a24850..ca8a24850 100644 --- a/doc/fig-vnc-commercial-route-reflector.png +++ b/doc/figures/fig-vnc-commercial-route-reflector.png diff --git a/doc/fig-vnc-commercial-route-reflector.txt b/doc/figures/fig-vnc-commercial-route-reflector.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-commercial-route-reflector.txt +++ b/doc/figures/fig-vnc-commercial-route-reflector.txt diff --git a/doc/fig-vnc-frr-route-reflector.dia b/doc/figures/fig-vnc-frr-route-reflector.dia index 634f0b17f..634f0b17f 100644 --- a/doc/fig-vnc-frr-route-reflector.dia +++ b/doc/figures/fig-vnc-frr-route-reflector.dia diff --git a/doc/fig-vnc-frr-route-reflector.png b/doc/figures/fig-vnc-frr-route-reflector.png Binary files differindex 477052184..477052184 100644 --- a/doc/fig-vnc-frr-route-reflector.png +++ b/doc/figures/fig-vnc-frr-route-reflector.png diff --git a/doc/fig-vnc-frr-route-reflector.txt b/doc/figures/fig-vnc-frr-route-reflector.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-frr-route-reflector.txt +++ b/doc/figures/fig-vnc-frr-route-reflector.txt diff --git a/doc/fig-vnc-gw-rr.dia b/doc/figures/fig-vnc-gw-rr.dia index dab27f700..dab27f700 100644 --- a/doc/fig-vnc-gw-rr.dia +++ b/doc/figures/fig-vnc-gw-rr.dia diff --git a/doc/fig-vnc-gw-rr.png b/doc/figures/fig-vnc-gw-rr.png Binary files differindex 7ae0630f6..7ae0630f6 100644 --- a/doc/fig-vnc-gw-rr.png +++ b/doc/figures/fig-vnc-gw-rr.png diff --git a/doc/fig-vnc-gw-rr.txt b/doc/figures/fig-vnc-gw-rr.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-gw-rr.txt +++ b/doc/figures/fig-vnc-gw-rr.txt diff --git a/doc/fig-vnc-gw.dia b/doc/figures/fig-vnc-gw.dia index 8270e208b..8270e208b 100644 --- a/doc/fig-vnc-gw.dia +++ b/doc/figures/fig-vnc-gw.dia diff --git a/doc/fig-vnc-gw.png b/doc/figures/fig-vnc-gw.png Binary files differindex df8f23f43..df8f23f43 100644 --- a/doc/fig-vnc-gw.png +++ b/doc/figures/fig-vnc-gw.png diff --git a/doc/fig-vnc-gw.txt b/doc/figures/fig-vnc-gw.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-gw.txt +++ b/doc/figures/fig-vnc-gw.txt diff --git a/doc/fig-vnc-mesh.dia b/doc/figures/fig-vnc-mesh.dia index a8f702f76..a8f702f76 100644 --- a/doc/fig-vnc-mesh.dia +++ b/doc/figures/fig-vnc-mesh.dia diff --git a/doc/fig-vnc-mesh.png b/doc/figures/fig-vnc-mesh.png Binary files differindex fa0762d16..fa0762d16 100644 --- a/doc/fig-vnc-mesh.png +++ b/doc/figures/fig-vnc-mesh.png diff --git a/doc/fig-vnc-mesh.txt b/doc/figures/fig-vnc-mesh.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-mesh.txt +++ b/doc/figures/fig-vnc-mesh.txt diff --git a/doc/fig-vnc-redundant-route-reflectors.dia b/doc/figures/fig-vnc-redundant-route-reflectors.dia index 4065b8ba1..4065b8ba1 100644 --- a/doc/fig-vnc-redundant-route-reflectors.dia +++ b/doc/figures/fig-vnc-redundant-route-reflectors.dia diff --git a/doc/fig-vnc-redundant-route-reflectors.png b/doc/figures/fig-vnc-redundant-route-reflectors.png Binary files differindex 06a27b657..06a27b657 100644 --- a/doc/fig-vnc-redundant-route-reflectors.png +++ b/doc/figures/fig-vnc-redundant-route-reflectors.png diff --git a/doc/fig-vnc-redundant-route-reflectors.txt b/doc/figures/fig-vnc-redundant-route-reflectors.txt index e69de29bb..e69de29bb 100644 --- a/doc/fig-vnc-redundant-route-reflectors.txt +++ b/doc/figures/fig-vnc-redundant-route-reflectors.txt diff --git a/doc/fig_topologies_full.dia b/doc/figures/fig_topologies_full.dia index 7ec3398f5..7ec3398f5 100644 --- a/doc/fig_topologies_full.dia +++ b/doc/figures/fig_topologies_full.dia diff --git a/doc/fig_topologies_full.png b/doc/figures/fig_topologies_full.png Binary files differindex d39e5e242..d39e5e242 100644 --- a/doc/fig_topologies_full.png +++ b/doc/figures/fig_topologies_full.png diff --git a/doc/fig_topologies_full.txt b/doc/figures/fig_topologies_full.txt index cc8025a04..cc8025a04 100644 --- a/doc/fig_topologies_full.txt +++ b/doc/figures/fig_topologies_full.txt diff --git a/doc/fig_topologies_rs.dia b/doc/figures/fig_topologies_rs.dia index f8aa18d67..f8aa18d67 100644 --- a/doc/fig_topologies_rs.dia +++ b/doc/figures/fig_topologies_rs.dia diff --git a/doc/fig_topologies_rs.png b/doc/figures/fig_topologies_rs.png Binary files differindex 014225c8f..014225c8f 100644 --- a/doc/fig_topologies_rs.png +++ b/doc/figures/fig_topologies_rs.png diff --git a/doc/fig_topologies_rs.txt b/doc/figures/fig_topologies_rs.txt index 0bd173015..0bd173015 100644 --- a/doc/fig_topologies_rs.txt +++ b/doc/figures/fig_topologies_rs.txt diff --git a/doc/figures/frr-icon.svg b/doc/figures/frr-icon.svg new file mode 100644 index 000000000..f7bdebc62 --- /dev/null +++ b/doc/figures/frr-icon.svg @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + viewBox="0 0 255.16251 264.35001" + height="264.35001" + width="255.16251" + xml:space="preserve" + version="1.1" + id="svg2"><metadata + id="metadata8"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs + id="defs6" /><g + transform="matrix(1.25,0,0,-1.25,0,264.35)" + id="g10"><g + transform="scale(0.1,0.1)" + id="g12"><path + id="path14" + style="fill:#f36f16;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 260.984,905.711 c 0,-431.5 345.223,-786.52 788.866,-832.2696 l 0,290.4566 c -274.799,44.071 -483.912,269.543 -484.475,541.813 0.563,272.249 209.676,497.819 484.475,541.849 l 0,290.5 C 606.207,1692.18 261.063,1337.24 260.984,905.711" /><path + id="path16" + style="fill:#f36f16;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 709.863,908.891 c 0,-197.121 146.297,-362.243 343.647,-408.469 l 0,816.938 C 856.16,1271.14 709.863,1106.06 709.863,908.891" /><path + id="path18" + style="fill:#f36f16;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 748.035,2114.83 1.395,-202.42 C 349.336,1773.27 53.4609,1430.82 2.73828,1017.01 L 0,994.961 l 133.66,0 2.309,17.319 c 60.746,449.24 447.246,801.35 928.931,838.53 l 19.35,1.55 -336.215,262.47" /><path + id="path20" + style="fill:#393536;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 1395.52,1123.39 c 0,-51.43 -41.66,-93.14 -93.14,-93.14 -51.42,0 -93.17,41.71 -93.17,93.14 0,51.46 41.75,93.19 93.17,93.19 51.48,0 93.14,-41.73 93.14,-93.19" /><path + id="path22" + style="fill:#f36f16;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 1529.56,476.52 49.41,-72.372 c 118.33,73.59 206.07,171.122 264.08,280.274 l -90.08,18.258 C 1701.77,615.23 1627.9,537.191 1529.56,476.52 Z m 338.86,848.67 -95.9,0 c 44.87,-92.73 68.09,-194.02 68.42,-295.5 0,-11.12 -0.48,-22.22 -1.06,-33.311 l 80.2,-75.578 c 5.3,36.097 8.22,72.5 8.14,108.889 0.34,100.55 -20.33,201.15 -59.8,295.5" /><path + id="path24" + style="fill:#f36f16;fill-opacity:1;fill-rule:nonzero;stroke:none" + d="m 1663.19,790.07 378.12,-76.73 -321,302.64 c 0.23,6.25 0.73,12.42 0.73,18.71 0,284.04 -218.31,520.69 -508.02,574.72 l 0,-127.07 c 215.24,-51.78 373.82,-232.3 374.38,-447.49 -0.56,-215.42 -159.14,-395.901 -374.38,-447.709 l 0,-127.129 C 1214.79,460.289 1537.38,0 1537.38,0 l 164.55,0 -353.76,500.422 c 139.05,58.219 251.25,161.488 315.02,289.648" /></g></g></svg>
\ No newline at end of file diff --git a/doc/figures/frr-logo-icon.png b/doc/figures/frr-logo-icon.png Binary files differnew file mode 100644 index 000000000..37973fcf2 --- /dev/null +++ b/doc/figures/frr-logo-icon.png diff --git a/doc/figures/frr-logo-medium.png b/doc/figures/frr-logo-medium.png Binary files differnew file mode 100644 index 000000000..04e18ebf5 --- /dev/null +++ b/doc/figures/frr-logo-medium.png diff --git a/doc/figures/frr-logo-small.png b/doc/figures/frr-logo-small.png Binary files differnew file mode 100644 index 000000000..2a9a2c7fd --- /dev/null +++ b/doc/figures/frr-logo-small.png diff --git a/doc/figures/frr-logo.png b/doc/figures/frr-logo.png Binary files differnew file mode 100644 index 000000000..6e66414c3 --- /dev/null +++ b/doc/figures/frr-logo.png diff --git a/doc/figures/git_branches.png b/doc/figures/git_branches.png Binary files differnew file mode 100644 index 000000000..21001c30a --- /dev/null +++ b/doc/figures/git_branches.png diff --git a/doc/git_branches.svg b/doc/figures/git_branches.svg index 0c2c96e39..0c2c96e39 100644 --- a/doc/git_branches.svg +++ b/doc/figures/git_branches.svg diff --git a/doc/ospf_api_architecture.png b/doc/figures/ospf_api_architecture.png Binary files differindex bd10a3865..bd10a3865 100644 --- a/doc/ospf_api_architecture.png +++ b/doc/figures/ospf_api_architecture.png diff --git a/doc/ospf_api_msghdr.png b/doc/figures/ospf_api_msghdr.png Binary files differindex 5bc840f70..5bc840f70 100644 --- a/doc/ospf_api_msghdr.png +++ b/doc/figures/ospf_api_msghdr.png diff --git a/doc/ospf_api_msgs1.png b/doc/figures/ospf_api_msgs1.png Binary files differindex a23cc619c..a23cc619c 100644 --- a/doc/ospf_api_msgs1.png +++ b/doc/figures/ospf_api_msgs1.png diff --git a/doc/ospf_api_msgs2.png b/doc/figures/ospf_api_msgs2.png Binary files differindex 8997ac401..8997ac401 100644 --- a/doc/ospf_api_msgs2.png +++ b/doc/figures/ospf_api_msgs2.png diff --git a/doc/filter.texi b/doc/filter.texi deleted file mode 100644 index a49404365..000000000 --- a/doc/filter.texi +++ /dev/null @@ -1,182 +0,0 @@ -@node Filtering -@comment node-name, next, previous, up -@chapter Filtering - -Frr provides many very flexible filtering features. Filtering is used -for both input and output of the routing information. Once filtering is -defined, it can be applied in any direction. - -@menu -* IP Access List:: -* IP Prefix List:: -@end menu - -@node IP Access List -@comment node-name, next, previous, up -@section IP Access List - -@deffn {Command} {access-list @var{name} permit @var{ipv4-network}} {} -@deffnx {Command} {access-list @var{name} deny @var{ipv4-network}} {} -@end deffn - -Basic filtering is done by @code{access-list} as shown in the -following example. - -@example -access-list filter deny 10.0.0.0/9 -access-list filter permit 10.0.0.0/8 -@end example - -@node IP Prefix List -@comment node-name, next, previous, up -@section IP Prefix List - -@command{ip prefix-list} provides the most powerful prefix based -filtering mechanism. In addition to @command{access-list} functionality, -@command{ip prefix-list} has prefix length range specification and -sequential number specification. You can add or delete prefix based -filters to arbitrary points of prefix-list using sequential number specification. - -If no ip prefix-list is specified, it acts as permit. If @command{ip prefix-list} -is defined, and no match is found, default deny is applied. - -@c @deffn {Command} {ip prefix-list @var{name} [seq @var{number}] permit|deny [le @var{prefixlen}] [ge @var{prefixlen}]} {} -@deffn {Command} {ip prefix-list @var{name} (permit|deny) @var{prefix} [le @var{len}] [ge @var{len}]} {} -@deffnx {Command} {ip prefix-list @var{name} seq @var{number} (permit|deny) @var{prefix} [le @var{len}] [ge @var{len}]} {} - -You can create @command{ip prefix-list} using above commands. - -@table @asis - -@item @asis{seq} -seq @var{number} can be set either automatically or manually. In the -case that sequential numbers are set manually, the user may pick any -number less than 4294967295. In the case that sequential number are set -automatically, the sequential number will increase by a unit of five (5) -per list. If a list with no specified sequential number is created -after a list with a specified sequential number, the list will -automatically pick the next multiple of five (5) as the list number. -For example, if a list with number 2 already exists and a new list with -no specified number is created, the next list will be numbered 5. If -lists 2 and 7 already exist and a new list with no specified number is -created, the new list will be numbered 10. - -@item @asis{le} -@command{le} command specifies prefix length. The prefix list will be -applied if the prefix length is less than or equal to the le prefix length. - -@item @asis{ge} -@command{ge} command specifies prefix length. The prefix list will be -applied if the prefix length is greater than or equal to the ge prefix length. - -@end table - -@end deffn - -Less than or equal to prefix numbers and greater than or equal to -prefix numbers can be used together. The order of the le and ge -commands does not matter. - -If a prefix list with a different sequential number but with the exact -same rules as a previous list is created, an error will result. -However, in the case that the sequential number and the rules are -exactly similar, no error will result. - -If a list with the same sequential number as a previous list is created, -the new list will overwrite the old list. - -Matching of IP Prefix is performed from the smaller sequential number to the -larger. The matching will stop once any rule has been applied. - -In the case of no le or ge command, the prefix length must match exactly the -length specified in the prefix list. - -@deffn {Command} {no ip prefix-list @var{name}} {} -@end deffn - -@menu -* ip prefix-list description:: -* ip prefix-list sequential number control:: -* Showing ip prefix-list:: -* Clear counter of ip prefix-list:: -@end menu - -@node ip prefix-list description -@subsection ip prefix-list description - -@deffn {Command} {ip prefix-list @var{name} description @var{desc}} {} -Descriptions may be added to prefix lists. This command adds a -description to the prefix list. -@end deffn - -@deffn {Command} {no ip prefix-list @var{name} description [@var{desc}]} {} -Deletes the description from a prefix list. It is possible to use the -command without the full description. -@end deffn - -@node ip prefix-list sequential number control -@subsection ip prefix-list sequential number control - -@deffn {Command} {ip prefix-list sequence-number} {} -With this command, the IP prefix list sequential number is displayed. -This is the default behavior. -@end deffn - -@deffn {Command} {no ip prefix-list sequence-number} {} -With this command, the IP prefix list sequential number is not -displayed. -@end deffn - -@node Showing ip prefix-list -@subsection Showing ip prefix-list - -@deffn {Command} {show ip prefix-list} {} -Display all IP prefix lists. -@end deffn - -@deffn {Command} {show ip prefix-list @var{name}} {} -Show IP prefix list can be used with a prefix list name. -@end deffn - -@deffn {Command} {show ip prefix-list @var{name} seq @var{num}} {} -Show IP prefix list can be used with a prefix list name and sequential -number. -@end deffn - -@deffn {Command} {show ip prefix-list @var{name} @var{a.b.c.d/m}} {} -If the command longer is used, all prefix lists with prefix lengths equal to -or longer than the specified length will be displayed. -If the command first match is used, the first prefix length match will be -displayed. -@end deffn - -@deffn {Command} {show ip prefix-list @var{name} @var{a.b.c.d/m} longer} {} -@end deffn - -@deffn {Command} {show ip prefix-list @var{name} @var{a.b.c.d/m} first-match} {} -@end deffn - -@deffn {Command} {show ip prefix-list summary} {} -@end deffn -@deffn {Command} {show ip prefix-list summary @var{name}} {} -@end deffn - -@deffn {Command} {show ip prefix-list detail} {} -@end deffn -@deffn {Command} {show ip prefix-list detail @var{name}} {} -@end deffn - -@node Clear counter of ip prefix-list -@subsection Clear counter of ip prefix-list - -@deffn {Command} {clear ip prefix-list} {} -Clears the counters of all IP prefix lists. Clear IP Prefix List can be -used with a specified name and prefix. -@end deffn - -@deffn {Command} {clear ip prefix-list @var{name}} {} -@end deffn - -@deffn {Command} {clear ip prefix-list @var{name} @var{a.b.c.d/m}} {} -@end deffn - diff --git a/doc/frr-args.8.in b/doc/frr-args.8.in deleted file mode 100644 index 3dc84e1e2..000000000 --- a/doc/frr-args.8.in +++ /dev/null @@ -1,248 +0,0 @@ -.TH frr-args 8 "28 August 2017" "@PACKAGE_FULLNAME@ general options" "Version @PACKAGE_VERSION@" -.SH NAME -frr-args \- common command line options for all @PACKAGE_FULLNAME@ daemons. -.SH SYNOPSIS -<\fBzebra\fR|\fBbgpd\fR|\fB...\fR> -[\fB\-h\fR] [\fB\-v\fR] - -<\fBzebra\fR|\fBbgpd\fR|\fB...\fR> -[\fB\-d\fR|\fB\-t\fR|\fB\-dt\fR] -[\fB\-C\fR] -[\fB\-f\fR \fIconfig-file\fR] -[\fB\-i\fR \fIpid-file\fR] -[\fB\-z\fR \fIzclient-path\fR] -[\fB\-u\fR \fIuser\fR] -[\fB\-g\fR \fIgroup\fR] -[\fB\-A\fR \fIvty-addr\fR] -[\fB\-P\fR \fIvty-port\fR] -[\fB\-M\fR \fImodule\fR[\fB:\fIoptions\fR]] -[\fB\-N\fR \fIpathspace\fR] -[\fB\-\-vty_socket\fR \fIvty-path\fR] -[\fB\-\-moduledir\fR \fImodule-path\fR] - -.SH DESCRIPTION -@PACKAGE_NAME@ daemons share a large part of their command line options; -this man page documents these. For options on specific daemons please refer -to their respective man pages. Most of the common options are related to -process control, configuration and common library functionality. - -.SH HELP AND VERSION -.TP -\fB\-h\fR, \fB\-\-help\fR -Print a short description of the daemon's command line options. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print version and build information for the daemon. -.PP -Both of these options inhibit normal operation and will immediately exit. - -.SH PROCESS CONTROL -These options control background operation: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Launches the process in background/daemon mode, forking and detaching from -the terminal. - -The parent process will delay its exit until the daemon/child has finished -its initialization and has entered its main loop. This is important for -\fBzebra\fR startup because the other daemons will attempt to connect to -\fBzebra\fR. A return from \fBzebra -d\fR guarantees its readiness to -accept these connections. -.TP -\fB\-t\fR, \fB\-\-terminal\fR -Opens an interactive VTY session on the terminal, allowing for both state -and configuration operations. Note that the terminal starts operating after -startup has completed and the configuration file has been loaded. - -The process will exit when end of file is detected on the terminal. It is -possible to daemonize a process started with \fB-t\fR (but without \fB-d\fR) -by sending \fISIGQUIT\fR to the process (normally mapped to a \fI^\\\fR -keypress.) -.TP -\fB\-dt\fR, \fB\-\-daemon \-\-terminal\fR -This combination of the previous two options will delay the daemon from -going into background until the terminal session ends (by end of file.) - -If the process receives \fISIGINT\fR (e.g. a \fI^C\fR keypress) in this -mode, it will exit instead of daemonizing. -.PP -It is safe to suspend (\fISIGTSTP\fR / \fI^Z\fR) the terminal session -opened by the previous two options; this will only stop the terminal but -not the protocol daemon itself (which runs in a separate second process.) - -.SH CONFIGURATION AND PATHS -The following options control configuration and file system locations for -@PACKAGE_NAME@ processes: -.TP -\fB\-f\fR, \fB\-\-config_file\fR \fIconfig-file\fR -Specify a configuration file to be used instead of the default -\fB\fI@CFG_SYSCONF@/<daemon>.conf\fR file. - -Note that the daemon will attempt to write to this file if the -\fIwrite file\fR command is issued on its VTY interface or through -\fBvtysh\fR. -.TP -\fB\-C\fR, \fB\-\-dryrun\fR -Load the configuration file and check its validity, then exit. -.TP -\fB\-i\fR, \fB\-\-pid_file\fR \fIpid-file\fR -Output a pid file to a location other than the default -\fB\fI@CFG_STATE@/<daemon>.pid\fR. -.TP -\fB\-z\fR, \fB\-\-socket\fR \fIzclient-path\fR -Override the path of the ZAPI socket used to communicate between \fBzebra\fR -and the various protocol daemons. The default is -\fB\fI@CFG_STATE@/zserv.api\fR. The value of this option must be the same -across all daemons. -.TP -\fB\-N\fR, \fB\-\-pathspace\fR \fIpathspace\fR -Insert \fIpathspace\fR into all default paths, changing the defaults to: -.IP -\fB@CFG_SYSCONF@/\fIpathspace\fB/<daemon>.conf\fR -.br -\fB@CFG_STATE@/\fIpathspace\fB/<daemon>.pid\fR -.br -\fB@CFG_STATE@/\fIpathspace\fB/<daemon>.vty\fR -.br -\fB@CFG_STATE@/\fIpathspace\fB/zserv.api\fR - -\'.\' and \'/\' characters will not be accepted in \fIpathspace\fR, but the -empty string will be accepted. - -Note that this only changes the respective defaults, it has no effect on -the respective path if the \fB\-f\fR, \fB\-i\fR, \fB\-z\fR or -\fB\-\-vty_socket\fR options are used. - -The purpose of this option is to easily group all file system related -bits together for running multiple fully-separate "logical routers" on a -system, particularly with Linux network namespaces. Groups of daemons -running with distinct \fIpathspace\fR values will be completely unaware -of each other and not interact in any way. - -This option does not do any system setup (like network namespaces.) This -must be done by the user, for example by running: -.IP -\fBip netns exec \fInamespace \fB<daemon> -N \fInamespace\fR - -.SH PROCESS CREDENTIALS -.TP -\fB\-u\fR, \fB\-\-user\fR \fIuser\fR -(default: \fB@enable_user@\fR) -.TP -\fB\-g\fR, \fB\-\-group\fR \fIgroup\fR -(default: \fB@enable_group@\fR) -.IP -Change the user/group which the daemon will switch to. -.PP -Note that there is an additional group, \fB@enable_vty_group@\fR, which -controls group ownership of the VTY sockets. The name of this group cannot -currently be changed, and \fIuser\fR must be a member of this group. - -.SH VTY SETUP -These following options control the daemon's VTY (interactive command line) -interface. The interface is available over TCP, using the telnet protocol, -as well as through the \fBvtysh\fR frontend. -.TP -\fB\-A\fR, \fB--vty_addr\fR \fIvty-addr\fR -Specify an IP/IPv6 address to bind the TCP VTY interface to. It is -generally recommended to specify \fI::1\fR or \fI127.0.0.1\fR. For reasons -of backwards compatibility, the default is to listen on all interfaces. -.TP -\fB\-P\fR, \fB--vty_port\fR \fIvty-port\fR -Override the daemon's default TCP VTY port (each daemon has a different -default value upwards of 2600, listed below.) Specifying \fI0\fR disables -the TCP VTY interface. - -Default ports are: - -.ta 16m -zebra 2601 -.br -ripd 2602 -.br -ripngd 2603 -.br -ospfd 2604 -.br -bgpd 2605 -.br -ospf6d 2606 -.br -isisd 2608 -.br -babeld 2609 -.br -nhrpd 2610 -.br -pimd 2611 -.br -ldpd 2612 -.br -eigrpd 2613 - -Port 2607 is used for ospfd's Opaque LSA API, while port 2600 is used for -the (insecure) TCP-ZEBRA interface. -.TP -\fB\-\-vty_socket\fR \fIvty-path\fR -Overrides the directory used for the \fB<daemon>.vty\fR sockets. -\fBvtysh\fR connects to these sockets in order to access each daemon's -VTY. -.br -Default: \fB\fI@CFG_STATE@\fR[\fB/\fI<pathspace>\fR] - -NB: Unlike the other options, this option specifies a \fBdirectory\fR, -not a full path. - -This option is primarily used by the SNAP packaging system, its semantics -may change. It should not be neccessary in most other scenarios. - -.SH MODULE LOADING -@PACKAGE_NAME@ supports optional dynamically loadable modules, although -these can only be loaded at startup. The set of available modules may vary -across distributions and packages, and modules may be available for -installation as separate packages. -.TP -\fB\-M\fR, \fB\-\-module\fR \fImodule\fR[\fB:\fIoptions\fR] -Load a module named \fImodule\fR, optionally passing \fIoptions\fR to it. - -If there is a \'/\' character in \fImodule\fR, the value is assumed to be -a pathname to a module. - -If there is no \'/\' character, the module directory (see next option) -is searched first for a module named "\fI<daemon>\fB_\fI<module>\fB.so\fR", -then for "\fI<module>\fB.so\fR". -This allows for a module to exist in variations appropriate for particular -daemons, e.g. \fIzebra_snmp\fR and \fIbgp_snmp\fR, with the correct one -selected by \fI\-M snmp\fR. - -The meaning of \fIoptions\fR is specific to the module being loaded. Most -modules currently ignore it. - -Modules are loaded in the order as listed on the command line. This is -not generally relevant. -.TP -\fB\-\-moduledir\fR \fImodule-path\fR -Look for modules in the \fImodule-path\fR directory instead of the default -\fI@CFG_MODULE@\fR. (This path is \fBnot\fR affected by the \fB\-N\fR -option.) -.PP -The list of loaded modules can be inspected at runtime with the -\fBshow modules\fR VTY command. - - -.SH "SEE ALSO" -.BR zebra (8), -.BR vtysh (1), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR bgpd (8), -.BR isisd (8), -.BR babeld (8), -.BR nhrpd (8), -.BR pimd (8), -.BR ldpd (8), -.BR eigrpd (8) - -\fIhttps://frrouting.org/ diff --git a/doc/code/Makefile b/doc/frr-sphinx.mk index 056b78e68..df4056760 100644 --- a/doc/code/Makefile +++ b/doc/frr-sphinx.mk @@ -1,15 +1,23 @@ # Makefile for Sphinx documentation # +# Sphinx is not designed to be invoked multiple times against the same toctree. +.NOTPARALLEL: + # You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +PAPER ?= BUILDDIR = _build # User-friendly check for sphinx-build -ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) -$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +ifneq ($(MAKECMDGOALS), clean) + ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) + SPHINXBUILD = sphinx-1.0-build + endif + ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) + $(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD make variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/") + endif endif # Internal variables. @@ -169,7 +177,7 @@ texinfo: info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info + $(MAKE) -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." .PHONY: gettext diff --git a/doc/frr.1.in b/doc/frr.1.in deleted file mode 100644 index 528358a8d..000000000 --- a/doc/frr.1.in +++ /dev/null @@ -1,65 +0,0 @@ -.TH Frr 1 "27 July 2006" "@PACKAGE_FULLNAME@ Systemd Script" "Version @PACKAGE_VERSION@" -.SH NAME -frr \- a systemd interaction script -.SH SYNOPSIS -.B frr -[ -.B start -] -.br -.B frr -[ -.B stop -] -.br -.B frr -[ -.B reload -] -.br -.B frr -[ -.B restart -] -.br -.B frr -[ -.B status -] -.br -.SH DESCRIPTION -.B @PACKAGE_NAME@ -is a systemd interaction script for the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B frr -command: -.IP start -Start enabled Frr daemons -.IP stop -Stop enabled Frr daemons -.IP reload -Reload modified configuration files -.IP restart -Stop all running daemons and then restart them -.IP status -Status of all the daemons -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8) -.SH BUGS -.B frr -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/frr.texi b/doc/frr.texi deleted file mode 100644 index d268b4b98..000000000 --- a/doc/frr.texi +++ /dev/null @@ -1,140 +0,0 @@ -\input texinfo @c -*- texinfo -*- - -@c Set variables - sourced from defines.texi -@include defines.texi - -@c %**start of header -@setfilename frr.info -@c Set variables - sourced from defines.texi -@include defines.texi -@settitle @uref{@value{PACKAGE_URL},,@value{PACKAGE_NAME}} -@c %**end of header - -@copying -@value{COPYRIGHT_STR} -@quotation - -Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - -Permission is granted to copy and distribute modified versions of this -manual under the conditions for verbatim copying, provided that the -entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - -Permission is granted to copy and distribute translations of this manual -into another language, under the above conditions for modified versions, -except that this permission notice may be stated in a translation -approved by Kunihiro Ishiguro. - -@end quotation -@end copying - -@c Info entry -@dircategory Routing Software: -@direntry -* @value{PACKAGE_NAME}: (frr). The Frr Suite -@end direntry - -@c @smallbook - -@ifinfo -This file documents the @uref{@value{PACKAGE_URL},,Frr Software Routing Suite} -which manages common TCP/IP routing protocols. - -This document was generated for version @value{PACKAGE_VERSION}. - -@insertcopying -@end ifinfo - -@titlepage -@title @uref{@value{PACKAGE_URL},,Frr} -@subtitle A routing software package for TCP/IP networks -@subtitle @uref{@value{PACKAGE_URL},,@value{PACKAGE_NAME}} @value{PACKAGE_VERSION} -@author @value{AUTHORS} - -@page -@vskip 0pt plus 1filll - -@insertcopying -@end titlepage -@page - -@ifnottex -@node Top -@top Frr -- With Virtual Network Control - -@uref{@value{PACKAGE_URL},,Frr} is an advanced routing software package -that provides a suite of TCP/IP based routing protocols. This is the Manual -for @value{PACKAGE_STRING}. @uref{@value{PACKAGE_URL},,Frr} is a fork of -@uref{http://www.quagga.net,,Quagga}. - -@insertcopying -@end ifnottex - -@menu -* Overview:: -* Installation:: -* Basic commands:: -* Zebra:: -* RIP:: -* RIPng:: -* OSPFv2:: -* OSPFv3:: -* ISIS:: -* NHRP:: -* BGP:: -* Configuring Frr as a Route Server:: -* VNC and VNC-GW:: -* VTY shell:: -* Filtering:: -* Route Map:: -* IPv6 Support:: -* Kernel Interface:: -* SNMP Support:: -* Zebra Protocol:: -* Packet Binary Dump Format:: -* Command Index:: -* VTY Key Index:: -* Index:: -@end menu -@contents - -@include overview.texi -@include install.texi -@include basic.texi -@include main.texi -@include ripd.texi -@include ripngd.texi -@include ospfd.texi -@include ospf6d.texi -@include isisd.texi -@include nhrpd.texi -@include bgpd.texi -@include routeserver.texi -@include vnc.texi -@include vtysh.texi -@include filter.texi -@include routemap.texi -@include ipv6.texi -@include kernel.texi -@include snmp.texi -@include protocol.texi -@include appendix.texi - -@node Command Index -@unnumbered Command Index - -@printindex fn - -@node VTY Key Index -@unnumbered VTY Key Index - -@printindex ky - -@node Index -@unnumbered Index - -@printindex cp -@bye diff --git a/doc/install.texi b/doc/install.texi deleted file mode 100644 index d0d56804b..000000000 --- a/doc/install.texi +++ /dev/null @@ -1,291 +0,0 @@ -@node Installation -@chapter Installation - -@cindex How to install Frr -@cindex Installation -@cindex Installing Frr -@cindex Building the system -@cindex Making Frr - -There are three steps for installing the software: configuration, -compilation, and installation. - -@menu -* Configure the Software:: -* Build the Software:: -* Install the Software:: -@end menu - -The easiest way to get Frr running is to issue the following -commands: - -@example -% configure -% make -% make install -@end example - -@node Configure the Software -@section Configure the Software - -@menu -* The Configure script and its options:: -* Least-Privilege support:: -* Linux notes:: -@end menu - -@node The Configure script and its options -@subsection The Configure script and its options - -@cindex Configuration options -@cindex Options for configuring -@cindex Build options -@cindex Distribution configuration -@cindex Options to @code{./configure} - -Frr has an excellent configure script which automatically detects most -host configurations. There are several additional configure options to -customize the build to include or exclude specific features and dependencies. - -@table @option -@item --disable-zebra -Do not build zebra daemon. -@item --disable-ripd -Do not build ripd. -@item --disable-ripngd -Do not build ripngd. -@item --disable-ospfd -Do not build ospfd. -@item --disable-ospf6d -Do not build ospf6d. -@item --disable-bgpd -Do not build bgpd. -@item --disable-bgp-announce -Make @command{bgpd} which does not make bgp announcements at all. This -feature is good for using @command{bgpd} as a BGP announcement listener. -@item --enable-datacenter -Enable system defaults to work as if in a Data Center. See defaults.h -for what is changed by this configure option. -@item --enable-snmp -Enable SNMP support. By default, SNMP support is disabled. -@item --disable-ospfapi -Disable support for OSPF-API, an API to interface directly with ospfd. -OSPF-API is enabled if --enable-opaque-lsa is set. -@item --disable-ospfclient -Disable building of the example OSPF-API client. -@item --disable-ospf-ri -Disable support for OSPF Router Information (RFC4970 & RFC5088) this -requires support for Opaque LSAs and Traffic Engineering. -@item --disable-isisd -Do not build isisd. -@item --enable-isis-topology -Enable IS-IS topology generator. -@item --enable-isis-te -Enable Traffic Engineering Extension for ISIS (RFC5305) -@item --enable-multipath=@var{ARG} -Enable support for Equal Cost Multipath. @var{ARG} is the maximum number -of ECMP paths to allow, set to 0 to allow unlimited number of paths. -@item --enable-realms -Enable the support of linux Realms. Convert tag values from 1-255 -into a realm value when inserting into the linux kernel. Then -routing policy can be assigned to the realm. See the tc man page. -@item --disable-rtadv -Disable support IPV6 router advertisement in zebra. -@item --enable-gcc-rdynamic -Pass the @command{-rdynamic} option to the linker driver. This is in most -cases neccessary for getting usable backtraces. This option defaults to on -if the compiler is detected as gcc, but giving an explicit enable/disable is -suggested. -@item --disable-backtrace -Controls backtrace support for the crash handlers. This is autodetected by -default. Using the switch will enforce the requested behaviour, failing with -an error if support is requested but not available. On BSD systems, this -needs libexecinfo, while on glibc support for this is part of libc itself. -@item --enable-dev-build -Turn on some options for compiling FRR within a development environment in -mind. Specifically turn on -g3 -O0 for compiling options and add inclusion -of grammar sandbox. -@item --enable-fuzzing -Turn on some compile options to allow you to run fuzzing tools -against the system. This tools is intended as a developer -only tool and should not be used for normal operations -@end table - -You may specify any combination of the above options to the configure -script. By default, the executables are placed in @file{/usr/local/sbin} -and the configuration files in @file{/usr/local/etc}. The @file{/usr/local/} -installation prefix and other directories may be changed using the following -options to the configuration script. - -@table @option -@item --prefix=@var{prefix} -Install architecture-independent files in @var{prefix} [/usr/local]. -@item --sysconfdir=@var{dir} -Look for configuration files in @var{dir} [@var{prefix}/etc]. Note -that sample configuration files will be installed here. -@item --localstatedir=@var{dir} -Configure zebra to use @var{dir} for local state files, such -as pid files and unix sockets. -@end table - -@example -% ./configure --disable-snmp -@end example - -This command will configure zebra and the routing daemons. - -@node Least-Privilege support -@subsection Least-Privilege support - -@cindex Frr Least-Privileges -@cindex Frr Privileges - -Additionally, you may configure zebra to drop its elevated privileges -shortly after startup and switch to another user. The configure script will -automatically try to configure this support. There are three configure -options to control the behaviour of Frr daemons. - -@table @option -@item --enable-user=@var{user} -Switch to user @var{ARG} shortly after startup, and run as user @var{ARG} -in normal operation. -@item --enable-group=@var{group} -Switch real and effective group to @var{group} shortly after -startup. -@item --enable-vty-group=@var{group} -Create Unix Vty sockets (for use with vtysh) with group owndership set to -@var{group}. This allows one to create a seperate group which is -restricted to accessing only the Vty sockets, hence allowing one to -delegate this group to individual users, or to run vtysh setgid to -this group. -@end table - -The default user and group which will be configured is 'frr' if no user -or group is specified. Note that this user or group requires write access to -the local state directory (see --localstatedir) and requires at least read -access, and write access if you wish to allow daemons to write out their -configuration, to the configuration directory (see --sysconfdir). - -On systems which have the 'libcap' capabilities manipulation library -(currently only linux), the frr system will retain only minimal -capabilities required, further it will only raise these capabilities for -brief periods. On systems without libcap, frr will run as the user -specified and only raise its uid back to uid 0 for brief periods. - -@node Linux notes -@subsection Linux Notes - -@cindex Configuring Frr -@cindex Building on Linux boxes -@cindex Linux configurations - -There are several options available only to @sc{gnu}/Linux systems: -@footnote{@sc{gnu}/Linux has very flexible kernel configuration features}. If -you use @sc{gnu}/Linux, make sure that the current kernel configuration is -what you want. Frr will run with any kernel configuration but some -recommendations do exist. - -@table @var - -@item CONFIG_NETLINK -Kernel/User netlink socket. This is a brand new feature which enables an -advanced interface between the Linux kernel and zebra (@pxref{Kernel Interface}). - -@item CONFIG_RTNETLINK -Routing messages. -This makes it possible to receive netlink routing messages. If you -specify this option, @command{zebra} can detect routing information -updates directly from the kernel (@pxref{Kernel Interface}). - -@item CONFIG_IP_MULTICAST -IP: multicasting. -This option should be specified when you use @command{ripd} (@pxref{RIP}) or -@command{ospfd} (@pxref{OSPFv2}) because these protocols use multicast. - -@end table - -IPv6 support has been added in @sc{gnu}/Linux kernel version 2.2. If you -try to use the Frr IPv6 feature on a @sc{gnu}/Linux kernel, please -make sure the following libraries have been installed. Please note that -these libraries will not be needed when you uses @sc{gnu} C library 2.1 -or upper. - -@table @code - -@item inet6-apps -The @code{inet6-apps} package includes basic IPv6 related libraries such -as @code{inet_ntop} and @code{inet_pton}. Some basic IPv6 programs such -as @command{ping}, @command{ftp}, and @command{inetd} are also -included. The @code{inet-apps} can be found at -@uref{ftp://ftp.inner.net/pub/ipv6/}. - -@item net-tools -The @code{net-tools} package provides an IPv6 enabled interface and -routing utility. It contains @command{ifconfig}, @command{route}, -@command{netstat}, and other tools. @code{net-tools} may be found at -@uref{http://www.tazenda.demon.co.uk/phil/net-tools/}. - -@end table -@c A - end of footnote - -@node Build the Software -@section Build the Software - -After configuring the software, you will need to compile it for your -system. Simply issue the command @command{make} in the root of the source -directory and the software will be compiled. Cliff Note versions of -different compilation examples can be found in the doc/Building_FRR_on_XXX.md -files. If you have *any* problems at this stage, be certain to send a -bug report @xref{Bug Reports}. - -@example -% ./bootstrap.sh -% ./configure <appropriate to your system> -% make -@end example -@c A - End of node, Building the Software - - -@node Install the Software -@comment node-name, next, previous, up -@section Install the Software - -Installing the software to your system consists of copying the compiled -programs and supporting files to a standard location. After the -installation process has completed, these files have been copied -from your work directory to @file{/usr/local/bin}, and @file{/usr/local/etc}. - -To install the Frr suite, issue the following command at your shell -prompt: @command{make install}. - -@example -% -% make install -% -@end example - -Frr daemons have their own terminal interface or VTY. After -installation, you have to setup each beast's port number to connect to -them. Please add the following entries to @file{/etc/services}. - -@example -zebrasrv 2600/tcp # zebra service -zebra 2601/tcp # zebra vty -ripd 2602/tcp # RIPd vty -ripngd 2603/tcp # RIPngd vty -ospfd 2604/tcp # OSPFd vty -bgpd 2605/tcp # BGPd vty -ospf6d 2606/tcp # OSPF6d vty -ospfapi 2607/tcp # ospfapi -isisd 2608/tcp # ISISd vty -nhrpd 2610/tcp # nhrpd vty -pimd 2611/tcp # PIMd vty -@end example - -If you use a FreeBSD newer than 2.2.8, the above entries are already -added to @file{/etc/services} so there is no need to add it. If you -specify a port number when starting the daemon, these entries may not be -needed. - -You may need to make changes to the config files in -@file{@value{INSTALL_PREFIX_ETC}/*.conf}. @xref{Config Commands}. diff --git a/doc/ipv6.texi b/doc/ipv6.texi deleted file mode 100644 index 859f6a960..000000000 --- a/doc/ipv6.texi +++ /dev/null @@ -1,186 +0,0 @@ -@node IPv6 Support -@chapter IPv6 Support - -Frr fully supports IPv6 routing. As described so far, Frr supports -RIPng, OSPFv3, and BGP-4+. You can give IPv6 addresses to an interface -and configure static IPv6 routing information. Frr IPv6 also provides -automatic address configuration via a feature called @code{address -auto configuration}. To do it, the router must send router advertisement -messages to the all nodes that exist on the network. - -Previous versions of Frr could be built without IPv6 support. This is -no longer possible. - -@menu -* Router Advertisement:: -@end menu - -@node Router Advertisement -@section Router Advertisement - -@deffn {Interface Command} {no ipv6 nd suppress-ra} {} -Send router advertisment messages. -@end deffn - -@deffn {Interface Command} {ipv6 nd suppress-ra} {} -Don't send router advertisment messages. -@end deffn - -@deffn {Interface Command} {ipv6 nd prefix @var{ipv6prefix} [@var{valid-lifetime}] [@var{preferred-lifetime}] [off-link] [no-autoconfig] [router-address]} {} -Configuring the IPv6 prefix to include in router advertisements. Several prefix -specific optional parameters and flags may follow: -@itemize @bullet -@item -@var{valid-lifetime} - the length of time in seconds during what the prefix is -valid for the purpose of on-link determination. Value @var{infinite} represents -infinity (i.e. a value of all one bits (@code{0xffffffff})). - -Range: @code{<0-4294967295>} Default: @code{2592000} - -@item -@var{preferred-lifetime} - the length of time in seconds during what addresses -generated from the prefix remain preferred. Value @var{infinite} represents -infinity. - -Range: @code{<0-4294967295>} Default: @code{604800} - -@item -@var{off-link} - indicates that advertisement makes no statement about on-link or -off-link properties of the prefix. - -Default: not set, i.e. this prefix can be used for on-link determination. - -@item -@var{no-autoconfig} - indicates to hosts on the local link that the specified prefix -cannot be used for IPv6 autoconfiguration. - -Default: not set, i.e. prefix can be used for autoconfiguration. - -@item -@var{router-address} - indicates to hosts on the local link that the specified -prefix -contains a complete IP address by setting R flag. - -Default: not set, i.e. hosts do not assume a complete IP address is placed. -@end itemize -@end deffn - -@deffn {Interface Command} {ipv6 nd ra-interval <1-1800>} {} -@deffnx {Interface Command} {no ipv6 nd ra-interval [<1-1800>]} {} -The maximum time allowed between sending unsolicited multicast router -advertisements from the interface, in seconds. - -Default: @code{600} -@end deffn - -@deffn {Interface Command} {ipv6 nd ra-interval msec <70-1800000>} {} -@deffnx {Interface Command} {no ipv6 nd ra-interval [msec <70-1800000>]} {} -The maximum time allowed between sending unsolicited multicast router -advertisements from the interface, in milliseconds. - -Default: @code{600000} -@end deffn - -@deffn {Interface Command} {ipv6 nd ra-lifetime <0-9000>} {} -@deffnx {Interface Command} {no ipv6 nd ra-lifetime [<0-9000>]} {} -The value to be placed in the Router Lifetime field of router advertisements -sent from the interface, in seconds. Indicates the usefulness of the router -as a default router on this interface. Setting the value to zero indicates -that the router should not be considered a default router on this interface. -Must be either zero or between value specified with @var{ipv6 nd ra-interval} -(or default) and 9000 seconds. - -Default: @code{1800} -@end deffn - -@deffn {Interface Command} {ipv6 nd reachable-time <1-3600000>} {} -@deffnx {Interface Command} {no ipv6 nd reachable-time [<1-3600000>]} {} -The value to be placed in the Reachable Time field in the Router Advertisement -messages sent by the router, in milliseconds. The configured time enables the -router to detect unavailable neighbors. The value zero means unspecified (by -this router). - -Default: @code{0} -@end deffn - -@deffn {Interface Command} {ipv6 nd managed-config-flag} {} -@deffnx {Interface Command} {no ipv6 nd managed-config-flag} {} -Set/unset flag in IPv6 router advertisements which indicates to hosts that they -should use managed (stateful) protocol for addresses autoconfiguration in -addition to any addresses autoconfigured using stateless address -autoconfiguration. - -Default: not set -@end deffn - -@deffn {Interface Command} {ipv6 nd other-config-flag} {} -@deffnx {Interface Command} {no ipv6 nd other-config-flag} {} -Set/unset flag in IPv6 router advertisements which indicates to hosts that -they should use administered (stateful) protocol to obtain autoconfiguration -information other than addresses. - -Default: not set -@end deffn - -@deffn {Interface Command} {ipv6 nd home-agent-config-flag} {} -@deffnx {Interface Command} {no ipv6 nd home-agent-config-flag} {} -Set/unset flag in IPv6 router advertisements which indicates to hosts that -the router acts as a Home Agent and includes a Home Agent Option. - -Default: not set -@end deffn - -@deffn {Interface Command} {ipv6 nd home-agent-preference <0-65535>} {} -@deffnx {Interface Command} {no ipv6 nd home-agent-preference [<0-65535>]} {} -The value to be placed in Home Agent Option, when Home Agent config flag is set, -which indicates to hosts Home Agent preference. The default value of 0 stands -for the lowest preference possible. - -Default: 0 -@end deffn - -@deffn {Interface Command} {ipv6 nd home-agent-lifetime <0-65520>} {} -@deffnx {Interface Command} {no ipv6 nd home-agent-lifetime [<0-65520>]} {} -The value to be placed in Home Agent Option, when Home Agent config flag is set, -which indicates to hosts Home Agent Lifetime. The default value of 0 means to -place the current Router Lifetime value. - -Default: 0 -@end deffn - -@deffn {Interface Command} {ipv6 nd adv-interval-option} {} -@deffnx {Interface Command} {no ipv6 nd adv-interval-option} {} -Include an Advertisement Interval option which indicates to hosts the maximum time, -in milliseconds, between successive unsolicited Router Advertisements. - -Default: not set -@end deffn - -@deffn {Interface Command} {ipv6 nd router-preference (high|medium|low)} {} -@deffnx {Interface Command} {no ipv6 nd router-preference [(high|medium|low)]} {} -Set default router preference in IPv6 router advertisements per RFC4191. - -Default: medium -@end deffn - -@deffn {Interface Command} {ipv6 nd mtu <1-65535>} {} -@deffnx {Interface Command} {no ipv6 nd mtu [<1-65535>]} {} -Include an MTU (type 5) option in each RA packet to assist the attached hosts -in proper interface configuration. The announced value is not verified to be -consistent with router interface MTU. - -Default: don't advertise any MTU option -@end deffn - -@example -@group -interface eth0 - no ipv6 nd suppress-ra - ipv6 nd prefix 2001:0DB8:5009::/64 -@end group -@end example - -For more information see @cite{RFC2462 (IPv6 Stateless Address Autoconfiguration)} -, @cite{RFC4861 (Neighbor Discovery for IP Version 6 (IPv6))} -, @cite{RFC6275 (Mobility Support in IPv6)} -and @cite{RFC4191 (Default Router Preferences and More-Specific Routes)}. diff --git a/doc/isisd.8.in b/doc/isisd.8.in deleted file mode 100644 index 542c28993..000000000 --- a/doc/isisd.8.in +++ /dev/null @@ -1,119 +0,0 @@ -.TH IS-IS 8 "25 November 2004" "@PACKAGE_FULLNAME@ IS-IS daemon" "Version @PACKAGE_VERSION@" -.SH NAME -isisd \- an IS-IS routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B isisd -[ -.B \-dhv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B isisd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B isisd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/isisd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When isisd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart isisd. The default is \fB\fI@CFG_STATE@/isisd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the isisd VTY will listen on. This defaults to -2608, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the isisd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -There are currently no such modules for -\fBisisd\fR in the base package. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/isisd -The default location of the -.B isisd -binary. -.TP -.BI @CFG_SYSCONF@/isisd.conf -The default location of the -.B isisd -config file. -.TP -.BI $(PWD)/isisd.log -If the -.B isisd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBisisd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The isisd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBisisd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -\fBisisd\fR is ALPHA quality at the moment and hasn't any way ready for -production use. - -.B isisd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://isisd.sourceforge.net -or the Info file for an accurate list of authors. - diff --git a/doc/isisd.texi b/doc/isisd.texi deleted file mode 100644 index 404698d80..000000000 --- a/doc/isisd.texi +++ /dev/null @@ -1,433 +0,0 @@ -@cindex ISIS -@node ISIS -@chapter ISIS - -@acronym{ISIS,Intermediate System to Intermediate System} is a routing protocol -which is described in @cite{ISO10589, RFC1195, RFC5308}. ISIS is an -@acronym{IGP,Interior Gateway Protocol}. Compared with @acronym{RIP}, -@acronym{ISIS} can provide scalable network support and faster -convergence times like @acronym{OSPF}. ISIS is widely used in large networks such as -@acronym{ISP,Internet Service Provider} and carrier backbone networks. - -@menu -* Configuring isisd:: -* ISIS router:: -* ISIS Timer:: -* ISIS region:: -* ISIS interface:: -* Showing ISIS information:: -* ISIS Traffic Engineering:: -* Debugging ISIS:: -* ISIS Configuration Examples:: -@end menu - -@node Configuring isisd -@section Configuring isisd - -There are no @command{isisd} specific options. Common options can be -specified (@pxref{Common Invocation Options}) to @command{isisd}. -@command{isisd} needs to acquire interface information from -@command{zebra} in order to function. Therefore @command{zebra} must be -running before invoking @command{isisd}. Also, if @command{zebra} is -restarted then @command{isisd} must be too. - -Like other daemons, @command{isisd} configuration is done in @acronym{ISIS} -specific configuration file @file{isisd.conf}. - -@node ISIS router -@section ISIS router - -To start ISIS process you have to specify the ISIS router. As of this -writing, @command{isisd} does not support multiple ISIS processes. - -@deffn Command {router isis WORD} {} -@deffnx Command {no router isis WORD} {} -@anchor{router isis WORD}Enable or disable the ISIS process by specifying the ISIS domain with 'WORD'. -@command{isisd} does not yet support multiple ISIS processes but you must specify -the name of ISIS process. The ISIS process name 'WORD' is then used for interface -(see command @ref{ip router isis WORD}). -@end deffn - -@deffn {ISIS Command} {net XX.XXXX. ... .XXX.XX} {} -@deffnx {ISIS Command} {no net XX.XXXX. ... .XXX.XX} {} -Set/Unset network entity title (NET) provided in ISO format. -@end deffn - -@deffn {ISIS Command} {hostname dynamic} {} -@deffnx {ISIS Command} {no hostname dynamic} {} -Enable support for dynamic hostname. -@end deffn - -@deffn {ISIS Command} {area-password [clear | md5] <password>} {} -@deffnx {ISIS Command} {domain-password [clear | md5] <password>} {} -@deffnx {ISIS Command} {no area-password} {} -@deffnx {ISIS Command} {no domain-password} {} -Configure the authentication password for an area, respectively a domain, -as clear text or md5 one. -@end deffn - -@deffn {ISIS Command} {log-adjacency-changes} {} -@deffnx {ISIS Command} {no log-adjacency-changes} {} -Log changes in adjacency state. -@end deffn - -@deffn {ISIS Command} {metric-style [narrow | transition | wide]} {} -@deffnx {ISIS Command} {no metric-style} {} -@anchor{metric-style}Set old-style (ISO 10589) or new-style packet formats: - - narrow Use old style of TLVs with narrow metric - - transition Send and accept both styles of TLVs during transition - - wide Use new style of TLVs to carry wider metric -@end deffn - -@deffn {ISIS Command} {set-overload-bit} {} -@deffnx {ISIS Command} {no set-overload-bit} {} -Set overload bit to avoid any transit traffic. -@end deffn - -@node ISIS Timer -@section ISIS Timer - -@deffn {ISIS Command} {lsp-gen-interval <1-120>} {} -@deffnx {ISIS Command} {lsp-gen-interval [level-1 | level-2] <1-120>} {} -@deffnx {ISIS Command} {no lsp-gen-interval} {} -@deffnx {ISIS Command} {no lsp-gen-interval [level-1 | level-2]} {} -Set minimum interval in seconds between regenerating same LSP, -globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {ISIS Command} {lsp-refresh-interval <1-65235>} {} -@deffnx {ISIS Command} {lsp-refresh-interval [level-1 | level-2] <1-65235>} {} -@deffnx {ISIS Command} {no lsp-refresh-interval} {} -@deffnx {ISIS Command} {no lsp-refresh-interval [level-1 | level-2]} {} -Set LSP refresh interval in seconds, globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {ISIS Command} {lsp-refresh-interval <1-65235>} {} -@deffnx {ISIS Command} {lsp-refresh-interval [level-1 | level-2] <1-65235>} {} -@deffnx {ISIS Command} {no lsp-refresh-interval} {} -@deffnx {ISIS Command} {no lsp-refresh-interval [level-1 | level-2]} {} -Set LSP refresh interval in seconds, globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {ISIS Command} {max-lsp-lifetime <360-65535>} {} -@deffnx {ISIS Command} {max-lsp-lifetime [level-1 | level-2] <360-65535>} {} -@deffnx {ISIS Command} {no max-lsp-lifetime} {} -@deffnx {ISIS Command} {no max-lsp-lifetime [level-1 | level-2]} {} -Set LSP maximum LSP lifetime in seconds, globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {ISIS Command} {spf-interval <1-120>} {} -@deffnx {ISIS Command} {spf-interval [level-1 | level-2] <1-120>} {} -@deffnx {ISIS Command} {no spf-interval} {} -@deffnx {ISIS Command} {no spf-interval [level-1 | level-2]} {} -Set minimum interval between consecutive SPF calculations in seconds. -@end deffn - -@node ISIS region -@section ISIS region - -@deffn {ISIS Command} {is-type [level-1 | level-1-2 | level-2-only]} {} -@deffnx {ISIS Command} {no is-type} {} -Define the ISIS router behavior: - - level-1 Act as a station router only - - level-1-2 Act as both a station router and an area router - - level-2-only Act as an area router only -@end deffn - -@node ISIS interface -@section ISIS interface - -@deffn {Interface Command} {ip router isis WORD} {} -@deffnx {Interface Command} {no ip router isis WORD} {} -@anchor{ip router isis WORD}Activate ISIS adjacency on this interface. Note that the name -of ISIS instance must be the same as the one used to configure the ISIS process -(see command @ref{router isis WORD}). -@end deffn - -@deffn {Interface Command} {isis circuit-type [level-1 | level-1-2 | level-2]} {} -@deffnx {Interface Command} {no isis circuit-type} {} -Configure circuit type for interface: - - level-1 Level-1 only adjacencies are formed - - level-1-2 Level-1-2 adjacencies are formed - - level-2-only Level-2 only adjacencies are formed -@end deffn - -@deffn {Interface Command} {isis csnp-interval <1-600>} {} -@deffnx {Interface Command} {isis csnp-interval <1-600> [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis csnp-interval} {} -@deffnx {Interface Command} {no isis csnp-interval [level-1 | level-2]} {} -Set CSNP interval in seconds globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {Interface Command} {isis hello padding} {} -Add padding to IS-IS hello packets. -@end deffn - -@deffn {Interface Command} {isis hello-interval <1-600>} {} -@deffnx {Interface Command} {isis hello-interval <1-600> [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis hello-interval} {} -@deffnx {Interface Command} {no isis hello-interval [level-1 | level-2]} {} -Set Hello interval in seconds globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {Interface Command} {isis hello-multiplier <2-100>} {} -@deffnx {Interface Command} {isis hello-multiplier <2-100> [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis hello-multiplier} {} -@deffnx {Interface Command} {no isis hello-multiplier [level-1 | level-2]} {} -Set multiplier for Hello holding time globally, for an area (level-1) or a domain (level-2). -@end deffn - -@deffn {Interface Command} {isis metric [<0-255> | <0-16777215>]} {} -@deffnx {Interface Command} {isis metric [<0-255> | <0-16777215>] [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis metric} {} -@deffnx {Interface Command} {no isis metric [level-1 | level-2]} {} -Set default metric value globally, for an area (level-1) or a domain (level-2). -Max value depend if metric support narrow or wide value (see command @ref{metric-style}). -@end deffn - -@deffn {Interface Command} {isis network point-to-point} {} -@deffnx {Interface Command} {no isis network point-to-point} {} -Set network type to 'Point-to-Point' (broadcast by default). -@end deffn - -@deffn {Interface Command} {isis passive} {} -@deffnx {Interface Command} {no isis passive} {} -Configure the passive mode for this interface. -@end deffn - -@deffn {Interface Command} {isis password [clear | md5] <password>} {} -@deffnx {Interface Command} {no isis password} {} -Configure the authentication password (clear or encoded text) for the interface. -@end deffn - -@deffn {Interface Command} {isis priority <0-127>} {} -@deffnx {Interface Command} {isis priority <0-127> [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis priority} {} -@deffnx {Interface Command} {no isis priority [level-1 | level-2]} {} -Set priority for Designated Router election, globally, for the area (level-1) -or the domain (level-2). -@end deffn - -@deffn {Interface Command} {isis psnp-interval <1-120>} {} -@deffnx {Interface Command} {isis psnp-interval <1-120> [level-1 | level-2]} {} -@deffnx {Interface Command} {no isis psnp-interval} {} -@deffnx {Interface Command} {no isis psnp-interval [level-1 | level-2]} {} -Set PSNP interval in seconds globally, for an area (level-1) or a domain (level-2). -@end deffn - -@node Showing ISIS information -@section Showing ISIS information - -@deffn {Command} {show isis summary} {} -Show summary information about ISIS. -@end deffn - -@deffn {Command} {show isis hostname} {} -Show information about ISIS node. -@end deffn - -@deffn {Command} {show isis interface} {} -@deffnx {Command} {show isis interface detail} {} -@deffnx {Command} {show isis interface <interface name>} {} -Show state and configuration of ISIS specified interface, or all -interfaces if no interface is given with or without details. -@end deffn - -@deffn {Command} {show isis neighbor} {} -@deffnx {Command} {show isis neighbor <System Id>} {} -@deffnx {Command} {show isis neighbor detail} {} -Show state and information of ISIS specified neighbor, or all -neighbors if no system id is given with or without details. -@end deffn - -@deffn {Command} {show isis database} {} -@deffnx {Command} {show isis database [detail]} {} -@deffnx {Command} {show isis database <LSP id> [detail]} {} -@deffnx {Command} {show isis database detail <LSP id>} {} -Show the ISIS database globally, for a specific LSP id without or with details. -@end deffn - -@deffn {Command} {show isis topology} {} -@deffnx {Command} {show isis topology [level-1|level-2]} {} -Show topology IS-IS paths to Intermediate Systems, globally, -in area (level-1) or domain (level-2). -@end deffn - -@deffn {Command} {show ip route isis} {} -Show the ISIS routing table, as determined by the most recent SPF calculation. -@end deffn - -@node ISIS Traffic Engineering -@section Traffic Engineering - -@deffn {ISIS Command} {mpls-te on} {} -@deffnx {ISIS Command} {no mpls-te} {} -Enable Traffic Engineering LSP flooding. -@end deffn - -@deffn {ISIS Command} {mpls-te router-address <A.B.C.D>} {} -@deffnx {ISIS Command} {no mpls-te router-address} {} -Configure stable IP address for MPLS-TE. -@end deffn - -@deffn {Command} {show isis mpls-te interface} {} -@deffnx {Command} {show isis mpls-te interface @var{interface}} {} -Show MPLS Traffic Engineering parameters for all or specified interface. -@end deffn - -@deffn {Command} {show isis mpls-te router} {} -Show Traffic Engineering router parameters. -@end deffn - -@node Debugging ISIS -@section Debugging ISIS - -@deffn {Command} {debug isis adj-packets} {} -@deffnx {Command} {no debug isis adj-packets} {} -IS-IS Adjacency related packets. -@end deffn - -@deffn {Command} {debug isis checksum-errors} {} -@deffnx {Command} {no debug isis checksum-errors} {} -IS-IS LSP checksum errors. -@end deffn - -@deffn {Command} {debug isis events} {} -@deffnx {Command} {no debug isis events} {} -IS-IS Events. -@end deffn - -@deffn {Command} {debug isis local-updates} {} -@deffnx {Command} {no debug isis local-updates} {} -IS-IS local update packets. -@end deffn - -@deffn {Command} {debug isis packet-dump} {} -@deffnx {Command} {no debug isis packet-dump} {} -IS-IS packet dump. -@end deffn - -@deffn {Command} {debug isis protocol-errors} {} -@deffnx {Command} {no debug isis protocol-errors} {} -IS-IS LSP protocol errors. -@end deffn - -@deffn {Command} {debug isis route-events} {} -@deffnx {Command} {no debug isis route-events} {} -IS-IS Route related events. -@end deffn - -@deffn {Command} {debug isis snp-packets} {} -@deffnx {Command} {no debug isis snp-packets} {} -IS-IS CSNP/PSNP packets. -@end deffn - -@deffn {Command} {debug isis spf-events} {} -@deffnx {Command} {debug isis spf-statistics} {} -@deffnx {Command} {debug isis spf-triggers} {} -@deffnx {Command} {no debug isis spf-events} {} -@deffnx {Command} {no debug isis spf-statistics} {} -@deffnx {Command} {no debug isis spf-triggers} {} -IS-IS Shortest Path First Events, Timing and Statistic Data -and triggering events. -@end deffn - -@deffn {Command} {debug isis update-packets} {} -@deffnx {Command} {no debug isis update-packets} {} -Update related packets. -@end deffn - -@deffn {Command} {show debugging isis} {} -Print which ISIS debug level is activate. -@end deffn - -@node ISIS Configuration Examples -@section ISIS Configuration Examples -A simple example, with MD5 authentication enabled: - -@example -@group -! -interface eth0 - ip router isis FOO - isis network point-to-point - isis circuit-type level-2-only -! -router isis FOO -net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00 - metric-style wide - is-type level-2-only -@end group -@end example - - -A Traffic Engineering configuration, with Inter-ASv2 support. - - - First, the 'zebra.conf' part: - -@example -@group -hostname HOSTNAME -password PASSWORD -log file /var/log/zebra.log -! -interface eth0 - ip address 10.2.2.2/24 - link-params - enable - metric 100 - max-bw 1.25e+07 - max-rsv-bw 1.25e+06 - unrsv-bw 0 1.25e+06 - unrsv-bw 1 1.25e+06 - unrsv-bw 2 1.25e+06 - unrsv-bw 3 1.25e+06 - unrsv-bw 4 1.25e+06 - unrsv-bw 5 1.25e+06 - unrsv-bw 6 1.25e+06 - unrsv-bw 7 1.25e+06 - admin-grp 0xab -! -interface eth1 - ip address 10.1.1.1/24 - link-params - enable - metric 100 - max-bw 1.25e+07 - max-rsv-bw 1.25e+06 - unrsv-bw 0 1.25e+06 - unrsv-bw 1 1.25e+06 - unrsv-bw 2 1.25e+06 - unrsv-bw 3 1.25e+06 - unrsv-bw 4 1.25e+06 - unrsv-bw 5 1.25e+06 - unrsv-bw 6 1.25e+06 - unrsv-bw 7 1.25e+06 - neighbor 10.1.1.2 as 65000 -@end group -@end example - - - Then the 'isisd.conf' itself: - -@example -@group -hostname HOSTNAME -password PASSWORD -log file /var/log/isisd.log -! -! -interface eth0 - ip router isis FOO -! -interface eth1 - ip router isis FOO -! -! -router isis FOO - isis net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00 - mpls-te on - mpls-te router-address 10.1.1.1 -! -line vty -@end group -@end example diff --git a/doc/kernel.texi b/doc/kernel.texi deleted file mode 100644 index e58ade5a8..000000000 --- a/doc/kernel.texi +++ /dev/null @@ -1,47 +0,0 @@ -@node Kernel Interface -@chapter Kernel Interface - -There are several different methods for reading kernel routing table -information, updating kernel routing tables, and for looking up -interfaces. - -@table @samp - -@item ioctl -The @samp{ioctl} method is a very traditional way for reading or writing -kernel information. @samp{ioctl} can be used for looking up interfaces -and for modifying interface addresses, flags, mtu settings and other -types of information. Also, @samp{ioctl} can insert and delete kernel -routing table entries. It will soon be available on almost any platform -which zebra supports, but it is a little bit ugly thus far, so if a -better method is supported by the kernel, zebra will use that. - -@item sysctl -@samp{sysctl} can lookup kernel information using MIB (Management -Information Base) syntax. Normally, it only provides a way of getting -information from the kernel. So one would usually want to change kernel -information using another method such as @samp{ioctl}. - -@item proc filesystem -@samp{proc filesystem} provides an easy way of getting kernel -information. - -@item routing socket - -@item netlink -On recent Linux kernels (2.0.x and 2.2.x), there is a kernel/user -communication support called @code{netlink}. It makes asynchronous -communication between kernel and Frr possible, similar to a routing -socket on BSD systems. - -Before you use this feature, be sure to select (in kernel configuration) -the kernel/netlink support option 'Kernel/User network link driver' and -'Routing messages'. - -Today, the /dev/route special device file is obsolete. Netlink -communication is done by reading/writing over netlink socket. - -After the kernel configuration, please reconfigure and rebuild Frr. -You can use netlink as a dynamic routing update channel between Frr -and the kernel. -@end table diff --git a/doc/ldpd.8.in b/doc/ldpd.8.in deleted file mode 100644 index 2d68a31a5..000000000 --- a/doc/ldpd.8.in +++ /dev/null @@ -1,117 +0,0 @@ -.TH LDPD 8 "29 March 2016" "@PACKAGE_FULLNAME@ LDP daemon" "Version @PACKAGE_VERSION@" -.SH NAME -ldpd \- an LDP engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B ldpd -[ -.B \-dhv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B ldpd -is a component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B ldpd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/ldpd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When ldpd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart ldpd. The default is \fB\fI@CFG_STATE@/ldpd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the ldpd VTY will listen on. This defaults to -2612, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the ldpd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -There are currently no such modules for -\fBldpd\fR in the base package. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/ldpd -The default location of the -.B ldpd -binary. -.TP -.BI @CFG_SYSCONF@/ldpd.conf -The default location of the -.B ldpd -config file. -.TP -.BI $(PWD)/ldpd.log -If the -.B ldpd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBldpd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The ldpd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBldpd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B ldpd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/main.texi b/doc/main.texi deleted file mode 100644 index 9e2ca5e50..000000000 --- a/doc/main.texi +++ /dev/null @@ -1,525 +0,0 @@ -@node Zebra -@chapter Zebra - -@c SYNOPSIS -@command{zebra} is an IP routing manager. It provides kernel routing -table updates, interface lookups, and redistribution of routes between -different routing protocols. - -@menu -* Invoking zebra:: Running the program -* Interface Commands:: Commands for zebra interfaces -* Static Route Commands:: Commands for adding static routes -* Multicast RIB Commands:: Commands for controlling MRIB behavior -* zebra Route Filtering:: Commands for zebra route filtering -* zebra FIB push interface:: Interface to optional FPM component -* zebra Terminal Mode Commands:: Commands for zebra's VTY -@end menu - - -@node Invoking zebra -@section Invoking zebra - -Besides the common invocation options (@pxref{Common Invocation Options}), the -@command{zebra} specific invocation options are listed below. - -@table @samp -@item -b -@itemx --batch -Runs in batch mode. @command{zebra} parses configuration file and terminates -immediately. - -@item -k -@itemx --keep_kernel -When zebra starts up, don't delete old self inserted routes. - -@item -r -@itemx --retain -When program terminates, retain routes added by zebra. - -@end table - -@node Interface Commands -@section Interface Commands - -@menu -* Standard Commands:: -* Link Parameters Commands:: -@end menu - -@node Standard Commands -@subsection Standard Commands - -@deffn Command {interface @var{ifname}} {} -@end deffn - -@deffn {Interface Command} {shutdown} {} -@deffnx {Interface Command} {no shutdown} {} -Up or down the current interface. -@end deffn - -@deffn {Interface Command} {ip address @var{address/prefix}} {} -@deffnx {Interface Command} {ipv6 address @var{address/prefix}} {} -@deffnx {Interface Command} {no ip address @var{address/prefix}} {} -@deffnx {Interface Command} {no ipv6 address @var{address/prefix}} {} -Set the IPv4 or IPv6 address/prefix for the interface. -@end deffn - -@deffn {Interface Command} {ip address @var{local-addr} peer @var{peer-addr/prefix}} {} -@deffnx {Interface Command} {no ip address @var{local-addr} peer @var{peer-addr/prefix}} {} -Configure an IPv4 Pointopoint address on the interface. -(The concept of PtP addressing does not exist for IPv6.) - -@var{local-addr} has no subnet mask since the local side in PtP -addressing is always a single (/32) address. @var{peer-addr/prefix} -can be an arbitrary subnet behind the other end of the link (or even on the -link in Point-to-Multipoint setups), though generally /32s are used. -@end deffn - -@deffn {Interface Command} {ip address @var{address/prefix} secondary} {} -@deffnx {Interface Command} {no ip address @var{address/prefix} secondary} {} -Set the secondary flag for this address. This causes ospfd to not treat the -address as a distinct subnet. -@end deffn - -@deffn {Interface Command} {description @var{description} ...} {} -Set description for the interface. -@end deffn - -@deffn {Interface Command} {multicast} {} -@deffnx {Interface Command} {no multicast} {} -Enable or disables multicast flag for the interface. -@end deffn - -@deffn {Interface Command} {bandwidth <1-10000000>} {} -@deffnx {Interface Command} {no bandwidth <1-10000000>} {} -Set bandwidth value of the interface in kilobits/sec. This is for -calculating OSPF cost. This command does not affect the actual device -configuration. -@end deffn - -@deffn {Interface Command} {link-detect} {} -@deffnx {Interface Command} {no link-detect} {} -Enable/disable link-detect on platforms which support this. Currently -only Linux and Solaris, and only where network interface drivers support reporting -link-state via the IFF_RUNNING flag. -@end deffn - -@node Link Parameters Commands -@subsection Link Parameters Commands - -@deffn {Interface Command} {link-params} {} -@deffnx {Interface Command} {no link-param} {} -Enter into the link parameters sub node. At least 'enable' must be set to activate the link parameters, -and consequently Traffic Engineering on this interface. MPLS-TE must be enable at the OSPF (@ref{OSPF Traffic Engineering}) -or ISIS (@ref{ISIS Traffic Engineering}) router level in complement to this. -Disable link parameters for this interface. -@end deffn - -Under link parameter statement, the following commands set the different TE values: - -@deffn link-params {enable} -Enable link parameters for this interface. -@end deffn - -@deffn link-params {metric <0-4294967295>} {} -@deffnx link-params {max-bw @var{bandwidth}} {} -@deffnx link-params {max-rsv-bw @var{bandwidth}} {} -@deffnx link-params {unrsv-bw <0-7> @var{bandwidth}} {} -@deffnx link-params {admin-grp @var{bandwidth}} {} -These commands specifies the Traffic Engineering parameters of the interface in conformity to RFC3630 (OSPF) -or RFC5305 (ISIS). -There are respectively the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth (interface speed -by default), Maximum Reservable Bandwidth, Unreserved Bandwidth for each 0-7 priority and Admin Group (ISIS) or -Resource Class/Color (OSPF). - -Note that @var{bandwidth} are specified in IEEE floating point format and express in Bytes/second. -@end deffn - -@deffn link-param {delay <0-16777215> [min <0-16777215> | max <0-16777215>]} {} -@deffnx link-param {delay-variation <0-16777215>} {} -@deffnx link-param {packet-loss @var{percentage}} {} -@deffnx link-param {res-bw @var{bandwidth}} {} -@deffnx link-param {ava-bw @var{bandwidth}} {} -@deffnx link-param {use-bw @var{bandwidth}} {} -These command specifies additionnal Traffic Engineering parameters of the interface in conformity to -draft-ietf-ospf-te-metrics-extension-05.txt and draft-ietf-isis-te-metrics-extension-03.txt. There are -respectively the delay, jitter, loss, available bandwidth, reservable bandwidth and utilized bandwidth. - -Note that @var{bandwidth} are specified in IEEE floating point format and express in Bytes/second. -Delays and delay variation are express in micro-second (µs). Loss is specified in @var{percentage} ranging -from 0 to 50.331642% by step of 0.000003. -@end deffn - -@deffn link-param {neighbor <A.B.C.D> as <0-65535>} {} -@deffnx link-param {no neighbor} {} -Specifies the remote ASBR IP address and Autonomous System (AS) number for InterASv2 link in OSPF (RFC5392). -Note that this option is not yet supported for ISIS (RFC5316). -@end deffn - - -@node Static Route Commands -@section Static Route Commands - -Static routing is a very fundamental feature of routing technology. It -defines static prefix and gateway. - -@deffn Command {ip route @var{network} @var{gateway}} {} -@var{network} is destination prefix with format of A.B.C.D/M. -@var{gateway} is gateway for the prefix. When @var{gateway} is -A.B.C.D format. It is taken as a IPv4 address gateway. Otherwise it -is treated as an interface name. If the interface name is @var{null0} then -zebra installs a blackhole route. - -@example -ip route 10.0.0.0/8 10.0.0.2 -ip route 10.0.0.0/8 ppp0 -ip route 10.0.0.0/8 null0 -@end example - -First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. -Second one defines the same prefix but with gateway to interface ppp0. The -third install a blackhole route. -@end deffn - -@deffn Command {ip route @var{network} @var{netmask} @var{gateway}} {} -This is alternate version of above command. When @var{network} is -A.B.C.D format, user must define @var{netmask} value with A.B.C.D -format. @var{gateway} is same option as above command - -@example -ip route 10.0.0.0 255.255.255.0 10.0.0.2 -ip route 10.0.0.0 255.255.255.0 ppp0 -ip route 10.0.0.0 255.255.255.0 null0 -@end example - -These statements are equivalent to those in the previous example. -@end deffn - -@deffn Command {ip route @var{network} @var{gateway} @var{distance}} {} -Installs the route with the specified distance. -@end deffn - -Multiple nexthop static route - -@example -ip route 10.0.0.1/32 10.0.0.2 -ip route 10.0.0.1/32 10.0.0.3 -ip route 10.0.0.1/32 eth0 -@end example - -If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 -is reachable, then the last route is installed into the kernel. - -If zebra has been compiled with multipath support, and both 10.0.0.2 and -10.0.0.3 are reachable, zebra will install a multipath route via both -nexthops, if the platform supports this. - -@example -zebra> show ip route -S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive - via 10.0.0.3 inactive - * is directly connected, eth0 -@end example - -@example -ip route 10.0.0.0/8 10.0.0.2 -ip route 10.0.0.0/8 10.0.0.3 -ip route 10.0.0.0/8 null0 255 -@end example - -This will install a multihop route via the specified next-hops if they are -reachable, as well as a high-metric blackhole route, which can be useful to -prevent traffic destined for a prefix to match less-specific routes (eg -default) should the specified gateways not be reachable. Eg: - -@example -zebra> show ip route 10.0.0.0/8 -Routing entry for 10.0.0.0/8 - Known via "static", distance 1, metric 0 - 10.0.0.2 inactive - 10.0.0.3 inactive - -Routing entry for 10.0.0.0/8 - Known via "static", distance 255, metric 0 - directly connected, Null0 -@end example - -@deffn Command {ipv6 route @var{network} @var{gateway}} {} -@deffnx Command {ipv6 route @var{network} @var{gateway} @var{distance}} {} -These behave similarly to their ipv4 counterparts. -@end deffn - -@deffn Command {ipv6 route @var{network} from @var{srcprefix} @var{gateway}} {} -@deffnx Command {ipv6 route @var{network} from @var{srcprefix} @var{gateway} @var{distance}} {} -Install a static source-specific route. These routes are currently supported -on Linux operating systems only, and perform AND matching on packet's -destination and source addresses in the kernel's forwarding path. Note that -destination longest-prefix match is "more important" than source LPM, e.g. -@command{"2001:db8:1::/64 from 2001:db8::/48"} will win over -@command{"2001:db8::/48 from 2001:db8:1::/64"} if both match. -@end deffn - - -@deffn Command {table @var{tableno}} {} -Select the primary kernel routing table to be used. This only works -for kernels supporting multiple routing tables (like GNU/Linux 2.2.x -and later). After setting @var{tableno} with this command, -static routes defined after this are added to the specified table. -@end deffn - -@node Multicast RIB Commands -@section Multicast RIB Commands - -The Multicast RIB provides a separate table of unicast destinations which -is used for Multicast Reverse Path Forwarding decisions. It is used with -a multicast source's IP address, hence contains not multicast group -addresses but unicast addresses. - -This table is fully separate from the default unicast table. However, -RPF lookup can include the unicast table. - -WARNING: RPF lookup results are non-responsive in this version of Frr, -i.e. multicast routing does not actively react to changes in underlying -unicast topology! - -@deffn Command {ip multicast rpf-lookup-mode @var{mode}} {} -@deffnx Command {no ip multicast rpf-lookup-mode [@var{mode}]} {} - -@var{mode} sets the method used to perform RPF lookups. Supported modes: - -@table @samp -@item urib-only -Performs the lookup on the Unicast RIB. The Multicast RIB is never used. -@item mrib-only -Performs the lookup on the Multicast RIB. The Unicast RIB is never used. -@item mrib-then-urib -Tries to perform the lookup on the Multicast RIB. If any route is found, -that route is used. Otherwise, the Unicast RIB is tried. -@item lower-distance -Performs a lookup on the Multicast RIB and Unicast RIB each. The result -with the lower administrative distance is used; if they're equal, the -Multicast RIB takes precedence. -@item longer-prefix -Performs a lookup on the Multicast RIB and Unicast RIB each. The result -with the longer prefix length is used; if they're equal, the -Multicast RIB takes precedence. -@end table - -The @code{mrib-then-urib} setting is the default behavior if nothing is -configured. If this is the desired behavior, it should be explicitly -configured to make the configuration immune against possible changes in -what the default behavior is. - -WARNING: Unreachable routes do not receive special treatment and do not -cause fallback to a second lookup. -@end deffn - -@deffn Command {show ip rpf @var{addr}} {} - -Performs a Multicast RPF lookup, as configured with -@command{ip multicast rpf-lookup-mode @var{mode}}. @var{addr} specifies -the multicast source address to look up. - -@example -> show ip rpf 192.0.2.1 -Routing entry for 192.0.2.0/24 using Unicast RIB - Known via "kernel", distance 0, metric 0, best - * 198.51.100.1, via eth0 -@end example - -Indicates that a multicast source lookup for 192.0.2.1 would use an -Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. -@end deffn - -@deffn Command {show ip rpf} {} - -Prints the entire Multicast RIB. Note that this is independent of the -configured RPF lookup mode, the Multicast RIB may be printed yet not -used at all. -@end deffn - -@deffn Command {ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {} -@deffnx Command {no ip mroute @var{prefix} @var{nexthop} [@var{distance}]} {} - -Adds a static route entry to the Multicast RIB. This performs exactly as -the @command{ip route} command, except that it inserts the route in the -Multicast RIB instead of the Unicast RIB. -@end deffn - - -@node zebra Route Filtering -@section zebra Route Filtering -Zebra supports @command{prefix-list} and @command{route-map} to match -routes received from other frr components. The -@command{permit}/@command{deny} facilities provided by these commands -can be used to filter which routes zebra will install in the kernel. - -@deffn Command {ip protocol @var{protocol} route-map @var{routemap}} {} -Apply a route-map filter to routes for the specified protocol. @var{protocol} -can be @b{any} or one of -@b{system}, -@b{kernel}, -@b{connected}, -@b{static}, -@b{rip}, -@b{ripng}, -@b{ospf}, -@b{ospf6}, -@b{isis}, -@b{bgp}, -@b{hsls}. -@end deffn - -@deffn {Route Map} {set src @var{address}} -Within a route-map, set the preferred source address for matching routes -when installing in the kernel. -@end deffn - -@example -The following creates a prefix-list that matches all addresses, a route-map -that sets the preferred source address, and applies the route-map to all -@command{rip} routes. - -@group -ip prefix-list ANY permit 0.0.0.0/0 le 32 -route-map RM1 permit 10 - match ip address prefix-list ANY - set src 10.0.0.1 - -ip protocol rip route-map RM1 -@end group -@end example - -@node zebra FIB push interface -@section zebra FIB push interface - -Zebra supports a 'FIB push' interface that allows an external -component to learn the forwarding information computed by the Frr -routing suite. This is a loadable module that needs to be enabled -at startup as described in @ref{Loadable Module Support}. - -In Frr, the Routing Information Base (RIB) resides inside -zebra. Routing protocols communicate their best routes to zebra, and -zebra computes the best route across protocols for each prefix. This -latter information makes up the Forwarding Information Base -(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in -the kernel to forward packets according to the routes computed by -Frr. The kernel FIB is updated in an OS-specific way. For example, -the @code{netlink} interface is used on Linux, and route sockets are -used on FreeBSD. - -The FIB push interface aims to provide a cross-platform mechanism to -support scenarios where the router has a forwarding path that is -distinct from the kernel, commonly a hardware-based fast path. In -these cases, the FIB needs to be maintained reliably in the fast path -as well. We refer to the component that programs the forwarding plane -(directly or indirectly) as the Forwarding Plane Manager or FPM. - -The FIB push interface comprises of a TCP connection between zebra and -the FPM. The connection is initiated by zebra -- that is, the FPM acts -as the TCP server. - -The relevant zebra code kicks in when zebra is configured with the -@code{--enable-fpm} flag. Zebra periodically attempts to connect to -the well-known FPM port. Once the connection is up, zebra starts -sending messages containing routes over the socket to the FPM. Zebra -sends a complete copy of the forwarding table to the FPM, including -routes that it may have picked up from the kernel. The existing -interaction of zebra with the kernel remains unchanged -- that is, the -kernel continues to receive FIB updates as before. - -The encapsulation header for the messages exchanged with the FPM is -defined by the file @file{fpm/fpm.h} in the frr tree. The routes -themselves are encoded in netlink or protobuf format, with netlink -being the default. - -Protobuf is one of a number of new serialization formats wherein the -message schema is expressed in a purpose-built language. Code for -encoding/decoding to/from the wire format is generated from the -schema. Protobuf messages can be extended easily while maintaining -backward-compatibility with older code. Protobuf has the following -advantages over netlink: - -@itemize -@item -Code for serialization/deserialization is generated -automatically. This reduces the likelihood of bugs, allows third-party -programs to be integrated quickly, and makes it easy to add fields. -@item -The message format is not tied to an OS (Linux), and can be evolved -independently. -@end itemize - -As mentioned before, zebra encodes routes sent to the FPM in netlink -format by default. The format can be controlled via the FPM module's -load-time option to zebra, which currently takes the values @code{netlink} -and @code{protobuf}. - -The zebra FPM interface uses replace semantics. That is, if a 'route -add' message for a prefix is followed by another 'route add' message, -the information in the second message is complete by itself, and -replaces the information sent in the first message. - -If the connection to the FPM goes down for some reason, zebra sends -the FPM a complete copy of the forwarding table(s) when it reconnects. - -@node zebra Terminal Mode Commands -@section zebra Terminal Mode Commands - -@deffn Command {show ip route} {} -Display current routes which zebra holds in its database. - -@example -@group -Router# show ip route -Codes: K - kernel route, C - connected, S - static, R - RIP, - B - BGP * - FIB route. - -K* 0.0.0.0/0 203.181.89.241 -S 0.0.0.0/0 203.181.89.1 -C* 127.0.0.0/8 lo -C* 203.181.89.240/28 eth0 -@end group -@end example -@end deffn - -@deffn Command {show ipv6 route} {} -@end deffn - -@deffn Command {show interface} {} -@end deffn - -@deffn Command {show ip prefix-list [@var{name}]} {} -@end deffn - -@deffn Command {show route-map [@var{name}]} {} -@end deffn - -@deffn Command {show ip protocol} {} -@end deffn - -@deffn Command {show ipforward} {} -Display whether the host's IP forwarding function is enabled or not. -Almost any UNIX kernel can be configured with IP forwarding disabled. -If so, the box can't work as a router. -@end deffn - -@deffn Command {show ipv6forward} {} -Display whether the host's IP v6 forwarding is enabled or not. -@end deffn - -@deffn Command {show zebra} {} -Display various statistics related to the installation and deletion -of routes, neighbor updates, and LSP's into the kernel. -@end deffn - -@deffn Command {show zebra fpm stats} {} -Display statistics related to the zebra code that interacts with the -optional Forwarding Plane Manager (FPM) component. -@end deffn - -@deffn Command {clear zebra fpm stats} {} -Reset statistics related to the zebra code that interacts with the -optional Forwarding Plane Manager (FPM) component. -@end deffn diff --git a/doc/manpages/.gitignore b/doc/manpages/.gitignore new file mode 100644 index 000000000..050553715 --- /dev/null +++ b/doc/manpages/.gitignore @@ -0,0 +1,3 @@ +/_templates +/_build +!/Makefile diff --git a/doc/manpages/Makefile b/doc/manpages/Makefile new file mode 100644 index 000000000..ebbbc3100 --- /dev/null +++ b/doc/manpages/Makefile @@ -0,0 +1,48 @@ +include ../frr-sphinx.mk + +# ----------------------------------------------------------------------------- +# Automake requires that 3rd-party Makefiles recognize these targets. +# ----------------------------------------------------------------------------- +# install +# install-data +# install-exec +# uninstall +# install-dvi +# install-html +# install-info +# install-ps +# install-pdf +# installdirs +# check +# installcheck +# mostlyclean +# clean +# distclean +# maintainer-clean +# dvi +# pdf +# ps +# info +# html +# tags +# ctags + +# ignore these targets +EMPTY_AUTOMAKE_TARGETS = dvi pdf ps tags ctags distdir installdirs check installcheck install-dvi install-ps install-html install-pdf install-info install-exec +.PHONY: $(EMPTY_AUTOMAKE_TARGETS) +$(EMPTY_AUTOMAKE_TARGETS): + +# These targets are automatically generated by Sphinx but conflict with +# implicitly defined Automake rules, so we manually override them to nothing. +# The other option is deleting the Sphinx-generated rules, which suppresses the +# warning but kinda screws up the symmetry between Makefiles. +info: ; +html: ; + +all: man + +install-data: man + +install: install-data + +mostlyclean distclean maintainer-clean: clean diff --git a/doc/manpages/bgpd.rst b/doc/manpages/bgpd.rst new file mode 100644 index 000000000..94213db4d --- /dev/null +++ b/doc/manpages/bgpd.rst @@ -0,0 +1,38 @@ +**** +BGPD +**** + +.. include:: defines.rst +.. |DAEMON| replace:: bgpd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/common-options.rst b/doc/manpages/common-options.rst new file mode 100644 index 000000000..5b136f5e1 --- /dev/null +++ b/doc/manpages/common-options.rst @@ -0,0 +1,165 @@ +HELP AND VERSION +---------------- + +.. option:: -h, --help + + Print a short description of the daemon's command line options. + +.. option:: -v, --version + + Print version and build information for the daemon. + +Both of these options inhibit normal operation and will immediately exit. + +PROCESS CONTROL +--------------- +These options control background operation: + +.. option:: -d, --daemon + + Launches the process in background/daemon mode, forking and detaching from the terminal. + + The parent process will delay its exit until the daemon/child has finished its initialization and has entered its main loop. This is important for zebra startup because the other daemons will attempt to connect to zebra. A return from zebra -d guarantees its readiness to accept these connections. + +.. option:: -t, --terminal + + Opens an interactive VTY session on the terminal, allowing for both state and configuration operations. Note that the terminal starts operating after startup has completed and the configuration file has been loaded. + + The process will exit when end of file is detected on the terminal. It is possible to daemonize a process started with -t (but without -d) by sending SIGQUIT to the process (normally mapped to a ^\ keypress.) + + +The combination of :option:`--daemon` and :option:`--terminal` will delay the daemon from going into background until the terminal session ends (by end of file.) + +If the process receives SIGINT (e.g. a ^C keypress) in this mode, it will exit instead of daemonizing. + +It is safe to suspend (SIGTSTP / ^Z) the terminal session opened by the previous two options; this will only stop the terminal but not the protocol daemon itself (which runs in a separate second process.) + +CONFIGURATION AND PATHS +----------------------- +The following options control configuration and file system locations for frr processes: + +.. option:: -f, --config_file config-file + + Specify a configuration file to be used instead of the default /etc/frr/<daemon>.conf file. + + Note that the daemon will attempt to write to this file if the write file command is issued on its VTY interface or through vtysh. + +.. option:: -C, --dryrun + + Load the configuration file and check its validity, then exit. + +.. option:: -i, --pid_file pid-file + + Output a pid file to a location other than the default /var/run/frr/<daemon>.pid. + +.. option:: -z, --socket zclient-path + + Override the path of the ZAPI socket used to communicate between zebra and the various protocol daemons. The default is /var/run/frr/zserv.api. The value of this option must be the same across all daemons. + +.. option:: -N, --pathspace pathspace + + Insert pathspace into all default paths, changing the defaults to: + + /etc/frr/pathspace/<daemon>.conf + /var/run/frr/pathspace/<daemon>.pid + /var/run/frr/pathspace/<daemon>.vty + /var/run/frr/pathspace/zserv.api + + ´.´ and ´/´ characters will not be accepted in pathspace, but the empty string will be accepted. + + Note that this only changes the respective defaults, it has no effect on the respective path if the -f, -i, -z or --vty_socket options are used. + + The purpose of this option is to easily group all file system related bits together for running multiple fully-separate "logical routers" on a system, particularly with Linux network namespaces. Groups of daemons running with distinct pathspace values will be completely unaware of each other and not interact in any way. + + This option does not do any system setup (like network namespaces.) This must be done by the user, for example by running: + + ip netns exec namespace <daemon> -N namespace + + +PROCESS CREDENTIALS +------------------- +.. option:: -u, --user user + + (default: frr) + +.. option:: -g, --group group + + (default: frr) + + Change the user/group which the daemon will switch to. + +.. option:: -S, --skip_runas + + Skip setting the process effective user and group. + + +Note that there is an additional group, frrvty, which controls group ownership of the VTY sockets. The name of this group cannot currently be changed, and user must be a member of this group. + + +VTY SETUP +--------- +These following options control the daemon's VTY (interactive command line) interface. The interface is available over TCP, using the telnet protocol, as well as through the vtysh frontend. + +.. option:: -A, --vty_addr vty-addr + + Specify an IP/IPv6 address to bind the TCP VTY interface to. It is generally recommended to specify ::1 or 127.0.0.1. For reasons of backwards compatibility, the default is to listen on all interfaces. + +.. option:: -P, --vty_port vty-port + + Override the daemon's default TCP VTY port (each daemon has a different default value upwards of 2600, listed below.) Specifying 0 disables the TCP VTY interface. + + Default ports are::: + + zebra 2601 + ripd 2602 + ripngd 2603 + ospfd 2604 + bgpd 2605 + ospf6d 2606 + isisd 2608 + babeld 2609 + nhrpd 2610 + pimd 2611 + ldpd 2612 + eigrpd 2613 + + Port 2607 is used for ospfd's Opaque LSA API, while port 2600 is used for the (insecure) TCP-ZEBRA interface. + +.. option:: --vty_socket vty-path + + Overrides the directory used for the <daemon>.vty sockets. vtysh connects to these sockets in order to access each daemon's VTY. + Default: /var/run/frr[/<pathspace>] + + NB: Unlike the other options, this option specifies a directory, not a full path. + + This option is primarily used by the SNAP packaging system, its semantics may change. It should not be neccessary in most other scenarios. + +MODULE LOADING +-------------- +frr supports optional dynamically loadable modules, although these can only be loaded at startup. The set of available modules may vary across distributions and packages, and modules may be available for installation as separate packages. + +.. option:: -M, --module module[:options] + + Load a module named module, optionally passing options to it. + + If there is a ´/´ character in module, the value is assumed to be a pathname to a module. + + If there is no ´/´ character, the module directory (see next option) is searched first for a module named "<daemon>_<module>.so", then for "<module>.so". This allows for a module to exist in variations appropriate for particular daemons, e.g. zebra_snmp and bgp_snmp, with the correct one selected by -M snmp. + + The meaning of options is specific to the module being loaded. Most modules currently ignore it. + + Modules are loaded in the order as listed on the command line. This is not generally relevant. + +.. option:: --moduledir module-path + + Look for modules in the module-path directory instead of the default /usr/lib/frr/modules. (This path is not affected by the -N option.) + +The list of loaded modules can be inspected at runtime with the show modules VTY command. + +ROUTES +------ + +.. option:: -r, --retain + + When the program terminates, retain routes added by the daemon. + diff --git a/doc/manpages/conf.py b/doc/manpages/conf.py new file mode 100644 index 000000000..a78e1a2c3 --- /dev/null +++ b/doc/manpages/conf.py @@ -0,0 +1,348 @@ +# -*- coding: utf-8 -*- +# +# FRR documentation build configuration file, created by +# sphinx-quickstart on Tue Jan 31 16:00:52 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import re + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = '1.0' + +# prolog for various variable substitutions +rst_prolog = '' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.todo'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst'] +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'FRR' +copyright = u'2017, FRR' +author = u'Kunihiro Ishiguro, et al.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. + +# The short X.Y version. +version = u'?.?' +# The full version, including alpha/beta/rc tags. +release = u'?.?-?' + + +# ----------------------------------------------------------------------------- +# Extract values from codebase for substitution into docs. +# ----------------------------------------------------------------------------- + +# Various installation prefixes. Reasonable defaults are set where possible. +# Values are overridden by logic below. +replace_vars = { + 'AUTHORS': author, + 'COPYRIGHT_YEAR': '1999-2005', + 'COPYRIGHT_STR': None, + 'PACKAGE_NAME': project.lower(), + 'PACKAGE_TARNAME': project.lower(), + 'PACKAGE_STRING': None, + 'PACKAGE_URL': 'https://frrouting.org/', + 'PACKAGE_VERSION': None, + 'INSTALL_PREFIX_ETC': None, + 'INSTALL_PREFIX_SBIN': None, + 'INSTALL_PREFIX_STATE': None, + 'INSTALL_PREFIX_MODULES': None, + 'INSTALL_USER': None, + 'INSTALL_GROUP': None, + 'INSTALL_VTY_GROUP': None, + 'GROUP': 'frr', + 'USER': 'frr', +} + +# extract version information, installation location, other stuff we need to +# use when building final documents +val = re.compile('^S\["([^"]+)"\]="(.*)"$') +with open('../../config.status', 'r') as cfgstatus: + for ln in cfgstatus.readlines(): + m = val.match(ln) + if not m or m.group(1) not in replace_vars.keys(): continue + replace_vars[m.group(1)] = m.group(2) + +# manually fill out some of these we can't get from config.status +replace_vars['COPYRIGHT_STR'] = "Copyright (c)" +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['COPYRIGHT_YEAR']) +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['AUTHORS']) +release = replace_vars['PACKAGE_VERSION'] +version = release.split('-')[0] + +# add substitutions to prolog +for key, value in replace_vars.items(): + rst_prolog += '.. |{0}| replace:: {1}\n'.format(key, value) + + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build', 'common-options.rst', 'epilogue.rst', 'defines.rst'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +#html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +#html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'FRRdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', + +# Latex figure (float) alignment +#'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'FRR.tex', u'FRR User Manual', + u'FRR', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). + +# If true, show URL addresses after external links. +#man_show_urls = False + +fwfrr = "{0} routing engine for use with FRRouting." + +man_pages = [ + ('bgpd', 'bgpd', fwfrr.format("a BGPv4, BGPv4+, BGPv4- "), [], 8), + ('eigrpd', 'eigrpd', fwfrr.format("an EIGRP "), [], 8), + ('ospf6d', 'ospf6d', fwfrr.format("an OSPFv3 "), [], 8), + ('ospfd', 'ospfd', fwfrr.format("an OSPFv2 "), [], 8), + ('isisd', 'isisd', fwfrr.format("an IS-IS "), [], 8), + ('ospfclient', 'ospfclient', 'an example ospf-api client', [], 8), + ('ldpd', 'ldpd', fwfrr.format("an LDP "), [], 8), + ('nhrpd', 'nhrpd', fwfrr.format("a Next Hop Routing Protocol "), [], 8), + ('pimd', 'pimd', fwfrr.format("a PIM "), [], 8), + ('mtracebis', 'mtracebis', "a multicast trace client", [], 8), + ('ripd', 'ripd', fwfrr.format("a RIP "), [], 8), + ('ripngd', 'ripngd', fwfrr.format("a RIPNG "), [], 8), + ('zebra', 'zebra', 'a routing manager for use with associated FRRouting components.', [], 8), + ('watchfrr', 'watchfrr', 'a program to monitor the status of FRRouting daemons', [], 8), + ('vtysh', 'vtysh', 'an integrated shell for FRRouting.', [], 1), + ('frr', 'frr', 'a systemd interaction script', [], 1), +] + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + +# custom extensions here diff --git a/doc/manpages/defines.rst b/doc/manpages/defines.rst new file mode 100644 index 000000000..841abe300 --- /dev/null +++ b/doc/manpages/defines.rst @@ -0,0 +1,3 @@ +.. |synopsis-options| replace:: [-d|-t|-dt] [-C] [-f config-file] [-i pid-file] [-z zclient-path] [-u user] [-g group] [-A vty-addr] [-P vty-port] [-M module[:options]] [-N pathspace] [--vty_socket vty-path] [--moduledir module-path] +.. |synopsis-options-hv| replace:: [-h] [-v] +.. |seealso-programs| replace:: zebra(8), vtysh(1), ripd(8), ripngd(8), ospfd(8), ospf6d(8), bgpd(8), isisd(8), babeld(8), nhrpd(8), pimd(8), ldpd(8), eigrpd(8), mtracebis(8) diff --git a/doc/manpages/eigrpd.rst b/doc/manpages/eigrpd.rst new file mode 100644 index 000000000..bc824468d --- /dev/null +++ b/doc/manpages/eigrpd.rst @@ -0,0 +1,38 @@ +****** +EIGRPD +****** + +.. include:: defines.rst +.. |DAEMON| replace:: eigrpd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/epilogue.rst b/doc/manpages/epilogue.rst new file mode 100644 index 000000000..77fed8199 --- /dev/null +++ b/doc/manpages/epilogue.rst @@ -0,0 +1,16 @@ +WARNING +======= +This man page is intended to be a quick reference for command line options. The definitive document is the info file |PACKAGE_STRING| or the documentation available on the project website at |PACKAGE_URL|. + +DIAGNOSTICS +=========== +The daemon may log to standard output, to a VTY, to a log file, or through syslog to the system logs. FRR supports many debugging options, see the Info file, web docs or source for details. + +SEE ALSO +======== +|seealso-programs| +|PACKAGE_URL| + +BUGS +==== +FRR eats bugs for breakfast. If you have food for the maintainers, please email <dev@lists.frrouting.org>. diff --git a/doc/manpages/frr.rst b/doc/manpages/frr.rst new file mode 100644 index 000000000..3d3479afa --- /dev/null +++ b/doc/manpages/frr.rst @@ -0,0 +1,44 @@ +*** +FRR +*** + +.. include:: defines.rst + +SYNOPSIS +======== +frr [ start ] + +frr [ stop ] + +frr [ reload ] + +frr [ restart ] + +frr [ status ] + + +DESCRIPTION +=========== +frr is a systemd interaction script for the FRRouting routing engine. + +OPTIONS +======= +Options available for the frr command: + +start + Start enabled FRR daemons + +stop + Stop enabled FRR daemons + +reload + Reload modified configuration files + +restart + Stop all running daemons and then restart them + +status + Status of all the daemon + +.. include:: epilogue.rst + diff --git a/doc/manpages/index.rst b/doc/manpages/index.rst new file mode 100644 index 000000000..ae5c4ca3b --- /dev/null +++ b/doc/manpages/index.rst @@ -0,0 +1,27 @@ +.. FRR documentation master file, created by + sphinx-quickstart on Wed Jan 31 12:00:55 2018. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to FRR's documentation! +=============================== + +.. toctree:: + :maxdepth: 2 + + bgpd + eigrpd + isisd + ldpd + nhrpd + ospf6d + ospfclient + ospfd + pimd + mtracebis + ripd + ripngd + watchfrr + zebra + vtysh + frr diff --git a/doc/manpages/isisd.rst b/doc/manpages/isisd.rst new file mode 100644 index 000000000..68761f642 --- /dev/null +++ b/doc/manpages/isisd.rst @@ -0,0 +1,38 @@ +***** +ISISD +***** + +.. include:: defines.rst +.. |DAEMON| replace:: isisd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/ldpd.rst b/doc/manpages/ldpd.rst new file mode 100644 index 000000000..113f06673 --- /dev/null +++ b/doc/manpages/ldpd.rst @@ -0,0 +1,38 @@ +**** +LDPD +**** + +.. include:: defines.rst +.. |DAEMON| replace:: ldpd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/mtracebis.rst b/doc/manpages/mtracebis.rst new file mode 100644 index 000000000..b4d57c1b9 --- /dev/null +++ b/doc/manpages/mtracebis.rst @@ -0,0 +1,39 @@ +********* +MTRACEBIS +********* + +.. include:: defines.rst +.. |PROGRAM| replace:: mtracebis + +SYNOPSIS +======== +|PROGRAM| |synopsis-options-hv| + +|PROGRAM| <multicast source> + +DESCRIPTION +=========== +|PROGRAM| is a program to initiate multicast traceroute, or "mtrace", queries. + +The initial version of the program requires multicast source IP address and +initiates a weak traceroute across the network. This tests whether the +interfaces towards the source are multicast enabled. The first query sent is a +full query, capable of crossing the network all the way to the source. If this +fails, hop-by-hop queries are initiated. + +Hop-by-hop queries start by requesting only a response from the nearest router. +Following that, next query is extended to the next two routers, and so on... +until a set of routers is tested for connectivity. + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|PROGRAM| + The default location of the |PROGRAM| binary. + +.. include:: epilogue.rst + +AUTHORS +======= + +Mladen Sablic diff --git a/doc/manpages/nhrpd.rst b/doc/manpages/nhrpd.rst new file mode 100644 index 000000000..cae01c677 --- /dev/null +++ b/doc/manpages/nhrpd.rst @@ -0,0 +1,38 @@ +***** +NHRPD +***** + +.. include:: defines.rst +.. |DAEMON| replace:: nhrpd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/ospf6d.rst b/doc/manpages/ospf6d.rst new file mode 100644 index 000000000..cfc6860d5 --- /dev/null +++ b/doc/manpages/ospf6d.rst @@ -0,0 +1,39 @@ +****** +OSPF6D +****** + +.. include:: defines.rst +.. |DAEMON| replace:: ospf6d + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/ospfclient.rst b/doc/manpages/ospfclient.rst new file mode 100644 index 000000000..c52b10876 --- /dev/null +++ b/doc/manpages/ospfclient.rst @@ -0,0 +1,43 @@ +********** +OSPFCLIENT +********** + +.. include:: defines.rst + +SYNOPSIS +======== +ospfclient <ospfd> <lsatype> <opaquetype> <opaqueid> <ifaddr> <areaid> + +DESCRIPTION +=========== +ospfclient is an example ospf-api client to test the ospfd daemon. + +OPTIONS +======= + +.. option:: ospfd + + A router where the API-enabled OSPF daemon is running. + +.. option:: lsatype + + The value has to be either "9", "10", or "11", depending on the flooding scope. + +.. option:: opaquetype + + The value has to be in the range of 0-255 (for example, experimental applications might use opaquetype larger than 128). + +.. option:: opaqueid + + Arbitrary application instance (24 bits). + +.. option:: ifaddr + + Interface IP address for type 9, otherwise it will be ignored. + +.. option:: areaid + + Area in the IP address format for type 10, otherwise it will be ignored. + + +.. include:: epilogue.rst diff --git a/doc/manpages/ospfd.rst b/doc/manpages/ospfd.rst new file mode 100644 index 000000000..6e4d093f6 --- /dev/null +++ b/doc/manpages/ospfd.rst @@ -0,0 +1,39 @@ +***** +OSPFD +***** + +.. include:: defines.rst +.. |DAEMON| replace:: ospfd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/pimd.rst b/doc/manpages/pimd.rst new file mode 100644 index 000000000..d7582668d --- /dev/null +++ b/doc/manpages/pimd.rst @@ -0,0 +1,38 @@ +**** +PIMD +**** + +.. include:: defines.rst +.. |DAEMON| replace:: pimd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/ripd.rst b/doc/manpages/ripd.rst new file mode 100644 index 000000000..af4590c82 --- /dev/null +++ b/doc/manpages/ripd.rst @@ -0,0 +1,38 @@ +**** +RIPD +**** + +.. include:: defines.rst +.. |DAEMON| replace:: ripd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/ripngd.rst b/doc/manpages/ripngd.rst new file mode 100644 index 000000000..aedd68987 --- /dev/null +++ b/doc/manpages/ripngd.rst @@ -0,0 +1,38 @@ +****** +RIPNGD +****** + +.. include:: defines.rst +.. |DAEMON| replace:: ripngd + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing component that works with the FRRouting routing engine. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/vtysh.rst b/doc/manpages/vtysh.rst new file mode 100644 index 000000000..38cb668e8 --- /dev/null +++ b/doc/manpages/vtysh.rst @@ -0,0 +1,72 @@ +***** +VTYSH +***** + +.. include:: defines.rst +.. |DAEMON| replace:: eigrpd + +SYNOPSIS +======== +vtysh [ -b ] + +vtysh [ -E ] [ -d *daemon* ] [ -c *command* ] + +DESCRIPTION +=========== +vtysh is an integrated shell for the FRRouting suite of protocol daemons. + +OPTIONS +======= +OPTIONS available for the vtysh command: + +.. option:: -b, --boot + + Execute boot startup configuration. It makes sense only if integrated config file is in use (not default in FRRouting). See Info file frr for more info. + +.. option:: -c, --command command + + Specify command to be executed under batch mode. It behaves like -c option in any other shell - command is executed and vtysh exits. + + It's useful for gathering info from FRRouting daemons or reconfiguring daemons from inside shell scripts, etc. Note that multiple commands may be executed by using more than one -c option and/or embedding linefeed characters inside the command string. + +.. option:: -d, --daemon daemon_name + + Specify which daemon to connect to. By default, vtysh attempts to connect to all FRRouting daemons running on the system. With this flag, one can specify a single daemon to connect to instead. For example, specifying '-d ospfd' will connect only to ospfd. This can be particularly useful inside scripts with -c where the command is targeted for a single daemon. + +.. option:: -e, --execute command + + Alias for -c. It's here only for compatibility with Zebra routing software and older FRR versions. This will be removed in future. + +.. option:: -E, --echo + + When the -c option is being used, this flag will cause the standard vtysh prompt and command to be echoed prior to displaying the results. This is particularly useful to separate the results when executing multiple commands. + +.. option:: -h, --help + + Display a usage message on standard output and exit. + +ENVIRONMENT VARIABLES +===================== +VTYSH_PAGER + This should be the name of the pager to use. Default is more. + +FILES +===== +|INSTALL_PREFIX_SBIN|/vtysh + The default location of the vtysh binary. + +|INSTALL_PREFIX_ETC|/vtysh.conf + The default location of the vtysh config file. + +|INSTALL_PREFIX_ETC|/frr.conf + The default location of the integrated FRRouting routing engine config file if integrated config file is in use. + +${HOME}/.history_frr + Location of history of commands entered via cli + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/watchfrr.rst b/doc/manpages/watchfrr.rst new file mode 100644 index 000000000..f0b733298 --- /dev/null +++ b/doc/manpages/watchfrr.rst @@ -0,0 +1,119 @@ +******** +WATCHFRR +******** + +.. include:: defines.rst +.. |DAEMON| replace:: watchfrr + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| [option...] <daemon>... + + +DESCRIPTION +=========== +|DAEMON| is a watchdog program that monitors the status of supplied frr daemons and tries to restart them in case they become unresponsive or shut down. + +To determine whether a daemon is running, it tries to connect to the daemon's VTY UNIX stream socket, and send echo commands to ensure the daemon responds. When the daemon crashes, EOF is received from the socket, so that |DAEMON| can react immediately. + +In order to avoid restarting the daemons in quick succession, you can supply the -m and -M options to set the minimum and maximum delay between the restart commands. The minimum restart delay is recalculated each time a restart is attempted. If the time since the last restart attempt exceeds twice the value of -M, the restart delay is set to the value of -m, otherwise the interval is doubled (but capped at the value of -M). + +OPTIONS +======= +The following 3 options specify scripts that |DAEMON| uses to perform start/stop/restart actions. These options are mandatory unless the --dry option is used: + +.. option:: -s command, --start-command command + + Supply a Bourne shell command to start a single daemon. The command string should contain the '%s' placeholder to be sub‐ stituted with the daemon name. + +.. option:: -k command, --kill-command command + + Supply a Bourne shell command to stop a single daemon. The command string should contain the '%s' placeholder to be substituted with the daemon name. + +.. option:: -r command, --restart command + + Supply a Bourne shell command to restart a single daemon. The command string should contain the '%s' placeholder to be substituted with the daemon name. + +Other options: + +.. option:: --dry + + Run |DAEMON| in "dry-run" mode, only monitoring the specified daemons but not performing any start/stop/restart actions. + +.. option:: -d, --daemon + + Run in daemon mode. When supplied, error messages are sent to Syslog instead of standard output (stdout). + +.. option:: -S <directory>, --statedir <directory> + + Set the VTY socket directory (the default value is "/var/run/frr"). + +.. option:: -l <level>, --loglevel <level> + + Set the logging level (the default value is "6"). The value should range from 0 (LOG_EMERG) to 7 (LOG_DEBUG), but higher number can be supplied if extra debugging messages are required. + +.. option:: --min-restart-interval <number> + + Set the minimum number of seconds to wait between invocations of the daemon restart commands (the default value is "60"). + +.. option:: --max-restart-interval <number> + + Set the maximum number of seconds to wait between invocations of the daemon restart commands (the default value is "600"). + +.. option:: -i <number>, --interval <number> + + Set the status polling interval in seconds (the default value is "5"). + +.. option:: -t <number>, --timeout <number> + + Set the unresponsiveness timeout in seconds (the default value is "10"). + +.. option:: -T <number>, --restart-timeout <number> + + Set the restart (kill) timeout in seconds (the default value is "20"). If any background jobs are still running after this period has elapsed, they will be killed. + +.. option:: -p <filename>, --pid-file <filename> + + Set the process identifier filename (the default value is "/var/run/frr/|DAEMON|.pid"). + +.. option:: -b <string>, --blank-string <string> + + When the supplied string is found in any of the command line option arguments (i.e., -r, -s, or -k), replace it with a space. + + This is an ugly hack to circumvent problems with passing the command line arguments containing embedded spaces. + +.. option:: -v, --version + + Display the version information and exit. + +.. option:: -h, --help + + Display the usage information and exit. + +PREVIOUS OPTIONS +================ +Prior versions of |DAEMON| supported some additional options that no longer exist::: + + -a, -A, -e, -R, -z + +The ``-a``, ``-A`` and ``-R`` options were used to select alternate monitoring modes that offered different patterns of restarting daemons. The "correct" mode (phased restart) is now the default. The -e and -z options used to disable some monitoring aspects, |DAEMON| now always has all monitoring features enabled. + +Removing these options should result in correct operation, if it does not please file a bug report. + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/manpages/zebra.rst b/doc/manpages/zebra.rst new file mode 100644 index 000000000..4ddf98995 --- /dev/null +++ b/doc/manpages/zebra.rst @@ -0,0 +1,59 @@ +***** +ZEBRA +***** + +.. include:: defines.rst +.. |DAEMON| replace:: zebra + +SYNOPSIS +======== +|DAEMON| |synopsis-options-hv| + +|DAEMON| |synopsis-options| + +DESCRIPTION +=========== +|DAEMON| is a routing manager that implements the zebra route engine. zebra supports all protocol daemons in the FRRouting suite. + +OPTIONS +======= +OPTIONS available for the |DAEMON| command: + +.. include:: common-options.rst + +.. option:: -b, --batch + + Runs in batch mode, zebra parses its config and exits. + +.. option:: -k, --keep_kernel + + On startup, don't delete self inserted routes. + +.. option:: -s, --nl-bufsize <netlink-buffer-size> + + Set netlink receive buffer size. There are cases where zebra daemon can't handle flood of netlink messages from kernel. If you ever see "recvmsg overrun" messages in zebra log, you are in trouble. + + Solution is to increase receive buffer of netlink socket. Note that kernel < 2.6.14 doesn't allow to increase it over maximum value defined in /proc/sys/net/core/rmem_max. If you want to do it, you have to increase maximum before starting zebra. + + Note that this affects Linux only. + + +.. option:: -n, --vrfwnetns + + Enable namespace VRF backend. By default, the VRF backend relies on VRF-lite support from the Linux kernel. This option permits discovering Linux named network namespaces and mapping it to FRR VRF contexts. + +FILES +===== + +|INSTALL_PREFIX_SBIN|/|DAEMON| + The default location of the |DAEMON| binary. + +|INSTALL_PREFIX_ETC|/|DAEMON|.conf + The default location of the |DAEMON| config file. + +$(PWD)/|DAEMON|.log + If the |DAEMON| process is configured to output logs to a file, then you + will find this file in the directory where you started |DAEMON|. + +.. include:: epilogue.rst + diff --git a/doc/mtracebis.8.in b/doc/mtracebis.8.in deleted file mode 100644 index 3abc717b9..000000000 --- a/doc/mtracebis.8.in +++ /dev/null @@ -1,25 +0,0 @@ -.\" This file was originally generated by help2man 1.44.1. -.TH MTRACEBIS "8" "February 2018" "mtracebis 0.1" "System Administration Utilities" -.SH NAME -mtracebis \- a program to initiate multicast traceroute "mtrace" queries -.SH SYNOPSIS -mtracebis -<multicast source> -.SH DESCRIPTION -.B mtracebis -is a program used to test multicast connectivity in a multicast and multicast -traceroute enabled IP network. -.PP -Initial version of the program requires multicast source IP address and -initiates a weak traceroute across the network. This tests whether the -interfaces towards the source are multicast enabled. First query sent is a -full query, capable of crossing the network all the way to the source. If this -fails, hop-by-hop queries are initiated. -.PP -Hop-by-hop queries start by requesting only a response from the nearest router. -Following that, next query is extended to the next two routers, and so on... -until a set of routers is tested for connectivity. -.SH SEE ALSO -See the project homepage at <@PACKAGE_URL@>. -.SH AUTHORS -Copyright 2018 Mladen Sablic diff --git a/doc/next-hop-tracking.txt b/doc/next-hop-tracking.txt deleted file mode 100644 index 12ed63947..000000000 --- a/doc/next-hop-tracking.txt +++ /dev/null @@ -1,326 +0,0 @@ -0. Introduction - -This is the design specification for next hop tracking feature in -Frr. - -1. Background - -Recursive routes are of the form: - - p/m --> n - [Ex: 1.1.0.0/16 --> 2.2.2.2] - -where 'n' itself is resolved through another route as follows: - - p2/m --> h, interface - [Ex: 2.2.2.0/24 --> 3.3.3.3, eth0] - -Usually, BGP routes are recursive in nature and BGP nexthops get -resolved through an IGP route. IGP usually adds its routes pointing to -an interface (these are called non-recursive routes). - -When BGP receives a recursive route from a peer, it needs to validate -the nexthop. The path is marked valid or invalid based on the -reachability status of the nexthop. Nexthop validation is also -important for BGP decision process as the metric to reach the nexthop -is a parameter to best path selection process. - -As it goes with routing, this is a dynamic process. Route to the -nexthop can change. The nexthop can become unreachable or -reachable. In the current BGP implementation, the nexthop validation -is done periodically in the scanner run. The default scanner run -interval is one minute. Every minute, the scanner task walks the -entire BGP table. It checks the validity of each nexthop with Zebra -(the routing table manager) through a request and response message -exchange between BGP and Zebra process. BGP process is blocked for -that duration. The mechanism has two major drawbacks: - -(1) The scanner task runs to completion. That can potentially starve - the other tasks for long periods of time, based on the BGP table - size and number of nexthops. - -(2) Convergence around routing changes that affect the nexthops can be - long (around a minute with the default intervals). The interval - can be shortened to achieve faster reaction time, but it makes the - first problem worse, with the scanner task consuming most of the - CPU resources. - -"Next hop tracking" feature makes this process event-driven. It -eliminates periodic nexthop validation and introduces an asynchronous -communication path between BGP and Zebra for route change notifications -that can then be acted upon. - -2. Goal - -Stating the obvious, the main goal is to remove the two limitations we -discussed in the previous section. The goals, in a constructive tone, -are the following: - -- fairness: the scanner run should not consume an unjustly high amount - of CPU time. This should give an overall good performance and - response time to other events (route changes, session events, - IO/user interface). - -- convergence: BGP must react to nexthop changes instantly and provide - sub-second convergence. This may involve diverting the routes from - one nexthop to another. - -3. Overview of the changes - -The changes are in both BGP and Zebra modules. The short summary is -the following: - -- Zebra implements a registration mechanism by which clients can - register for next hop notification. Consequently, it maintains a - separate table, per (VRF, AF) pair, of next hops and interested - client-list per next hop. - -- When the main routing table changes in Zebra, it evaluates the next - hop table: for each next hop, it checks if the route table - modifications have changed its state. If so, it notifies the - interested clients. - -- BGP is one such client. It registers the next hops corresponding to - all of its received routes/paths. It also threads the paths against - each nexthop structure. - -- When BGP receives a next hop notification from Zebra, it walks the - corresponding path list. It makes them valid or invalid depending - on the next hop notification. It then re-computes best path for the - corresponding destination. This may result in re-announcing those - destinations to peers. - -4. Design - -4.1. Modules - -The core design introduces an "nht" (next hop tracking) module in BGP -and "rnh" (recursive nexthop) module in Zebra. The "nht" module -provides the following APIs: - -bgp_find_or_add_nexthop() : find or add a nexthop in BGP nexthop table -bgp_find_nexthop() : find a nexthop in BGP nexthop table -bgp_parse_nexthop_update() : parse a nexthop update message coming - from zebra - -The "rnh" module provides the following APIs: - -zebra_add_rnh() : add a recursive nexthop -zebra_delete_rnh() : delete a recursive nexthop -zebra_lookup_rnh() : lookup a recursive nexthop - -zebra_add_rnh_client() : register a client for nexthop notifications - against a recursive nexthop - -zebra_remove_rnh_client(): remove the client registration for a - recursive nexthop - -zebra_evaluate_rnh_table(): (re)evaluate the recursive nexthop table - (most probably because the main routing - table has changed). - -zebra_cleanup_rnh_client(): Cleanup a client from the "rnh" module - data structures (most probably because the - client is going away). - -4.2. Control flow - -The next hop registration control flow is the following: - -<==== BGP Process ====>|<==== Zebra Process ====> - | -receive module nht module | zserv module rnh module ----------------------------------------------------------------------- - | | | -bgp_update_ | | | - main() | bgp_find_or_add_ | | - | nexthop() | | - | | | - | | zserv_nexthop_ | - | | register() | - | | | zebra_add_rnh() - | | | - - -The next hop notification control flow is the following: - -<==== Zebra Process ====>|<==== BGP Process ====> - | -rib module rnh module | zebra module nht module ----------------------------------------------------------------------- - | | | -meta_queue_ | | | - process() | zebra_evaluate_ | | - | rnh_table() | | - | | | - | | bgp_read_nexthop_ | - | | update() | - | | | bgp_parse_ - | | | nexthop_update() - | | | - - -4.3. zclient message format - -ZEBRA_NEXTHOP_REGISTER and ZEBRA_NEXTHOP_UNREGISTER messages are -encoded in the following way: - -/* - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | AF | prefix len | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . Nexthop prefix . - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . . - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | AF | prefix len | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . Nexthop prefix . - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - -ZEBRA_NEXTHOP_UPDATE message is encoded as follows: - -/* - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | AF | prefix len | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . Nexthop prefix getting resolved . - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | metric | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | #nexthops | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | nexthop type | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . resolving Nexthop details . - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | nexthop type | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * . resolving Nexthop details . - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - */ - -4.4. BGP data structure - -Legend: - -/\ struct bgp_node: a BGP destination/route/prefix -\/ - -[ ] struct bgp_info: a BGP path (e.g. route received from a peer) - - _ -(_) struct bgp_nexthop_cache: a BGP nexthop - - - - /\ NULL - \/--+ ^ - | : - +--[ ]--[ ]--[ ]--> NULL - /\ : - \/--+ : - | : - +--[ ]--[ ]--> NULL - : - _ : - (_)............. - - -4.5. Zebra data structure - -rnh table: - - O - / \ - O O - / \ - O O - - struct rnh - { - u_char flags; - struct route_entry *state; - struct list *client_list; - struct route_node *node; - }; - -5. User interface changes - -frr# show ip nht -3.3.3.3 - resolved via kernel - via 11.0.0.6, swp1 - Client list: bgp(fd 12) -11.0.0.10 - resolved via connected - is directly connected, swp2 - Client list: bgp(fd 12) -11.0.0.18 - resolved via connected - is directly connected, swp4 - Client list: bgp(fd 12) -11.11.11.11 - resolved via kernel - via 10.0.1.2, eth0 - Client list: bgp(fd 12) - -frr# show ip bgp nexthop -Current BGP nexthop cache: - 3.3.3.3 valid [IGP metric 0], #paths 3 - Last update: Wed Oct 16 04:43:49 2013 - - 11.0.0.10 valid [IGP metric 1], #paths 1 - Last update: Wed Oct 16 04:43:51 2013 - - 11.0.0.18 valid [IGP metric 1], #paths 2 - Last update: Wed Oct 16 04:43:47 2013 - - 11.11.11.11 valid [IGP metric 0], #paths 1 - Last update: Wed Oct 16 04:43:47 2013 - -frr# show ipv6 nht -frr# show ip bgp nexthop detail - -frr# debug bgp nht -frr# debug zebra nht - -6. Sample test cases - - r2----r3 - / \ / - r1----r4 - -- Verify that a change in IGP cost triggers NHT - + shutdown the r1-r4 and r2-r4 links - + no shut the r1-r4 and r2-r4 links and wait for OSPF to come back - up - + We should be back to the original nexthop via r4 now -- Verify that a NH becoming unreachable triggers NHT - + Shutdown all links to r4 -- Verify that a NH becoming reachable triggers NHT - + no shut all links to r4 - -7. Future work - -- route-policy for next hop validation (e.g. ignore default route) -- damping for rapid next hop changes -- prioritized handling of nexthop changes ((un)reachability vs. metric - changes) -- handling recursion loop, e.g. - 11.11.11.11/32 -> 12.12.12.12 - 12.12.12.12/32 -> 11.11.11.11 - 11.0.0.0/8 -> <interface> -- better statistics diff --git a/doc/nhrpd.8.in b/doc/nhrpd.8.in deleted file mode 100644 index 09b662ae7..000000000 --- a/doc/nhrpd.8.in +++ /dev/null @@ -1,113 +0,0 @@ -.TH NHRP 8 "24 January 2017" "@PACKAGE_FULLNAME@ NHRP daemon" "Version @PACKAGE_VERSION@" -.SH NAME -nhrpd \- a Next Hop Routing Protocol routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B nhrpd -[ -.B \-dhv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B nhrpd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B nhrpd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will likely default to \fB\fI@CFG_SYSCONF@/nhrpd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When nhrpd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart nhrpd. The likely default is \fB\fI@CFG_STATE@/nhrpd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the nhrpd VTY will listen on. This defaults to -2610, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the nhrpd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -There are currently no such modules for -\fBnhrpd\fR in the base package. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/nhrpd -The default location of the -.B nhrpd -binary. -.TP -.BI @CFG_SYSCONF@/nhrpd.conf -The default location of the -.B nhrpd -config file. -.TP -.BI $(PWD)/nhrpd.log -If the -.B nhrpd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBnhrpd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The nhrpd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBnhrpd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR zebra (8), -.BR vtysh (1) - -.B nhrpd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -Timo Teräs <timo.teras@iki.fi> diff --git a/doc/ospf6d.8.in b/doc/ospf6d.8.in deleted file mode 100644 index 02d9d8083..000000000 --- a/doc/ospf6d.8.in +++ /dev/null @@ -1,119 +0,0 @@ -.TH OSPF6D 8 "25 November 2004" "@PACKAGE_FULLNAME@ OSPFv3 daemon" "Version @PACKAGE_VERSION@" -.SH NAME -ospf6d \- an OSPFv3 routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B ospf6d -[ -.B \-dhv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B ospf6d -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B ospf6d -command: -.SH OPTIONS -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/ospf6d.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When ospf6d starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart ospf6d. The default is \fB\fI@CFG_STATE@/ospf6d.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the ospf6d VTY will listen on. This defaults to -2606, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the ospf6d VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR module may be available for -\fBospf6d\fR, if the package was built with SNMP support. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/ospf6d -The default location of the -.B ospf6d -binary. -.TP -.BI @CFG_SYSCONF@/ospf6d.conf -The default location of the -.B ospf6d -config file. -.TP -.BI $(PWD)/ospf6d.log -If the -.B ospf6d -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBospf6d\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The ospf6d process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBospf6d\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B ospf6d -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/ospf6d.texi b/doc/ospf6d.texi deleted file mode 100644 index 3ea71fbd2..000000000 --- a/doc/ospf6d.texi +++ /dev/null @@ -1,172 +0,0 @@ -@node OSPFv3 -@chapter OSPFv3 - -@command{ospf6d} is a daemon support OSPF version 3 for IPv6 network. -OSPF for IPv6 is described in RFC2740. - -@menu -* OSPF6 router:: -* OSPF6 area:: -* OSPF6 interface:: -* Redistribute routes to OSPF6:: -* Showing OSPF6 information:: -* OSPF6 Configuration Examples:: -@end menu - -@node OSPF6 router -@section OSPF6 router - -@deffn {Command} {router ospf6} {} -@end deffn - -@deffn {OSPF6 Command} {router-id @var{a.b.c.d}} {} -Set router's Router-ID. -@end deffn - -@deffn {OSPF6 Command} {interface @var{ifname} area @var{area}} {} -Bind interface to specified area, and start sending OSPF packets. @var{area} can -be specified as 0. -@end deffn - -@deffn {OSPF6 Command} {timers throttle spf @var{delay} @var{initial-holdtime} @var{max-holdtime}} {} -@deffnx {OSPF6 Command} {no timers throttle spf} {} -This command sets the initial @var{delay}, the @var{initial-holdtime} -and the @var{maximum-holdtime} between when SPF is calculated and the -event which triggered the calculation. The times are specified in -milliseconds and must be in the range of 0 to 600000 milliseconds. - -The @var{delay} specifies the minimum amount of time to delay SPF -calculation (hence it affects how long SPF calculation is delayed after -an event which occurs outside of the holdtime of any previous SPF -calculation, and also serves as a minimum holdtime). - -Consecutive SPF calculations will always be seperated by at least -'hold-time' milliseconds. The hold-time is adaptive and initially is -set to the @var{initial-holdtime} configured with the above command. -Events which occur within the holdtime of the previous SPF calculation -will cause the holdtime to be increased by @var{initial-holdtime}, bounded -by the @var{maximum-holdtime} configured with this command. If the adaptive -hold-time elapses without any SPF-triggering event occuring then -the current holdtime is reset to the @var{initial-holdtime}. - -@example -@group -router ospf6 - timers throttle spf 200 400 10000 -@end group -@end example - -In this example, the @var{delay} is set to 200ms, the @var{initial -holdtime} is set to 400ms and the @var{maximum holdtime} to 10s. Hence -there will always be at least 200ms between an event which requires SPF -calculation and the actual SPF calculation. Further consecutive SPF -calculations will always be seperated by between 400ms to 10s, the -hold-time increasing by 400ms each time an SPF-triggering event occurs -within the hold-time of the previous SPF calculation. - -@end deffn - -@deffn {OSPF6 Command} {auto-cost reference-bandwidth @var{cost}} {} -@deffnx {OSPF6 Command} {no auto-cost reference-bandwidth} {} -This sets the reference bandwidth for cost calculations, where this -bandwidth is considered equivalent to an OSPF cost of 1, specified in -Mbits/s. The default is 100Mbit/s (i.e. a link of bandwidth 100Mbit/s -or higher will have a cost of 1. Cost of lower bandwidth links will be -scaled with reference to this cost). - -This configuration setting MUST be consistent across all routers -within the OSPF domain. -@end deffn - -@node OSPF6 area -@section OSPF6 area - -Area support for OSPFv3 is not yet implemented. - -@node OSPF6 interface -@section OSPF6 interface - -@deffn {Interface Command} {ipv6 ospf6 cost COST} {} -Sets interface's output cost. Default value depends on the interface -bandwidth and on the auto-cost reference bandwidth. -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 hello-interval HELLOINTERVAL} {} -Sets interface's Hello Interval. Default 40 -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 dead-interval DEADINTERVAL} {} -Sets interface's Router Dead Interval. Default value is 40. -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 retransmit-interval RETRANSMITINTERVAL} {} -Sets interface's Rxmt Interval. Default value is 5. -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 priority PRIORITY} {} -Sets interface's Router Priority. Default value is 1. -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 transmit-delay TRANSMITDELAY} {} -Sets interface's Inf-Trans-Delay. Default value is 1. -@end deffn - -@deffn {Interface Command} {ipv6 ospf6 network (broadcast|point-to-point)} {} -Set explicitly network type for specifed interface. -@end deffn - -@node Redistribute routes to OSPF6 -@section Redistribute routes to OSPF6 - -@deffn {OSPF6 Command} {redistribute static} {} -@deffnx {OSPF6 Command} {redistribute connected} {} -@deffnx {OSPF6 Command} {redistribute ripng} {} -@end deffn - -@node Showing OSPF6 information -@section Showing OSPF6 information - -@deffn {Command} {show ipv6 ospf6 [INSTANCE_ID]} {} -INSTANCE_ID is an optional OSPF instance ID. To see router ID and OSPF -instance ID, simply type "show ipv6 ospf6 <cr>". -@end deffn - -@deffn {Command} {show ipv6 ospf6 database} {} -This command shows LSA database summary. You can specify the type of LSA. -@end deffn - -@deffn {Command} {show ipv6 ospf6 interface} {} -To see OSPF interface configuration like costs. -@end deffn - -@deffn {Command} {show ipv6 ospf6 neighbor} {} -Shows state and chosen (Backup) DR of neighbor. -@end deffn - -@deffn {Command} {show ipv6 ospf6 request-list A.B.C.D} {} -Shows requestlist of neighbor. -@end deffn - -@deffn {Command} {show ipv6 route ospf6} {} -This command shows internal routing table. -@end deffn - -@deffn {Command} {show ipv6 ospf6 zebra} {} -Shows state about what is being redistributed between zebra and OSPF6 -@end deffn - -@node OSPF6 Configuration Examples -@section OSPF6 Configuration Examples - -Example of ospf6d configured on one interface and area: - -@example -interface eth0 - ipv6 ospf6 instance-id 0 -! -router ospf6 - router-id 212.17.55.53 - area 0.0.0.0 range 2001:770:105:2::/64 - interface eth0 area 0.0.0.0 -! -@end example diff --git a/doc/ospf_fundamentals.texi b/doc/ospf_fundamentals.texi deleted file mode 100644 index 82218e601..000000000 --- a/doc/ospf_fundamentals.texi +++ /dev/null @@ -1,582 +0,0 @@ -@c Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. -@cindex OSPF Fundamentals -@node OSPF Fundamentals -@section OSPF Fundamentals - -@cindex Link-state routing protocol -@cindex Distance-vector routing protocol -@acronym{OSPF} is, mostly, a link-state routing protocol. In contrast -to @dfn{distance-vector} protocols, such as @acronym{RIP} or -@acronym{BGP}, where routers describe available @dfn{paths} (i.e@. routes) -to each other, in @dfn{link-state} protocols routers instead -describe the state of their links to their immediate neighbouring -routers. - -@cindex Link State Announcement -@cindex Link State Advertisement -@cindex LSA flooding -@cindex Link State DataBase -Each router describes their link-state information in a message known -as an @acronym{LSA,Link State Advertisement}, which is then propogated -through to all other routers in a link-state routing domain, by a -process called @dfn{flooding}. Each router thus builds up an -@acronym{LSDB,Link State Database} of all the link-state messages. From -this collection of LSAs in the LSDB, each router can then calculate the -shortest path to any other router, based on some common metric, by -using an algorithm such as @url{http://www.cs.utexas.edu/users/EWD/, -Edgser Dijkstra}'s @acronym{SPF,Shortest Path First}. - -@cindex Link-state routing protocol advantages -By describing connectivity of a network in this way, in terms of -routers and links rather than in terms of the paths through a network, -a link-state protocol can use less bandwidth and converge more quickly -than other protocols. A link-state protocol need distribute only one -link-state message throughout the link-state domain when a link on any -single given router changes state, in order for all routers to -reconverge on the best paths through the network. In contrast, distance -vector protocols can require a progression of different path update -messages from a series of different routers in order to converge. - -@cindex Link-state routing protocol disadvantages -The disadvantage to a link-state protocol is that the process of -computing the best paths can be relatively intensive when compared to -distance-vector protocols, in which near to no computation need be done -other than (potentially) select between multiple routes. This overhead -is mostly negligible for modern embedded CPUs, even for networks with -thousands of nodes. The primary scaling overhead lies more in coping -with the ever greater frequency of LSA updates as the size of a -link-state area increases, in managing the @acronym{LSDB} and required -flooding. - -This section aims to give a distilled, but accurate, description of the -more important workings of @acronym{OSPF}@ which an administrator may need -to know to be able best configure and trouble-shoot @acronym{OSPF}@. - -@subsection OSPF Mechanisms - -@acronym{OSPF} defines a range of mechanisms, concerned with detecting, -describing and propogating state through a network. These mechanisms -will nearly all be covered in greater detail further on. They may be -broadly classed as: - -@table @dfn -@cindex OSPF Hello Protocol overview -@item The Hello Protocol - -@cindex OSPF Hello Protocol -The OSPF Hello protocol allows OSPF to quickly detect changes in -two-way reachability between routers on a link. OSPF can additionally -avail of other sources of reachability information, such as link-state -information provided by hardware, or through dedicated reachability -protocols such as @acronym{BFD,Bi-directional Forwarding Detection}. - -OSPF also uses the Hello protocol to propagate certain state between -routers sharing a link, for example: - -@itemize @bullet -@item Hello protocol configured state, such as the dead-interval. -@item Router priority, for DR/BDR election. -@item DR/BDR election results. -@item Any optional capabilities supported by each router. -@end itemize - -The Hello protocol is comparatively trivial and will not be explored in -greater detail than here. - -@cindex OSPF LSA overview -@item LSAs - -At the heart of @acronym{OSPF} are @acronym{LSA,Link State -Advertisement} messages. Despite the name, some @acronym{LSA}s do not, -strictly speaking, describe link-state information. Common -@acronym{LSA}s describe information such as: - -@itemize @bullet -@item -Routers, in terms of their links. -@item -Networks, in terms of attached routers. -@item -Routes, external to a link-state domain: - -@itemize @bullet -@item External Routes - -Routes entirely external to @acronym{OSPF}@. Routers originating such -routes are known as @acronym{ASBR,Autonomous-System Border Router} -routers. - -@item Summary Routes - -Routes which summarise routing information relating to OSPF areas -external to the OSPF link-state area at hand, originated by -@acronym{ABR,Area Boundary Router} routers. -@end itemize -@end itemize - -@item LSA Flooding -OSPF defines several related mechanisms, used to manage synchronisation of -@acronym{LSDB}s between neighbours as neighbours form adjacencies and -the propogation, or @dfn{flooding} of new or updated @acronym{LSA}s. - -@xref{OSPF Flooding}. - -@cindex OSPF Areas overview -@item Areas -OSPF provides for the protocol to be broken up into multiple smaller -and independent link-state areas. Each area must be connected to a -common backbone area by an @acronym{ABR,Area Boundary Router}. These -@acronym{ABR} routers are responsible for summarising the link-state -routing information of an area into @dfn{Summary LSAs}, possibly in a -condensed (i.e. aggregated) form, and then originating these summaries -into all other areas the @acronym{ABR} is connected to. - -Note that only summaries and external routes are passed between areas. -As these describe @emph{paths}, rather than any router link-states, -routing between areas hence is by @dfn{distance-vector}, @strong{not} -link-state. - -@xref{OSPF Areas}. -@end table - -@subsection OSPF LSAs - -@acronym{LSA}s are the core object in OSPF@. Everything else in OSPF -revolves around detecting what to describe in LSAs, when to update -them, how to flood them throughout a network and how to calculate -routes from them. - -There are a variety of different @acronym{LSA}s, for purposes such -as describing actual link-state information, describing paths (i.e. -routes), describing bandwidth usage of links for -@acronym{TE,Traffic Engineering} purposes, and even arbitrary data -by way of @emph{Opaque} @acronym{LSA}s. - -@subsubsection LSA Header -All LSAs share a common header with the following information: - -@itemize @bullet -@item Type - -Different types of @acronym{LSA}s describe different things in -@acronym{OSPF}@. Types include: - -@itemize @bullet -@item Router LSA -@item Network LSA -@item Network Summary LSA -@item Router Summary LSA -@item AS-External LSA -@end itemize - -The specifics of the different types of LSA are examined below. - -@item Advertising Router - -The Router ID of the router originating the LSA, see @ref{ospf router-id}. - -@item LSA ID - -The ID of the LSA, which is typically derived in some way from the -information the LSA describes, e.g. a Router LSA uses the Router ID as -the LSA ID, a Network LSA will have the IP address of the @acronym{DR} -as its LSA ID@. - -The combination of the Type, ID and Advertising Router ID must uniquely -identify the @acronym{LSA}@. There can however be multiple instances of -an LSA with the same Type, LSA ID and Advertising Router ID, see -@ref{OSPF LSA sequence number,,LSA Sequence Number}. - -@item Age - -A number to allow stale @acronym{LSA}s to, eventually, be purged by routers -from their @acronym{LSDB}s. - -The value nominally is one of seconds. An age of 3600, i.e. 1 hour, is -called the @dfn{MaxAge}. MaxAge LSAs are ignored in routing -calculations. LSAs must be periodically refreshed by their Advertising -Router before reaching MaxAge if they are to remain valid. - -Routers may deliberately flood LSAs with the age artificially set to -3600 to indicate an LSA is no longer valid. This is called -@dfn{flushing} of an LSA@. - -It is not abnormal to see stale LSAs in the LSDB, this can occur where -a router has shutdown without flushing its LSA(s), e.g. where it has -become disconnected from the network. Such LSAs do little harm. - -@anchor{OSPF LSA sequence number} -@item Sequence Number - -A number used to distinguish newer instances of an LSA from older instances. -@end itemize - -@subsubsection Link-State LSAs -Of all the various kinds of @acronym{LSA}s, just two types comprise the -actual link-state part of @acronym{OSPF}, Router @acronym{LSA}s and -Network @acronym{LSA}s. These LSA types are absolutely core to the -protocol. - -Instances of these LSAs are specific to the link-state area in which -they are originated. Routes calculated from these two LSA types are -called @dfn{intra-area routes}. - -@itemize @bullet -@item Router LSA - -Each OSPF Router must originate a router @acronym{LSA} to describe -itself. In it, the router lists each of its @acronym{OSPF} enabled -interfaces, for the given link-state area, in terms of: - -@itemize @bullet -@item Cost - -The output cost of that interface, scaled inversely to some commonly known -reference value, @xref{OSPF auto-cost reference-bandwidth,,auto-cost -reference-bandwidth}. - -@item Link Type -@itemize @bullet -@item Transit Network - -A link to a multi-access network, on which the router has at least one -Full adjacency with another router. - -@item @acronym{PtP,Point-to-Point} - -A link to a single remote router, with a Full adjacency. No -@acronym{DR, Designated Router} is elected on such links; no network -LSA is originated for such a link. - -@item Stub - -A link with no adjacent neighbours, or a host route. -@end itemize - -@item Link ID and Data - -These values depend on the Link Type: - -@multitable @columnfractions .18 .32 .32 -@headitem Link Type @tab Link ID @tab Link Data - -@item Transit -@tab Link IP address of the @acronym{DR} -@tab Interface IP address - -@item Point-to-Point -@tab Router ID of the remote router -@tab Local interface IP address, -or the @acronym{ifindex,MIB-II interface index} -for unnumbered links - -@item Stub -@tab IP address -@tab Subnet Mask - -@end multitable -@end itemize - -Links on a router may be listed multiple times in the Router LSA, e.g. -a @acronym{PtP} interface on which OSPF is enabled must @emph{always} -be described by a Stub link in the Router @acronym{LSA}, in addition to -being listed as PtP link in the Router @acronym{LSA} if the adjacency -with the remote router is Full. - -Stub links may also be used as a way to describe links on which OSPF is -@emph{not} spoken, known as @dfn{passive interfaces}, see @ref{OSPF -passive-interface,,passive-interface}. - -@item Network LSA - -On multi-access links (e.g. ethernets, certain kinds of ATM and X@.25 -configurations), routers elect a @acronym{DR}@. The @acronym{DR} is -responsible for originating a Network @acronym{LSA}, which helps reduce -the information needed to describe multi-access networks with multiple -routers attached. The @acronym{DR} also acts as a hub for the flooding of -@acronym{LSA}s on that link, thus reducing flooding overheads. - -The contents of the Network LSA describes the: - -@itemize @bullet -@item Subnet Mask - -As the @acronym{LSA} ID of a Network LSA must be the IP address of the -@acronym{DR}, the Subnet Mask together with the @acronym{LSA} ID gives -you the network address. - -@item Attached Routers - -Each router fully-adjacent with the @acronym{DR} is listed in the LSA, -by their Router-ID. This allows the corresponding Router @acronym{LSA}s to be -easily retrieved from the @acronym{LSDB}@. -@end itemize -@end itemize - -Summary of Link State LSAs: - -@multitable @columnfractions .18 .32 .40 -@headitem LSA Type @tab LSA ID Describes @tab LSA Data Describes - -@item Router LSA -@tab The Router ID -@tab The @acronym{OSPF} enabled links of the router, within - a specific link-state area. - -@item Network LSA -@tab The IP address of the @acronym{DR} for the network -@tab The Subnet Mask of the network, and the Router IDs of all routers - on the network. -@end multitable - -With an LSDB composed of just these two types of @acronym{LSA}, it is -possible to construct a directed graph of the connectivity between all -routers and networks in a given OSPF link-state area. So, not -surprisingly, when OSPF routers build updated routing tables, the first -stage of @acronym{SPF} calculation concerns itself only with these two -LSA types. - -@subsubsection Link-State LSA Examples - -The example below (@pxref{OSPF Link-State LSA Example}) shows two -@acronym{LSA}s, both originated by the same router (Router ID -192.168.0.49) and with the same @acronym{LSA} ID (192.168.0.49), but of -different LSA types. - -The first LSA being the router LSA describing 192.168.0.49's links: 2 links -to multi-access networks with fully-adjacent neighbours (i.e. Transit -links) and 1 being a Stub link (no adjacent neighbours). - -The second LSA being a Network LSA, for which 192.168.0.49 is the -@acronym{DR}, listing the Router IDs of 4 routers on that network which -are fully adjacent with 192.168.0.49. - -@anchor{OSPF Link-State LSA Example} -@example -# show ip ospf database router 192.168.0.49 - - OSPF Router with ID (192.168.0.53) - - - Router Link States (Area 0.0.0.0) - - LS age: 38 - Options: 0x2 : *|-|-|-|-|-|E|* - LS Flags: 0x6 - Flags: 0x2 : ASBR - LS Type: router-LSA - Link State ID: 192.168.0.49 - Advertising Router: 192.168.0.49 - LS Seq Number: 80000f90 - Checksum: 0x518b - Length: 60 - Number of Links: 3 - - Link connected to: a Transit Network - (Link ID) Designated Router address: 192.168.1.3 - (Link Data) Router Interface address: 192.168.1.3 - Number of TOS metrics: 0 - TOS 0 Metric: 10 - - Link connected to: a Transit Network - (Link ID) Designated Router address: 192.168.0.49 - (Link Data) Router Interface address: 192.168.0.49 - Number of TOS metrics: 0 - TOS 0 Metric: 10 - - Link connected to: Stub Network - (Link ID) Net: 192.168.3.190 - (Link Data) Network Mask: 255.255.255.255 - Number of TOS metrics: 0 - TOS 0 Metric: 39063 -# show ip ospf database network 192.168.0.49 - - OSPF Router with ID (192.168.0.53) - - - Net Link States (Area 0.0.0.0) - - LS age: 285 - Options: 0x2 : *|-|-|-|-|-|E|* - LS Flags: 0x6 - LS Type: network-LSA - Link State ID: 192.168.0.49 (address of Designated Router) - Advertising Router: 192.168.0.49 - LS Seq Number: 80000074 - Checksum: 0x0103 - Length: 40 - Network Mask: /29 - Attached Router: 192.168.0.49 - Attached Router: 192.168.0.52 - Attached Router: 192.168.0.53 - Attached Router: 192.168.0.54 -@end example - -Note that from one LSA, you can find the other. E.g. Given the -Network-LSA you have a list of Router IDs on that network, from which -you can then look up, in the local @acronym{LSDB}, the matching Router -LSA@. From that Router-LSA you may (potentially) find links to other -Transit networks and Routers IDs which can be used to lookup the -corresponding Router or Network LSA@. And in that fashion, one can find -all the Routers and Networks reachable from that starting @acronym{LSA}@. - -Given the Router LSA instead, you have the IP address of the -@acronym{DR} of any attached transit links. Network LSAs will have that IP -as their LSA ID, so you can then look up that Network LSA and from that -find all the attached routers on that link, leading potentially to more -links and Network and Router LSAs, etc. etc. - -From just the above two @acronym{LSA}s, one can already see the -following partial topology: -@example -@group - - - --------------------- Network: ...... - | Designated Router IP: 192.168.1.3 - | - IP: 192.168.1.3 - (transit link) - (cost: 10) - Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32 - (cost: 10) (cost: 39063) - (transit link) - IP: 192.168.0.49 - | - | ------------------------------- Network: 192.168.0.48/29 - | | | Designated Router IP: 192.168.0.49 - | | | - | | Router ID: 192.168.0.54 - | | - | Router ID: 192.168.0.53 - | -Router ID: 192.168.0.52 -@end group -@end example - -Note the Router IDs, though they look like IP addresses and often are -IP addresses, are not strictly speaking IP addresses, nor need they be -reachable addresses (though, OSPF will calculate routes to Router IDs). - -@subsubsection External LSAs - -External, or "Type 5", @acronym{LSA}s describe routing information which is -entirely external to @acronym{OSPF}, and is "injected" into -@acronym{OSPF}@. Such routing information may have come from another -routing protocol, such as RIP or BGP, they may represent static routes -or they may represent a default route. - -An @acronym{OSPF} router which originates External @acronym{LSA}s is known as an -@acronym{ASBR,AS Boundary Router}. Unlike the link-state @acronym{LSA}s, and -most other @acronym{LSA}s, which are flooded only within the area in -which they originate, External @acronym{LSA}s are flooded through-out -the @acronym{OSPF} network to all areas capable of carrying External -@acronym{LSA}s (@pxref{OSPF Areas}). - -Routes internal to OSPF (intra-area or inter-area) are always preferred -over external routes. - -The External @acronym{LSA} describes the following: - -@itemize @bullet -@item IP Network number - -The IP Network number of the route is described by the @acronym{LSA} ID -field. - -@item IP Network Mask - -The body of the External LSA describes the IP Network Mask of the -route. This, together with the @acronym{LSA} ID, describes the prefix -of the IP route concerned. - -@item Metric - -The cost of the External Route. This cost may be an OSPF cost (also -known as a "Type 1" metric), i.e. equivalent to the normal OSPF costs, -or an externally derived cost ("Type 2" metric) which is not comparable -to OSPF costs and always considered larger than any OSPF cost. Where -there are both Type 1 and 2 External routes for a route, the Type 1 is -always preferred. - -@item Forwarding Address - -The address of the router to forward packets to for the route. This may -be, and usually is, left as 0 to specify that the ASBR originating the -External @acronym{LSA} should be used. There must be an internal OSPF -route to the forwarding address, for the forwarding address to be -useable. - -@item Tag - -An arbitrary 4-bytes of data, not interpreted by OSPF, which may -carry whatever information about the route which OSPF speakers desire. -@end itemize - -@subsubsection AS External LSA Example - -To illustrate, below is an example of an External @acronym{LSA} in the -@acronym{LSDB} of an OSPF router. It describes a route to the IP prefix -of 192.168.165.0/24, originated by the ASBR with Router-ID -192.168.0.49. The metric of 20 is external to OSPF. The forwarding -address is 0, so the route should forward to the originating ASBR if -selected. - -@example -@group -# show ip ospf database external 192.168.165.0 - LS age: 995 - Options: 0x2 : *|-|-|-|-|-|E|* - LS Flags: 0x9 - LS Type: AS-external-LSA - Link State ID: 192.168.165.0 (External Network Number) - Advertising Router: 192.168.0.49 - LS Seq Number: 800001d8 - Checksum: 0xea27 - Length: 36 - Network Mask: /24 - Metric Type: 2 (Larger than any link state path) - TOS: 0 - Metric: 20 - Forward Address: 0.0.0.0 - External Route Tag: 0 -@end group -@end example - -We can add this to our partial topology from above, which now looks -like: -@example -@group - --------------------- Network: ...... - | Designated Router IP: 192.168.1.3 - | - IP: 192.168.1.3 /---- External route: 192.168.165.0/24 - (transit link) / Cost: 20 (External metric) - (cost: 10) / - Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32 - (cost: 10) (cost: 39063) - (transit link) - IP: 192.168.0.49 - | - | ------------------------------- Network: 192.168.0.48/29 - | | | Designated Router IP: 192.168.0.49 - | | | - | | Router ID: 192.168.0.54 - | | - | Router ID: 192.168.0.53 - | -Router ID: 192.168.0.52 -@end group -@end example - -@subsubsection Summary LSAs - -Summary LSAs are created by @acronym{ABR}s to summarise the destinations available within one area to other areas. These LSAs may describe IP networks, potentially in aggregated form, or @acronym{ASBR} routers. - -@anchor{OSPF Flooding} -@subsection OSPF Flooding - -@anchor{OSPF Areas} -@subsection OSPF Areas diff --git a/doc/ospfclient.8.in b/doc/ospfclient.8.in deleted file mode 100644 index a304beffd..000000000 --- a/doc/ospfclient.8.in +++ /dev/null @@ -1,42 +0,0 @@ -.\" This file was originally generated by help2man 1.36. -.TH OSPFCLIENT "8" "July 2010" -.SH NAME -ospfclient \- an example ospf-api client -.SH SYNOPSIS -.B ospfclient -.I ospfd -.I lsatype -.I opaquetype -.I opaqueid -.I ifaddr -.I areaid -.SH DESCRIPTION -.B ospfclient -is a an example ospf-api client to test the ospfd daemon. -.SH OPTIONS -.TP -.I ospfd -A router where the API\-enabled OSPF daemon is running. -.TP -.I lsatype -The value has to be either "9", "10", or "11", depending on the flooding -scope. -.TP -.I opaquetype -The value has to be in the range of 0\-255 (for example, experimental -applications use -.I opaquetype -larger than 128). -.TP -.I opaqueid -Arbitrary application instance (24 bits). -.TP -.I ifaddr -Interface IP address for type 9, otherwise it will be ignored. -.TP -.I areaid -Area in the IP address format for type 10, otherwise it will be ignored. -.SH "SEE ALSO" -.BR ospfd (8). -.SH AUTHORS -See the project homepage at <@PACKAGE_URL@>. diff --git a/doc/ospfd.8.in b/doc/ospfd.8.in deleted file mode 100644 index 6bad77771..000000000 --- a/doc/ospfd.8.in +++ /dev/null @@ -1,121 +0,0 @@ -.TH OSPFD 8 "25 November 2004" "@PACKAGE_FULLNAME@ OSPFv2 daemon" "Version @PACKAGE_VERSION@" -.SH NAME -ospfd \- an OSPFv2 routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B ospfd -[ -.B \-dhlv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B ospfd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B ospfd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/ospfd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When ospfd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart ospfd. The default is \fB\fI@CFG_STATE@/ospfd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the ospfd VTY will listen on. This defaults to -2604, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the ospfd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-a\fR, \fB\-\-apiserver \fR -Enable OSPF apiserver. Default is disabled. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR module may be available for -\fBospfd\fR, if the package was built with SNMP support. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/ospfd -The default location of the -.B ospfd -binary. -.TP -.BI @CFG_SYSCONF@/ospfd.conf -The default location of the -.B ospfd -config file. -.TP -.BI $(PWD)/ospfd.log -If the -.B ospfd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBospfd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The ospfd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBospfd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B ospfd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/ospfd.texi b/doc/ospfd.texi deleted file mode 100644 index 9694be1ef..000000000 --- a/doc/ospfd.texi +++ /dev/null @@ -1,972 +0,0 @@ - -@cindex OSPFv2 -@node OSPFv2 -@chapter OSPFv2 - -@acronym{OSPF,Open Shortest Path First} version 2 is a routing protocol -which is described in @cite{RFC2328, OSPF Version 2}. OSPF is an -@acronym{IGP,Interior Gateway Protocol}. Compared with @acronym{RIP}, -@acronym{OSPF} can provide scalable network support and faster -convergence times. OSPF is widely used in large networks such as -@acronym{ISP,Internet Service Provider} backbone and enterprise -networks. - -@menu -* OSPF Fundamentals:: -* Configuring ospfd:: -* OSPF router:: -* OSPF area:: -* OSPF interface:: -* Redistribute routes to OSPF:: -* Showing OSPF information:: -* Opaque LSA:: -* OSPF Traffic Engineering:: -* Router Information:: -* Segment Routing:: -* Debugging OSPF:: -* OSPF Configuration Examples:: -@end menu - -@include ospf_fundamentals.texi - -@node Configuring ospfd -@section Configuring ospfd - -There are no @command{ospfd} specific options. Common options can be -specified (@pxref{Common Invocation Options}) to @command{ospfd}. -@command{ospfd} needs to acquire interface information from -@command{zebra} in order to function. Therefore @command{zebra} must be -running before invoking @command{ospfd}. Also, if @command{zebra} is -restarted then @command{ospfd} must be too. - -Like other daemons, @command{ospfd} configuration is done in @acronym{OSPF} -specific configuration file @file{ospfd.conf}. - -@node OSPF router -@section OSPF router - -To start OSPF process you have to specify the OSPF router. As of this -writing, @command{ospfd} does not support multiple OSPF processes. - -@deffn Command {router ospf} {} -@deffnx Command {no router ospf} {} -Enable or disable the OSPF process. @command{ospfd} does not yet -support multiple OSPF processes. So you can not specify an OSPF process -number. -@end deffn - -@deffn {OSPF Command} {ospf router-id @var{a.b.c.d}} {} -@deffnx {OSPF Command} {no ospf router-id} {} -@anchor{ospf router-id}This sets the router-ID of the OSPF process. The -router-ID may be an IP address of the router, but need not be - it can -be any arbitrary 32bit number. However it MUST be unique within the -entire OSPF domain to the OSPF speaker - bad things will happen if -multiple OSPF speakers are configured with the same router-ID! If one -is not specified then @command{ospfd} will obtain a router-ID -automatically from @command{zebra}. -@end deffn - -@deffn {OSPF Command} {ospf abr-type @var{type}} {} -@deffnx {OSPF Command} {no ospf abr-type @var{type}} {} -@var{type} can be cisco|ibm|shortcut|standard. The "Cisco" and "IBM" types -are equivalent. - -The OSPF standard for ABR behaviour does not allow an ABR to consider -routes through non-backbone areas when its links to the backbone are -down, even when there are other ABRs in attached non-backbone areas -which still can reach the backbone - this restriction exists primarily -to ensure routing-loops are avoided. - -With the "Cisco" or "IBM" ABR type, the default in this release of -Frr, this restriction is lifted, allowing an ABR to consider -summaries learnt from other ABRs through non-backbone areas, and hence -route via non-backbone areas as a last resort when, and only when, -backbone links are down. - -Note that areas with fully-adjacent virtual-links are considered to be -"transit capable" and can always be used to route backbone traffic, and -hence are unaffected by this setting (@pxref{OSPF virtual-link}). - -More information regarding the behaviour controlled by this command can -be found in @cite{RFC 3509, Alternative Implementations of OSPF Area -Border Routers}, and @cite{draft-ietf-ospf-shortcut-abr-02.txt}. - -Quote: "Though the definition of the @acronym{ABR,Area Border Router} -in the OSPF specification does not require a router with multiple -attached areas to have a backbone connection, it is actually -necessary to provide successful routing to the inter-area and -external destinations. If this requirement is not met, all traffic -destined for the areas not connected to such an ABR or out of the -OSPF domain, is dropped. This document describes alternative ABR -behaviors implemented in Cisco and IBM routers." -@end deffn - -@deffn {OSPF Command} {ospf rfc1583compatibility} {} -@deffnx {OSPF Command} {no ospf rfc1583compatibility} {} -@cite{RFC2328}, the sucessor to @cite{RFC1583}, suggests according -to section G.2 (changes) in section 16.4 a change to the path -preference algorithm that prevents possible routing loops that were -possible in the old version of OSPFv2. More specifically it demands -that inter-area paths and intra-area backbone path are now of equal preference -but still both preferred to external paths. - -This command should NOT be set normally. -@end deffn - -@deffn {OSPF Command} {log-adjacency-changes [detail]} {} -@deffnx {OSPF Command} {no log-adjacency-changes [detail]} {} -Configures ospfd to log changes in adjacency. With the optional -detail argument, all changes in adjacency status are shown. Without detail, -only changes to full or regressions are shown. -@end deffn - -@deffn {OSPF Command} {passive-interface @var{interface}} {} -@deffnx {OSPF Command} {no passive-interface @var{interface}} {} -@anchor{OSPF passive-interface} Do not speak OSPF interface on the -given interface, but do advertise the interface as a stub link in the -router-@acronym{LSA,Link State Advertisement} for this router. This -allows one to advertise addresses on such connected interfaces without -having to originate AS-External/Type-5 LSAs (which have global flooding -scope) - as would occur if connected addresses were redistributed into -OSPF (@pxref{Redistribute routes to OSPF})@. This is the only way to -advertise non-OSPF links into stub areas. -@end deffn - -@deffn {OSPF Command} {timers throttle spf @var{delay} @var{initial-holdtime} @var{max-holdtime}} {} -@deffnx {OSPF Command} {no timers throttle spf} {} -This command sets the initial @var{delay}, the @var{initial-holdtime} -and the @var{maximum-holdtime} between when SPF is calculated and the -event which triggered the calculation. The times are specified in -milliseconds and must be in the range of 0 to 600000 milliseconds. - -The @var{delay} specifies the minimum amount of time to delay SPF -calculation (hence it affects how long SPF calculation is delayed after -an event which occurs outside of the holdtime of any previous SPF -calculation, and also serves as a minimum holdtime). - -Consecutive SPF calculations will always be seperated by at least -'hold-time' milliseconds. The hold-time is adaptive and initially is -set to the @var{initial-holdtime} configured with the above command. -Events which occur within the holdtime of the previous SPF calculation -will cause the holdtime to be increased by @var{initial-holdtime}, bounded -by the @var{maximum-holdtime} configured with this command. If the adaptive -hold-time elapses without any SPF-triggering event occuring then -the current holdtime is reset to the @var{initial-holdtime}. The current -holdtime can be viewed with @ref{show ip ospf}, where it is expressed as -a multiplier of the @var{initial-holdtime}. - -@example -@group -router ospf - timers throttle spf 200 400 10000 -@end group -@end example - -In this example, the @var{delay} is set to 200ms, the @var{initial -holdtime} is set to 400ms and the @var{maximum holdtime} to 10s. Hence -there will always be at least 200ms between an event which requires SPF -calculation and the actual SPF calculation. Further consecutive SPF -calculations will always be seperated by between 400ms to 10s, the -hold-time increasing by 400ms each time an SPF-triggering event occurs -within the hold-time of the previous SPF calculation. - -This command supercedes the @command{timers spf} command in previous Frr -releases. -@end deffn - -@deffn {OSPF Command} {max-metric router-lsa [on-startup|on-shutdown] <5-86400>} {} -@deffnx {OSPF Command} {max-metric router-lsa administrative} {} -@deffnx {OSPF Command} {no max-metric router-lsa [on-startup|on-shutdown|administrative]} {} -This enables @cite{RFC3137, OSPF Stub Router Advertisement} support, -where the OSPF process describes its transit links in its router-LSA as -having infinite distance so that other routers will avoid calculating -transit paths through the router while still being able to reach -networks through the router. - -This support may be enabled administratively (and indefinitely) or -conditionally. Conditional enabling of max-metric router-lsas can be -for a period of seconds after startup and/or for a period of seconds -prior to shutdown. - -Enabling this for a period after startup allows OSPF to converge fully -first without affecting any existing routes used by other routers, -while still allowing any connected stub links and/or redistributed -routes to be reachable. Enabling this for a period of time in advance -of shutdown allows the router to gracefully excuse itself from the OSPF -domain. - -Enabling this feature administratively allows for administrative -intervention for whatever reason, for an indefinite period of time. -Note that if the configuration is written to file, this administrative -form of the stub-router command will also be written to file. If -@command{ospfd} is restarted later, the command will then take effect -until manually deconfigured. - -Configured state of this feature as well as current status, such as the -number of second remaining till on-startup or on-shutdown ends, can be -viewed with the @ref{show ip ospf} command. -@end deffn - -@deffn {OSPF Command} {auto-cost reference-bandwidth <1-4294967>} {} -@deffnx {OSPF Command} {no auto-cost reference-bandwidth} {} -@anchor{OSPF auto-cost reference-bandwidth}This sets the reference -bandwidth for cost calculations, where this bandwidth is considered -equivalent to an OSPF cost of 1, specified in Mbits/s. The default is -100Mbit/s (i.e. a link of bandwidth 100Mbit/s or higher will have a -cost of 1. Cost of lower bandwidth links will be scaled with reference -to this cost). - -This configuration setting MUST be consistent across all routers within the -OSPF domain. -@end deffn - -@deffn {OSPF Command} {network @var{a.b.c.d/m} area @var{a.b.c.d}} {} -@deffnx {OSPF Command} {network @var{a.b.c.d/m} area @var{<0-4294967295>}} {} -@deffnx {OSPF Command} {no network @var{a.b.c.d/m} area @var{a.b.c.d}} {} -@deffnx {OSPF Command} {no network @var{a.b.c.d/m} area @var{<0-4294967295>}} {} -@anchor{OSPF network command} -This command specifies the OSPF enabled interface(s). If the interface has -an address from range 192.168.1.0/24 then the command below enables ospf -on this interface so router can provide network information to the other -ospf routers via this interface. - -@example -@group -router ospf - network 192.168.1.0/24 area 0.0.0.0 -@end group -@end example - -Prefix length in interface must be equal or bigger (ie. smaller network) than -prefix length in network statement. For example statement above doesn't enable -ospf on interface with address 192.168.1.1/23, but it does on interface with -address 192.168.1.129/25. - -Note that the behavior when there is a peer address -defined on an interface changed after release 0.99.7. -Currently, if a peer prefix has been configured, -then we test whether the prefix in the network command contains -the destination prefix. Otherwise, we test whether the network command prefix -contains the local address prefix of the interface. - -In some cases it may be more convenient to enable OSPF on a per -interface/subnet basis (@pxref{OSPF ip ospf area command}). - -@end deffn - -@node OSPF area -@section OSPF area - -@deffn {OSPF Command} {area @var{a.b.c.d} range @var{a.b.c.d/m}} {} -@deffnx {OSPF Command} {area <0-4294967295> range @var{a.b.c.d/m}} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} range @var{a.b.c.d/m}} {} -@deffnx {OSPF Command} {no area <0-4294967295> range @var{a.b.c.d/m}} {} -Summarize intra area paths from specified area into one Type-3 summary-LSA -announced to other areas. This command can be used only in ABR and ONLY -router-LSAs (Type-1) and network-LSAs (Type-2) (ie. LSAs with scope area) can -be summarized. Type-5 AS-external-LSAs can't be summarized - their scope is AS. -Summarizing Type-7 AS-external-LSAs isn't supported yet by Frr. - -@example -@group -router ospf - network 192.168.1.0/24 area 0.0.0.0 - network 10.0.0.0/8 area 0.0.0.10 - area 0.0.0.10 range 10.0.0.0/8 -@end group -@end example - -With configuration above one Type-3 Summary-LSA with routing info 10.0.0.0/8 is -announced into backbone area if area 0.0.0.10 contains at least one intra-area -network (ie. described with router or network LSA) from this range. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} range IPV4_PREFIX not-advertise} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} range IPV4_PREFIX not-advertise} {} -Instead of summarizing intra area paths filter them - ie. intra area paths from this -range are not advertised into other areas. -This command makes sense in ABR only. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} range IPV4_PREFIX substitute IPV4_PREFIX} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} range IPV4_PREFIX substitute IPV4_PREFIX} {} -Substitute summarized prefix with another prefix. - -@example -@group -router ospf - network 192.168.1.0/24 area 0.0.0.0 - network 10.0.0.0/8 area 0.0.0.10 - area 0.0.0.10 range 10.0.0.0/8 substitute 11.0.0.0/8 -@end group -@end example - -One Type-3 summary-LSA with routing info 11.0.0.0/8 is announced into backbone area if -area 0.0.0.10 contains at least one intra-area network (ie. described with router-LSA or -network-LSA) from range 10.0.0.0/8. -This command makes sense in ABR only. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} virtual-link @var{a.b.c.d}} {} -@deffnx {OSPF Command} {area <0-4294967295> virtual-link @var{a.b.c.d}} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} virtual-link @var{a.b.c.d}} {} -@deffnx {OSPF Command} {no area <0-4294967295> virtual-link @var{a.b.c.d}} {} -@anchor{OSPF virtual-link} -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} shortcut} {} -@deffnx {OSPF Command} {area <0-4294967295> shortcut} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} shortcut} {} -@deffnx {OSPF Command} {no area <0-4294967295> shortcut} {} -Configure the area as Shortcut capable. See @cite{RFC3509}. This requires -that the 'abr-type' be set to 'shortcut'. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} stub} {} -@deffnx {OSPF Command} {area <0-4294967295> stub} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} stub} {} -@deffnx {OSPF Command} {no area <0-4294967295> stub} {} -Configure the area to be a stub area. That is, an area where no router -originates routes external to OSPF and hence an area where all external -routes are via the ABR(s). Hence, ABRs for such an area do not need -to pass AS-External LSAs (type-5s) or ASBR-Summary LSAs (type-4) into the -area. They need only pass Network-Summary (type-3) LSAs into such an area, -along with a default-route summary. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} stub no-summary} {} -@deffnx {OSPF Command} {area <0-4294967295> stub no-summary} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} stub no-summary} {} -@deffnx {OSPF Command} {no area <0-4294967295> stub no-summary} {} -Prevents an @command{ospfd} ABR from injecting inter-area -summaries into the specified stub area. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} default-cost <0-16777215>} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} default-cost <0-16777215>} {} -Set the cost of default-summary LSAs announced to stubby areas. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} export-list NAME} {} -@deffnx {OSPF Command} {area <0-4294967295> export-list NAME} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} export-list NAME} {} -@deffnx {OSPF Command} {no area <0-4294967295> export-list NAME} {} -Filter Type-3 summary-LSAs announced to other areas originated from intra- -area paths from specified area. - -@example -@group -router ospf - network 192.168.1.0/24 area 0.0.0.0 - network 10.0.0.0/8 area 0.0.0.10 - area 0.0.0.10 export-list foo -! -access-list foo permit 10.10.0.0/16 -access-list foo deny any -@end group -@end example - -With example above any intra-area paths from area 0.0.0.10 and from range -10.10.0.0/16 (for example 10.10.1.0/24 and 10.10.2.128/30) are announced into -other areas as Type-3 summary-LSA's, but any others (for example 10.11.0.0/16 -or 10.128.30.16/30) aren't. - -This command is only relevant if the router is an ABR for the specified -area. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} import-list NAME} {} -@deffnx {OSPF Command} {area <0-4294967295> import-list NAME} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} import-list NAME} {} -@deffnx {OSPF Command} {no area <0-4294967295> import-list NAME} {} -Same as export-list, but it applies to paths announced into specified area as -Type-3 summary-LSAs. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} filter-list prefix NAME in} {} -@deffnx {OSPF Command} {area @var{a.b.c.d} filter-list prefix NAME out} {} -@deffnx {OSPF Command} {area <0-4294967295> filter-list prefix NAME in} {} -@deffnx {OSPF Command} {area <0-4294967295> filter-list prefix NAME out} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} filter-list prefix NAME in} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} filter-list prefix NAME out} {} -@deffnx {OSPF Command} {no area <0-4294967295> filter-list prefix NAME in} {} -@deffnx {OSPF Command} {no area <0-4294967295> filter-list prefix NAME out} {} -Filtering Type-3 summary-LSAs to/from area using prefix lists. This command -makes sense in ABR only. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} authentication} {} -@deffnx {OSPF Command} {area <0-4294967295> authentication} {} -@deffnx {OSPF Command} {no area @var{a.b.c.d} authentication} {} -@deffnx {OSPF Command} {no area <0-4294967295> authentication} {} -Specify that simple password authentication should be used for the given -area. -@end deffn - -@deffn {OSPF Command} {area @var{a.b.c.d} authentication message-digest} {} -@deffnx {OSPF Command} {area <0-4294967295> authentication message-digest} {} - -@anchor{area authentication message-digest}Specify that OSPF packets -must be authenticated with MD5 HMACs within the given area. Keying -material must also be configured on a per-interface basis (@pxref{ip -ospf message-digest-key}). - -MD5 authentication may also be configured on a per-interface basis -(@pxref{ip ospf authentication message-digest}). Such per-interface -settings will override any per-area authentication setting. -@end deffn - -@node OSPF interface -@section OSPF interface - -@deffn {Interface Command} {ip ospf area @var{AREA} [@var{ADDR}]} {} -@deffnx {Interface Command} {no ip ospf area [@var{ADDR}]} {} -@anchor{OSPF ip ospf area command} - -Enable OSPF on the interface, optionally restricted to just the IP address -given by @var{ADDR}, putting it in the @var{AREA} area. Per interface area -settings take precedence to network commands (@pxref{OSPF network command}). - -If you have a lot of interfaces, and/or a lot of subnets, then enabling OSPF -via this command may result in a slight performance improvement. - -@end deffn - -@deffn {Interface Command} {ip ospf authentication-key @var{AUTH_KEY}} {} -@deffnx {Interface Command} {no ip ospf authentication-key} {} -Set OSPF authentication key to a simple password. After setting @var{AUTH_KEY}, -all OSPF packets are authenticated. @var{AUTH_KEY} has length up to 8 chars. - -Simple text password authentication is insecure and deprecated in favour of -MD5 HMAC authentication (@pxref{ip ospf authentication message-digest}). -@end deffn - -@deffn {Interface Command} {ip ospf authentication message-digest} {} -@anchor{ip ospf authentication message-digest}Specify that MD5 HMAC -authentication must be used on this interface. MD5 keying material must -also be configured (@pxref{ip ospf message-digest-key}). Overrides any -authentication enabled on a per-area basis (@pxref{area -authentication message-digest}). - -Note that OSPF MD5 authentication requires that time never go backwards -(correct time is NOT important, only that it never goes backwards), even -across resets, if ospfd is to be able to promptly reestabish adjacencies -with its neighbours after restarts/reboots. The host should have system -time be set at boot from an external or non-volatile source (eg battery backed clock, NTP, -etc.) or else the system clock should be periodically saved to non-volative -storage and restored at boot if MD5 authentication is to be expected to work -reliably. -@end deffn - -@deffn {Interface Command} {ip ospf message-digest-key KEYID md5 KEY} {} -@deffnx {Interface Command} {no ip ospf message-digest-key} {} -@anchor{ip ospf message-digest-key}Set OSPF authentication key to a -cryptographic password. The cryptographic algorithm is MD5. - -KEYID identifies secret key used to create the message digest. This ID -is part of the protocol and must be consistent across routers on a -link. - -KEY is the actual message digest key, of up to 16 chars (larger strings -will be truncated), and is associated with the given KEYID. -@end deffn - -@deffn {Interface Command} {ip ospf cost <1-65535>} {} -@deffnx {Interface Command} {no ip ospf cost} {} -Set link cost for the specified interface. The cost value is set to router-LSA's -metric field and used for SPF calculation. -@end deffn - -@deffn {Interface Command} {ip ospf dead-interval <1-65535>} {} -@deffnx {Interface Command} {ip ospf dead-interval minimal hello-multiplier <2-20>} {} -@deffnx {Interface Command} {no ip ospf dead-interval} {} -@anchor{ip ospf dead-interval minimal} Set number of seconds for -RouterDeadInterval timer value used for Wait Timer and Inactivity -Timer. This value must be the same for all routers attached to a -common network. The default value is 40 seconds. - -If 'minimal' is specified instead, then the dead-interval is set to 1 -second and one must specify a hello-multiplier. The hello-multiplier -specifies how many Hellos to send per second, from 2 (every 500ms) to -20 (every 50ms). Thus one can have 1s convergence time for OSPF. If this form -is specified, then the hello-interval advertised in Hello packets is set to -0 and the hello-interval on received Hello packets is not checked, thus -the hello-multiplier need NOT be the same across multiple routers on a common -link. -@end deffn - -@deffn {Interface Command} {ip ospf hello-interval <1-65535>} {} -@deffnx {Interface Command} {no ip ospf hello-interval} {} -Set number of seconds for HelloInterval timer value. Setting this value, -Hello packet will be sent every timer value seconds on the specified interface. -This value must be the same for all routers attached to a common network. -The default value is 10 seconds. - -This command has no effect if @ref{ip ospf dead-interval minimal} is also -specified for the interface. -@end deffn - -@deffn {Interface Command} {ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)} {} -@deffnx {Interface Command} {no ip ospf network} {} -Set explicitly network type for specifed interface. -@end deffn - -@deffn {Interface Command} {ip ospf priority <0-255>} {} -@deffnx {Interface Command} {no ip ospf priority} {} -Set RouterPriority integer value. The router with the highest priority -will be more eligible to become Designated Router. Setting the value -to 0, makes the router ineligible to become Designated Router. The -default value is 1. -@end deffn - -@deffn {Interface Command} {ip ospf retransmit-interval <1-65535>} {} -@deffnx {Interface Command} {no ip ospf retransmit interval} {} -Set number of seconds for RxmtInterval timer value. This value is used -when retransmitting Database Description and Link State Request packets. -The default value is 5 seconds. -@end deffn - -@deffn {Interface Command} {ip ospf transmit-delay} {} -@deffnx {Interface Command} {no ip ospf transmit-delay} {} -Set number of seconds for InfTransDelay value. LSAs' age should be -incremented by this value when transmitting. -The default value is 1 seconds. -@end deffn - -@deffn {Interface Command} {ip ospf area (A.B.C.D|<0-4294967295>)} {} -@deffnx {Interface Command} {no ip ospf area} {} -Enable ospf on an interface and set associated area. -@end deffn - -@node Redistribute routes to OSPF -@section Redistribute routes to OSPF - -@deffn {OSPF Command} {redistribute (kernel|connected|static|rip|bgp)} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) @var{route-map}} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map @var{word}} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map @var{word}} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>} {} -@deffnx {OSPF Command} {redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map @var{word}} {} -@deffnx {OSPF Command} {no redistribute (kernel|connected|static|rip|bgp)} {} -@anchor{OSPF redistribute}Redistribute routes of the specified protocol -or kind into OSPF, with the metric type and metric set if specified, -filtering the routes using the given route-map if specified. -Redistributed routes may also be filtered with distribute-lists, see -@ref{ospf distribute-list}. - -Redistributed routes are distributed as into OSPF as Type-5 External -LSAs into links to areas that accept external routes, Type-7 External LSAs -for NSSA areas and are not redistributed at all into Stub areas, where -external routes are not permitted. - -Note that for connected routes, one may instead use -@dfn{passive-interface}, see @ref{OSPF passive-interface}. -@end deffn - -@deffn {OSPF Command} {default-information originate} {} -@deffnx {OSPF Command} {default-information originate metric <0-16777214>} {} -@deffnx {OSPF Command} {default-information originate metric <0-16777214> metric-type (1|2)} {} -@deffnx {OSPF Command} {default-information originate metric <0-16777214> metric-type (1|2) route-map @var{word}} {} -@deffnx {OSPF Command} {default-information originate always} {} -@deffnx {OSPF Command} {default-information originate always metric <0-16777214>} {} -@deffnx {OSPF Command} {default-information originate always metric <0-16777214> metric-type (1|2)} {} -@deffnx {OSPF Command} {default-information originate always metric <0-16777214> metric-type (1|2) route-map @var{word}} {} -@deffnx {OSPF Command} {no default-information originate} {} -Originate an AS-External (type-5) LSA describing a default route into -all external-routing capable areas, of the specified metric and metric -type. If the 'always' keyword is given then the default is always -advertised, even when there is no default present in the routing table. -@end deffn - -@deffn {OSPF Command} {distribute-list NAME out (kernel|connected|static|rip|ospf} {} -@deffnx {OSPF Command} {no distribute-list NAME out (kernel|connected|static|rip|ospf} {} -@anchor{ospf distribute-list}Apply the access-list filter, NAME, to -redistributed routes of the given type before allowing the routes to -redistributed into OSPF (@pxref{OSPF redistribute}). -@end deffn - -@deffn {OSPF Command} {default-metric <0-16777214>} {} -@deffnx {OSPF Command} {no default-metric} {} -@end deffn - -@deffn {OSPF Command} {distance <1-255>} {} -@deffnx {OSPF Command} {no distance <1-255>} {} -@end deffn - -@deffn {OSPF Command} {distance ospf (intra-area|inter-area|external) <1-255>} {} -@deffnx {OSPF Command} {no distance ospf} {} -@end deffn - -@deffn {Command} {router zebra} {} -@deffnx {Command} {no router zebra} {} -@end deffn - -@node Showing OSPF information -@section Showing OSPF information - -@deffn {Command} {show ip ospf} {} -@anchor{show ip ospf}Show information on a variety of general OSPF and -area state and configuration information. -@end deffn - -@deffn {Command} {show ip ospf interface [INTERFACE]} {} -Show state and configuration of OSPF the specified interface, or all -interfaces if no interface is given. -@end deffn - -@deffn {Command} {show ip ospf neighbor} {} -@deffnx {Command} {show ip ospf neighbor INTERFACE} {} -@deffnx {Command} {show ip ospf neighbor detail} {} -@deffnx {Command} {show ip ospf neighbor INTERFACE detail} {} -@end deffn - -@deffn {Command} {show ip ospf database} {} -@end deffn - -@deffn {Command} {show ip ospf database (asbr-summary|external|network|router|summary)} {} -@deffnx {Command} {show ip ospf database (asbr-summary|external|network|router|summary) @var{link-state-id}} {} -@deffnx {Command} {show ip ospf database (asbr-summary|external|network|router|summary) @var{link-state-id} adv-router @var{adv-router}} {} -@deffnx {Command} {show ip ospf database (asbr-summary|external|network|router|summary) adv-router @var{adv-router}} {} -@deffnx {Command} {show ip ospf database (asbr-summary|external|network|router|summary) @var{link-state-id} self-originate} {} -@deffnx {Command} {show ip ospf database (asbr-summary|external|network|router|summary) self-originate} {} -@end deffn - -@deffn {Command} {show ip ospf database max-age} {} -@end deffn - -@deffn {Command} {show ip ospf database self-originate} {} -@end deffn - -@deffn {Command} {show ip ospf route} {} -Show the OSPF routing table, as determined by the most recent SPF calculation. -@end deffn - -@node Opaque LSA -@section Opaque LSA - -@deffn {OSPF Command} {ospf opaque-lsa} {} -@deffnx {OSPF Command} {capability opaque} {} -@deffnx {OSPF Command} {no ospf opaque-lsa} {} -@deffnx {OSPF Command} {no capability opaque} {} -@command{ospfd} support Opaque LSA (RFC2370) as fondment for MPLS Traffic Engineering LSA. Prior to used MPLS TE, opaque-lsa must be enable in the configuration file. Alternate command could be "mpls-te on" (@ref{OSPF Traffic Engineering}). -@end deffn - -@deffn {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external)} {} -@deffnx {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external) @var{link-state-id}} {} -@deffnx {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external) @var{link-state-id} adv-router @var{adv-router}} {} -@deffnx {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external) adv-router @var{adv-router}} {} -@deffnx {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external) @var{link-state-id} self-originate} {} -@deffnx {Command} {show ip ospf database (opaque-link|opaque-area|opaque-external) self-originate} {} -Show Opaque LSA from the database. -@end deffn - -@node OSPF Traffic Engineering -@section Traffic Engineering - -@deffn {OSPF Command} {mpls-te on} {} -@deffnx {OSPF Command} {no mpls-te} {} -Enable Traffic Engineering LSA flooding. -@end deffn - -@deffn {OSPF Command} {mpls-te router-address <A.B.C.D>} {} -@deffnx {OSPF Command} {no mpls-te} {} -Configure stable IP address for MPLS-TE. This IP address is then advertise in Opaque LSA Type-10 TLV=1 (TE) -option 1 (Router-Address). -@end deffn - -@deffn {OSPF Command} {mpls-te inter-as area <area-id>|as} {} -@deffnx {OSPF Command} {no mpls-te inter-as} {} -Enable RFC5392 suuport - Inter-AS TE v2 - to flood Traffic Engineering parameters of Inter-AS link. -2 modes are supported: AREA and AS; LSA are flood in AREA <area-id> with Opaque Type-10, -respectively in AS with Opaque Type-11. In all case, Opaque-LSA TLV=6. -@end deffn - -@deffn {Command} {show ip ospf mpls-te interface} {} -@deffnx {Command} {show ip ospf mpls-te interface @var{interface}} {} -Show MPLS Traffic Engineering parameters for all or specified interface. -@end deffn - -@deffn {Command} {show ip ospf mpls-te router} {} -Show Traffic Engineering router parameters. -@end deffn - -@node Router Information -@section Router Information - -@deffn {OSPF Command} {router-info [as | area <A.B.C.D>]} {} -@deffnx {OSPF Command} {no router-info} {} -Enable Router Information (RFC4970) LSA advertisement with AS scope (default) or Area scope flooding -when area is specified. -@end deffn - -@deffn {OSPF Command} {pce address <A.B.C.D>} {} -@deffnx {OSPF Command} {no pce address} {} -@deffnx {OSPF Command} {pce domain as <0-65535>} {} -@deffnx {OSPF Command} {no pce domain as <0-65535>} {} -@deffnx {OSPF Command} {pce neighbor as <0-65535>} {} -@deffnx {OSPF Command} {no pce neighbor as <0-65535>} {} -@deffnx {OSPF Command} {pce flag BITPATTERN} {} -@deffnx {OSPF Command} {no pce flag} {} -@deffnx {OSPF Command} {pce scope BITPATTERN} {} -@deffnx {OSPF Command} {no pce scope} {} -The commands are conform to RFC 5088 and allow OSPF router announce Path Compuatation Elemenent (PCE) capabilities -through the Router Information (RI) LSA. Router Information must be enable prior to this. The command set/unset -respectively the PCE IP adress, Autonomous System (AS) numbers of controlled domains, neighbor ASs, flag and scope. -For flag and scope, please refer to RFC5088 for the BITPATTERN recognition. Multiple 'pce neighbor' command could -be specified in order to specify all PCE neighbours. -@end deffn - -@deffn {Command} {show ip ospf router-info} {} -Show Router Capabilities flag. -@end deffn -@deffn {Command} {show ip ospf router-info pce} {} -Show Router Capabilities PCE parameters. -@end deffn - -@node Segment Routing -@section Segment Routing - -This is an EXPERIMENTAL support of Segment Routing as per draft - draft-ietf-ospf-segment-routing-extensions-24.txt for MPLS dataplane. - -@deffn {OSPF Command} {segment-routing on} {} -@deffnx {OSPF Command} {no segment-routing} {} -Enable Segment Routing. Even if this also activate routing information support, -it is preferable to also activate routing information, and set accordingly the -Area or AS flooding. -@end deffn - -@deffn {OSPF Command} {segment-routing global-block (0-1048575) (0-1048575)} {} -@deffnx {OSPF Command} {no segment-routing global-block} {} -Fix the Segment Routing Global Block i.e. the label range used by MPLS to store -label in the MPLS FIB. -@end deffn - -@deffn {OSPF Command} {segment-routing node-msd (1-16)} {} -@deffnx {OSPF Command} {no segment-routing node-msd} {} -Fix the Maximum Stack Depth supported by the router. The value depend of the -MPLS dataplane. E.g. for Linux kernel, since version 4.13 it is 32. -@end deffn - -@deffn {OSPF Command} {segment-routing prefix A.B.C.D/M index (0-65535)} {} -@deffnx {OSPF Command} {segment-routing prefix A.B.C.D/M index (0-65535) no-php-flag} {} -@deffnx {OSPF Command} {no segment-routing prefix A.B.C.D/M} {} -Set the Segment Rounting index for the specifyed prefix. Note -that, only prefix with /32 corresponding to a loopback interface are -currently supported. The 'no-php-flag' means NO Penultimate Hop Popping that -allows SR node to request to its neighbor to not pop the label. -@end deffn - -@deffn {Command} {show ip ospf database segment-routing [json]} {} -@deffnx {Command} {show ip ospf database segment-routing adv-router @var{adv-router} [json]} {} -@deffnx {Command} {show ip ospf database segment-routing self-originate [json]} {} -Show Segment Routing Data Base, all SR nodes, specific advertized router or self router. -Optional Json output could be obtain by adding 'json' at the end of the command. -@end deffn - -@node Debugging OSPF -@section Debugging OSPF - -@deffn {Command} {debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail]} {} -@deffnx {Command} {no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail]} {} -Dump Packet for debugging -@end deffn - -@deffn {Command} {debug ospf ism} {} -@deffnx {Command} {debug ospf ism (status|events|timers)} {} -@deffnx {Command} {no debug ospf ism} {} -@deffnx {Command} {no debug ospf ism (status|events|timers)} {} -Show debug information of Interface State Machine -@end deffn - -@deffn {Command} {debug ospf nsm} {} -@deffnx {Command} {debug ospf nsm (status|events|timers)} {} -@deffnx {Command} {no debug ospf nsm} {} -@deffnx {Command} {no debug ospf nsm (status|events|timers)} {} -Show debug information of Network State Machine -@end deffn - -@deffn {Command} {debug ospf event} {} -@deffnx {Command} {no debug ospf event} {} -Show debug information of OSPF event -@end deffn - -@deffn {Command} {debug ospf nssa} {} -@deffnx {Command} {no debug ospf nssa} {} -Show debug information about Not So Stub Area -@end deffn - -@deffn {Command} {debug ospf lsa} {} -@deffnx {Command} {debug ospf lsa (generate|flooding|refresh)} {} -@deffnx {Command} {no debug ospf lsa} {} -@deffnx {Command} {no debug ospf lsa (generate|flooding|refresh)} {} -Show debug detail of Link State messages -@end deffn - -@deffn {Command} {debug ospf te} {} -@deffnx {Command} {no debug ospf te} {} -Show debug information about Traffic Engineering LSA -@end deffn - -@deffn {Command} {debug ospf zebra} {} -@deffnx {Command} {debug ospf zebra (interface|redistribute)} {} -@deffnx {Command} {no debug ospf zebra} {} -@deffnx {Command} {no debug ospf zebra (interface|redistribute)} {} -Show debug information of ZEBRA API -@end deffn - -@deffn {Command} {show debugging ospf} {} -@end deffn - -@node OSPF Configuration Examples -@section OSPF Configuration Examples -A simple example, with MD5 authentication enabled: - -@example -@group -! -interface bge0 - ip ospf authentication message-digest - ip ospf message-digest-key 1 md5 ABCDEFGHIJK -! -router ospf - network 192.168.0.0/16 area 0.0.0.1 - area 0.0.0.1 authentication message-digest -@end group -@end example - -An @acronym{ABR} router, with MD5 authentication and performing summarisation -of networks between the areas: - -@example -@group -! -password ABCDEF -log file /var/log/frr/ospfd.log -service advanced-vty -! -interface eth0 - ip ospf authentication message-digest - ip ospf message-digest-key 1 md5 ABCDEFGHIJK -! -interface ppp0 -! -interface br0 - ip ospf authentication message-digest - ip ospf message-digest-key 2 md5 XYZ12345 -! -router ospf - ospf router-id 192.168.0.1 - redistribute connected - passive interface ppp0 - network 192.168.0.0/24 area 0.0.0.0 - network 10.0.0.0/16 area 0.0.0.0 - network 192.168.1.0/24 area 0.0.0.1 - area 0.0.0.0 authentication message-digest - area 0.0.0.0 range 10.0.0.0/16 - area 0.0.0.0 range 192.168.0.0/24 - area 0.0.0.1 authentication message-digest - area 0.0.0.1 range 10.2.0.0/16 -! -@end group -@end example - -A Traffic Engineering configuration, with Inter-ASv2 support. - - - First, the 'zebra.conf' part: - -@example -@group -hostname HOSTNAME -password PASSWORD -log file /var/log/zebra.log -! -interface eth0 - ip address 198.168.1.1/24 - link-params - enable - admin-grp 0xa1 - metric 100 - max-bw 1.25e+07 - max-rsv-bw 1.25e+06 - unrsv-bw 0 1.25e+06 - unrsv-bw 1 1.25e+06 - unrsv-bw 2 1.25e+06 - unrsv-bw 3 1.25e+06 - unrsv-bw 4 1.25e+06 - unrsv-bw 5 1.25e+06 - unrsv-bw 6 1.25e+06 - unrsv-bw 7 1.25e+06 -! -interface eth1 - ip address 192.168.2.1/24 - link-params - enable - metric 10 - max-bw 1.25e+07 - max-rsv-bw 1.25e+06 - unrsv-bw 0 1.25e+06 - unrsv-bw 1 1.25e+06 - unrsv-bw 2 1.25e+06 - unrsv-bw 3 1.25e+06 - unrsv-bw 4 1.25e+06 - unrsv-bw 5 1.25e+06 - unrsv-bw 6 1.25e+06 - unrsv-bw 7 1.25e+06 - neighbor 192.168.2.2 as 65000 -@end group -@end example - - - Then the 'ospfd.conf' itself: - -@example -@group -hostname HOSTNAME -password PASSWORD -log file /var/log/ospfd.log -! -! -interface eth0 - ip ospf hello-interval 60 - ip ospf dead-interval 240 -! -interface eth1 - ip ospf hello-interval 60 - ip ospf dead-interval 240 -! -! -router ospf - ospf router-id 192.168.1.1 - network 192.168.0.0/16 area 1 - ospf opaque-lsa - mpls-te - mpls-te router-address 192.168.1.1 - mpls-te inter-as area 1 -! -line vty -@end group -@end example - -A router information example with PCE advsertisement: - -@example -@group -! -router ospf - ospf router-id 192.168.1.1 - network 192.168.0.0/16 area 1 - capability opaque - mpls-te - mpls-te router-address 192.168.1.1 - router-info area 0.0.0.1 - pce address 192.168.1.1 - pce flag 0x80 - pce domain as 65400 - pce neighbor as 65500 - pce neighbor as 65200 - pce scope 0x80 -! -@end group -@end example diff --git a/doc/overview.texi b/doc/overview.texi deleted file mode 100644 index c988e219b..000000000 --- a/doc/overview.texi +++ /dev/null @@ -1,337 +0,0 @@ -@node Overview -@chapter Overview -@cindex Overview - - @uref{@value{PACKAGE_URL},,Frr} is a routing software package that -provides TCP/IP based routing services with routing protocols support such -as RIPv1, RIPv2, RIPng, OSPFv2, OSPFv3, IS-IS, BGP-4, and BGP-4+ (@pxref{Supported -RFCs}). Frr also supports special BGP Route Reflector and Route Server -behavior. In addition to traditional IPv4 routing protocols, Frr also -supports IPv6 routing protocols. With SNMP daemon which supports SMUX and AgentX -protocol, Frr provides routing protocol MIBs (@pxref{SNMP Support}). - - Frr uses an advanced software architecture to provide you with a high -quality, multi server routing engine. Frr has an interactive user -interface for each routing protocol and supports common client commands. -Due to this design, you can add new protocol daemons to Frr easily. You -can use Frr library as your program's client user interface. - - Frr is distributed under the @sc{gnu} General Public License. - -@menu -* About Frr:: Basic information about Frr -* System Architecture:: The Frr system architecture -* Supported Platforms:: Supported platforms and future plans -* Supported RFCs:: Supported RFCs -* How to get Frr:: -* Mailing List:: Mailing list information -* Bug Reports:: Mail address for bug data -@end menu - -@node About Frr -@comment node-name, next, previous, up -@section About Frr -@cindex About Frr - - Today, TCP/IP networks are covering all of the world. The Internet has -been deployed in many countries, companies, and to the home. When you -connect to the Internet your packet will pass many routers which have TCP/IP -routing functionality. - - A system with Frr installed acts as a dedicated router. With Frr, -your machine exchanges routing information with other routers using routing -protocols. Frr uses this information to update the kernel routing table -so that the right data goes to the right place. You can dynamically change -the configuration and you may view routing table information from the Frr -terminal interface. - - Adding to routing protocol support, Frr can setup interface's flags, -interface's address, static routes and so on. If you have a small network, -or a stub network, or xDSL connection, configuring the Frr routing -software is very easy. The only thing you have to do is to set up the -interfaces and put a few commands about static routes and/or default routes. -If the network is rather large, or if the network structure changes -frequently, you will want to take advantage of Frr's dynamic routing -protocol support for protocols such as RIP, OSPF, IS-IS or BGP. - - Traditionally, UNIX based router configuration is done by -@command{ifconfig} and @command{route} commands. Status of routing -table is displayed by @command{netstat} utility. Almost of these commands -work only if the user has root privileges. Frr has a different system -administration method. There are two user modes in Frr. One is normal -mode, the other is enable mode. Normal mode user can only view system -status, enable mode user can change system configuration. This UNIX account -independent feature will be great help to the router administrator. - - Currently, Frr supports common unicast routing protocols, that is BGP, -OSPF, RIP and IS-IS. Upcoming for MPLS support, an implementation of LDP is -currently being prepared for merging. Implementations of BFD and PIM-SSM -(IPv4) also exist, but are not actively being worked on. - - The ultimate goal of the Frr project is making a productive, quality, free -TCP/IP routing software package. - -@node System Architecture -@comment node-name, next, previous, up -@section System Architecture -@cindex System architecture -@cindex Software architecture -@cindex Software internals - - Traditional routing software is made as a one process program which -provides all of the routing protocol functionalities. Frr takes a -different approach. It is made from a collection of several daemons that -work together to build the routing table. There may be several -protocol-specific routing daemons and zebra the kernel routing manager. - - The @command{ripd} daemon handles the RIP protocol, while -@command{ospfd} is a daemon which supports OSPF version 2. -@command{bgpd} supports the BGP-4 protocol. For changing the kernel -routing table and for redistribution of routes between different routing -protocols, there is a kernel routing table manager @command{zebra} daemon. -It is easy to add a new routing protocol daemons to the entire routing -system without affecting any other software. You need to run only the -protocol daemon associated with routing protocols in use. Thus, user may -run a specific daemon and send routing reports to a central routing console. - - There is no need for these daemons to be running on the same machine. You -can even run several same protocol daemons on the same machine. This -architecture creates new possibilities for the routing system. - -@example -@group -+----+ +----+ +-----+ +-----+ -|bgpd| |ripd| |ospfd| |zebra| -+----+ +----+ +-----+ +-----+ - | -+---------------------------|--+ -| v | -| UNIX Kernel routing table | -| | -+------------------------------+ - - Frr System Architecture -@end group -@end example - -Multi-process architecture brings extensibility, modularity and -maintainability. At the same time it also brings many configuration files -and terminal interfaces. Each daemon has it's own configuration file and -terminal interface. When you configure a static route, it must be done in -@command{zebra} configuration file. When you configure BGP network it must -be done in @command{bgpd} configuration file. This can be a very annoying -thing. To resolve the problem, Frr provides integrated user interface -shell called @command{vtysh}. @command{vtysh} connects to each daemon with -UNIX domain socket and then works as a proxy for user input. - -Frr was planned to use multi-threaded mechanism when it runs with a -kernel that supports multi-threads. But at the moment, the thread library -which comes with @sc{gnu}/Linux or FreeBSD has some problems with running -reliable services such as routing software, so we don't use threads at all. -Instead we use the @command{select(2)} system call for multiplexing the -events. - -@node Supported Platforms -@comment node-name, next, previous, up -@section Supported Platforms - -@cindex Supported platforms -@cindex Frr on other systems -@cindex Compatibility with other systems -@cindex Operating systems that support Frr - -Currently Frr supports @sc{gnu}/Linux and BSD. Porting Frr -to other platforms is not too difficult as platform dependent code should -most be limited to the @command{zebra} daemon. Protocol daemons are mostly -platform independent. Please let us know when you find out Frr runs on a -platform which is not listed below. - -The list of officially supported platforms are listed below. Note that -Frr may run correctly on other platforms, and may run with partial -functionality on further platforms. - -@sp 1 -@itemize @bullet -@item -@sc{gnu}/Linux -@item -FreeBSD -@item -NetBSD -@item -OpenBSD -@end itemize - -Versions of these platforms that are older than around 2 years from the point -of their original release (in case of @sc{gnu}/Linux, this is since the kernel's -release on kernel.org) may need some work. Similarly, the following platforms -may work with some effort: - -@sp 1 -@itemize @bullet -@item -Solaris -@item -Mac OSX -@end itemize - -Also note that, in particular regarding proprietary platforms, compiler -and C library choice will affect Frr. Only recent versions of the -following C compilers are well-tested: - -@sp 1 -@itemize @bullet -@item -@sc{gnu}'s GCC -@item -LLVM's clang -@item -Intel's ICC -@end itemize - -@node Supported RFCs -@comment node-name, next, previous, up -@section Supported RFCs - - Below is the list of currently supported RFC's. - -@table @asis -@item @asis{RFC1058} -@cite{Routing Information Protocol. C.L. Hedrick. Jun-01-1988.} - -@item @asis{RF2082} -@cite{RIP-2 MD5 Authentication. F. Baker, R. Atkinson. January 1997.} - -@item @asis{RFC2453} -@cite{RIP Version 2. G. Malkin. November 1998.} - -@item @asis{RFC2080} -@cite{RIPng for IPv6. G. Malkin, R. Minnear. January 1997.} - -@item @asis{RFC2328} -@cite{OSPF Version 2. J. Moy. April 1998.} - -@item @asis{RFC2370} -@cite{The OSPF Opaque LSA Option R. Coltun. July 1998.} - -@item @asis{RFC3101} -@cite{The OSPF Not-So-Stubby Area (NSSA) Option P. Murphy. January 2003.} - -@item @asis{RFC2740} -@cite{OSPF for IPv6. R. Coltun, D. Ferguson, J. Moy. December 1999.} - -@item @asis{RFC1771} -@cite{A Border Gateway Protocol 4 (BGP-4). Y. Rekhter & T. Li. March 1995.} - -@item @asis{RFC1965} -@cite{Autonomous System Confederations for BGP. P. Traina. June 1996.} - -@item @asis{RFC1997} -@cite{BGP Communities Attribute. R. Chandra, P. Traina & T. Li. August 1996.} - -@item @asis{RFC2545} -@cite{Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing. P. Marques, F. Dupont. March 1999.} - -@item @asis{RFC2796} -@cite{BGP Route Reflection An alternative to full mesh IBGP. T. Bates & R. Chandrasekeran. June 1996.} - -@item @asis{RFC2858} -@cite{Multiprotocol Extensions for BGP-4. T. Bates, Y. Rekhter, R. Chandra, D. Katz. June 2000.} - -@item @asis{RFC2842} -@cite{Capabilities Advertisement with BGP-4. R. Chandra, J. Scudder. May 2000.} - -@item @asis{RFC3137} -@cite{OSPF Stub Router Advertisement, A. Retana, L. Nguyen, R. White, A. Zinin, D. McPherson. June 2001} -@end table - - When SNMP support is enabled, below RFC is also supported. - -@table @asis - -@item @asis{RFC1227} -@cite{SNMP MUX protocol and MIB. M.T. Rose. May-01-1991.} - -@item @asis{RFC1657} -@cite{Definitions of Managed Objects for the Fourth Version of the -Border Gateway Protocol (BGP-4) using SMIv2. S. Willis, J. Burruss, -J. Chu, Editor. July 1994.} - -@item @asis{RFC1724} -@cite{RIP Version 2 MIB Extension. G. Malkin & F. Baker. November 1994.} - -@item @asis{RFC1850} -@cite{OSPF Version 2 Management Information Base. F. Baker, R. Coltun. -November 1995.} - -@item @asis{RFC2741} -@cite{Agent Extensibility (AgentX) Protocol. M. Daniele, B. Wijnen. January 2000.} - -@end table - -@node How to get Frr -@comment node-name, next, previous, up -@section How to get Frr - -The official Frr web-site is located at: - -@uref{@value{PACKAGE_URL}} - -and contains further information, as well as links to additional -resources. - -@uref{@value{PACKAGE_URL},Frr} is a fork of Quagga, whose -web-site is located at: - -@uref{http://www.quagga.net/}. - -@node Mailing List -@comment node-name, next, previous, up -@section Mailing List -@cindex How to get in touch with Frr -@cindex Mailing Frr -@cindex Contact information -@cindex Mailing lists - -There is a mailing list for discussions about Frr. If you have any -comments or suggestions to Frr, please subscribe to: - -@uref{https://lists.frrouting.org/listinfo/frog}. - -The @uref{@value{PACKAGE_URL},,Frr} site has further information on -the available mailing lists, see: - - @uref{https://lists.frrouting.org/} - -@node Bug Reports -@section Bug Reports - -@cindex Bug Reports -@cindex Bug hunting -@cindex Found a bug? -@cindex Reporting bugs -@cindex Reporting software errors -@cindex Errors in the software - -If you think you have found a bug, please send a bug report to: - -@uref{http://github.com/frrouting/frr/issues} - -When you send a bug report, please be careful about the points below. - -@itemize @bullet -@item -Please note what kind of OS you are using. If you use the IPv6 stack -please note that as well. -@item -Please show us the results of @code{netstat -rn} and @code{ifconfig -a}. -Information from zebra's VTY command @code{show ip route} will also be -helpful. -@item -Please send your configuration file with the report. If you specify -arguments to the configure script please note that too. -@end itemize - - Bug reports are very important for us to improve the quality of Frr. -Frr is still in the development stage, but please don't hesitate to -send a bug report to @uref{http://github.com/frrouting/frr/issues}. diff --git a/doc/pimd.8.in b/doc/pimd.8.in deleted file mode 100644 index 6db3418f8..000000000 --- a/doc/pimd.8.in +++ /dev/null @@ -1,135 +0,0 @@ -.TH PIM 8 "10 December 2008" "@PACKAGE_FULLNAME@ PIM daemon" "Version @PACKAGE_VERSION@" -.SH NAME -pimd \- a PIM routing for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B pimd -[ -.B \-dhvZ -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-z -.I path -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B pimd -is a protocol-independent multicast component that works with the -.B @PACKAGE_FULLNAME@ -Routing Suite. -.SH OPTIONS -Options available for the -.B pimd -command: -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/pimd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When pimd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart pimd. The default is \fB\fI@CFG_STATE@/pimd.pid\fR. -.TP -\fB\-z\fR, \fB\-\-socket \fR\fIpath\fR -Specify the socket path for contacting the zebra daemon. -The default is \fB\fI@CFG_STATE@/zserv.api\fR. The value of this option -must be the same as the one given when starting zebra. Refer to the \fBzebra -(8)\fR man page for more information. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the pimd VTY will listen on. This defaults to -2611, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the pimd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -There are currently no such modules for -\fBpimd\fR in the base package. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.TP -\fB\-Z\fR, \fB\-\-debug_zclient\fR -Enable logging information for zclient debugging. -.SH FILES -.TP -.BI @CFG_SBIN@/pimd -The default location of the -.B pimd -binary. -.TP -.BI @CFG_SYSCONF@/pimd.conf -The default location of the -.B pimd -config file. -.TP -.BI @CFG_STATE@/pimd.pid -The default location of the -.B pimd -pid file. -.TP -.BI @CFG_STATE@/zserv.api -The default location of the -.B zebra -unix socket file. -.TP -.BI $(PWD)/pimd.log -If the -.B pimd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBpimd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. -.SH DIAGNOSTICS -The pimd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. -.SH "SEE ALSO" -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -\fBpimd\fR is in early development at the moment and is not ready for -production use. - -.B pimd -eats bugs for breakfast. If you have food for the maintainers try -.BI https://github.com/udhos/qpimd -.SH AUTHORS -See -.BI https://github.com/udhos/qpimd -for an accurate list of authors. - diff --git a/doc/pimd.texi b/doc/pimd.texi deleted file mode 100644 index 30e85afbb..000000000 --- a/doc/pimd.texi +++ /dev/null @@ -1,366 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node PIM -@chapter PIM - -PIM -- Protocol Independent Multicast - -@command{pimd} supports pim-sm as well as igmp v2 and v3. pim is -vrf aware and can work within the context of vrf's in order to -do S,G mrouting. - -@menu -* Starting and Stopping pimd:: -* PIM Configuration:: -* PIM Interface Configuration:: -* PIM Multicast RIB insertion:: -* Show PIM Information:: -* PIM Debug Commands:: -@end menu - -@node Starting and Stopping pimd -@section Starting and Stopping pimd - -The default configuration file name of @command{pimd}'s is -@file{pimd.conf}. When invocation @command{pimd} searches directory -@value{INSTALL_PREFIX_ETC}. If @file{pimd.conf} is not there -then next search current directory. - -@command{pimd} requires zebra for proper operation. Additionally -@command{pimd} depends on routing properly setup and working -in the network that it is working on. - -@example -@group -# zebra -d -# pimd -d -@end group -@end example - -Please note that @command{zebra} must be invoked before @command{pimd}. - -To stop @command{pimd}. Please use @command{kill `cat -/var/run/pimd.pid`}. Certain signals have special meanings to @command{pimd}. - -@table @samp -@item SIGUSR1 -Rotate @command{pimd} logfile. -@item SIGINT -@itemx SIGTERM -@command{pimd} sweeps all installed PIM mroutes then terminates properly. -@end table - -@command{pimd} invocation options. Common options that can be specified -(@pxref{Common Invocation Options}). - -@node PIM Configuration - -@deffn Command {ip pim rp A.B.C.D A.B.C.D/M} {} -In order to use pim, it is necessary to configure a RP for join -messages to be sent to. Currently the only methodology to -do this is via static rp commands. All routers in the -pim network must agree on these values. The first ip address -is the RP's address and the second value is the matching -prefix of group ranges covered. This command is vrf aware, -to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim spt-switchover infinity-and-beyond} {} -On the last hop router if it is desired to not switch over -to the SPT tree. Configure this command. This command is -vrf aware, to configure for a vrf, enter the vrf submode. -#end deffn - -@deffn Comand {ip pim ecmp} {} -If pim has the a choice of ECMP nexthops for a particular -RPF, pim will cause S,G flows to be spread out amongst -the nexthops. If this command is not specified then -the first nexthop found will be used. This command -is vrf aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim ecmp rebalance} {} -If pim is using ECMP and an interface goes down, cause -pim to rebalance all S,G flows aross the remaining -nexthops. If this command is not configured pim only -modifies those S,G flows that were using the interface -that went down. This command is vrf aware, to configure -for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim join-prune-interval (60-600)} {} -Modify the join/prune interval that pim uses to the -new value. Time is specified in seconds. This command -is vrf aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim keep-alive-timer (31-60000)} {} -Modify the time out value for a S,G flow from 31-60000 -seconds. 31 seconds is choosen for a lower bound -because some hardware platforms cannot see data flowing -in better than 30 second chunks. This comand is vrf -aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim packets (1-100)} {} -When processing packets from a neighbor process the -number of packets incoming at one time before moving -on to the next task. The default value is 3 packets. -This command is only useful at scale when you can -possibly have a large number of pim control packets -flowing. This command is vrf aware, to configure for -a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim register-suppress-time (5-60000)} {} -Modify the time that pim will register suppress a FHR -will send register notifications to the kernel. This command -is vrf aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim send-v6-secondary} {} -When sending pim hello packets tell pim to send -any v6 secondary addresses on the interface. This -information is used to allow pim to use v6 nexthops -in it's decision for RPF lookup. This command -is vrf aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip pim ssm prefix-list WORD} {} -Specify a range of group addresses via a prefix-list -that forces pim to never do SM over. This command -is vrf aware, to configure for a vrf, enter the vrf submode. -@end deffn - -@deffn Command {ip multicast rpf-lookup-mode WORD} {} -Modify how PIM does RPF lookups in the zebra routing table. -You can use these choices: -@table @lookup_modes -@item longer-prefix -Lookup the RPF in both tables using the longer prefix as a match -@item lower-distance -Lookup the RPF in both tables using the lower distance as a match -@item mrib-only -Lookup in the Multicast RIB only -@item mrib-then-urib -Lookup in the Multicast RIB then the Unicast Rib, returning first found. -This is the default value for lookup if this command is not entered -@item urib-only -Lookup in the Unicast Rib only. -@end table -@end deffn - -@node PIM Interface Configuration -@section PIM Interface Configuration - -PIM interface commands allow you to configure an -interface as either a Receiver or a interface -that you would like to form pim neighbors on. If the -interface is in a vrf, enter the interface command with -the vrf keyword at the end. - -@deffn {PIM Interface Command] {ip pim bfd} {} -Turns on BFD support for PIM for this interface. -@end deffn - -@deffn {PIM Interface Command} {ip pim drpriority (1-4294967295)} {} -Set the DR Priority for the interface. This command is useful -to allow the user to influence what node becomes the DR for a -lan segment. -@end deffn - -@deffn {PIM Interface Command} {ip pim hello (1-180) (1-180)} {} -Set the pim hello and hold interval for a interface. -@end deffn - -@deffn {PIM Interface Command} {ip pim sm} {} -Tell pim that we would like to use this interface to form -pim neighbors over. Please note we will *not* accept -igmp reports over this interface with this command. -@end deffn - -@deffn {PIM Interface Command} {ip igmp} {} -Tell pim to receive IGMP reports and Query on this -interface. The default version is v3. This command -is useful on the LHR. -@end deffn - -@deffn {PIM Interface Command} {ip igmp query-interval (1-1800)} {} -Set the IGMP query interval that PIM will use. -@end deffn - -@deffn {PIM Interface Command} {ip igmp query-max-response-time (10-250)} {} -Set the IGMP query response timeout value. If an report is not returned -in the specified time we will assume the S,G or *,G has timed out. -@end deffn - -@deffn {PIM Interface Command} {ip igmp version (2-3)} {} -Set the IGMP version used on this interface. The default value -is 3. -@end deffn - -@deffn {PIM Interface Command} {ip multicat boundary oil WORD} {} -Set a pim multicast boundary, based upon the WORD prefix-list. If -a pim join or IGMP report is received on this interface and the Group -is denyed by the prefix-list, PIM will ignore the join or report. -@end deffn - -@node PIM Multicast RIB insertion:: -@section PIM Multicast RIB insertion:: - -In order to influence Multicast RPF lookup, it is possible to insert -into zebra routes for the Multicast RIB. These routes are only -used for RPF lookup and will not be used by zebra for insertion -into the kernel *or* for normal rib processing. As such it is -possible to create weird states with these commands. Use with -caution. Most of the time this will not be necessary. - -@deffn {PIM Multicast RIB insertion} {ip mroute A.B.C.D/M A.B.C.D (1-255)} {} -Insert into the Multicast Rib Route A.B.C.D/M with specified nexthop. The distance can be specified as well if desired. -@end deffn - -@deffn {PIM Multicast RIB insertion} {ip mroute A.B.C.D/M INTERFACE (1-255)} {} -Insert into the Multicast Rib Route A.B.C.D/M using the specified INTERFACE. -The distance can be specified as well if desired. -@end deffn - -@node Show PIM Information:: -@section Show PIM Information - -All PIM show commands are vrf aware and typically allow you to insert -a specified vrf command if information is desired about a specific vrf. -If no vrf is specified then the default vrf is assumed. Finally -the special keyword 'all' allows you to look at all vrfs for the command. -Naming a vrf 'all' will cause great confusion. - -@deffn {Show PIM Information} {show ip multicast} -Display various information about the interfaces used in this pim -instance. -@end deffn - -@deffn {Show PIM Information} {show ip mroute} -Display information about installed into the kernel S,G mroutes. -@end deffn - -@deffn {Show PIM Information} {show ip mroute count} -Display information about installed into the kernel S,G mroutes -and in addition display data about packet flow for the mroutes. -@end deffn - -@deffn {Show PIM Information} {show ip pim assert} -Display information about asserts in the PIM system for S,G mroutes. -@end deffn - -@deffn {Show PIM Information} {show ip pim assert-internal} -Display internal assert state for S,G mroutes -@end deffn - -@deffn {Show PIM Information} {show ip pim assert-metric} -Display metric information about assert state for S,G mroutes -@end deffn - -@deffn {Show PIM Information} {show ip pim assert-winner-metric} -Display winner metric for assert state for S,G mroutes -@end deffn - -@deffn {Show PIM Information} {show ip pim group-type} -Display SSM group ranges -@end deffn - -@deffn {Show PIM Information} {show ip pim interface} -Display information about interfaces PIM is using. -@end deffn - -@deffn {Show PIM Information} {show ip pim join} -Display information about PIM joins received. -@end deffn - -@deffn {Show PIM Information} {show ip pim local-membership} {} -Display information about PIM interface local-membership -@end deffn - -@deffn {Show PIM Information} {show ip pim neighbor} {} -Display information about PIM neighbors -@end deffn - -@deffn {Show PIM Information} {show ip pim nexthop} {} -Display information about pim nexthops that are being -used -@end deffn - -@deffn {Show PIM Information} {show ip pim nexthop-lookup} {} -Display information about a S,G pair and how the RPF would -be choosen. This is especially useful if there are ECMP's -available from the RPF lookup. -@end deffn - -@deffn {Show PIM Information} {show ip pim rp-info} {} -Display information about RP's that are configured on -this router -@end deffn - -@deffn {Show PIM Information} {show ip pim rpf} {} -Display information about currently being used S,G's -and their RPF lookup information. Additionally display -some statistics about what has been happening on the -router -@end deffn - -@deffn {show PIM Information} {show ip pim secondary} {} -Display information about an interface and all the -secondary addresses associated with it -@end deffn - -@deffn {show PIM Information} {show ip pim state} {} -Display information about known S,G's and incoming -interface as well as the OIL and how they were choosen -@end deffn - -@deffn {show PIM Information} {show ip pim upstream} {} -Display upstream information about a S,G mroute -@end deffn - -@deffn {show PIM Information} {show ip pim upstream-join-desired} {} -Display upstream information for S,G's and if we desire to -join the mcast tree -@end deffn - -@deffn {show PIM Information} {show ip pim upstream-rpf} {} -Display upstream information for S,G's and the RPF data -associated with them -@end deffn - -@deffn {show PIM Information} {show ip rpf} {} -Display the multicast RIB created in zebra -@end deffn - -@node PIM Debug Commands -@section PIM Debug Commands - -The debugging subsystem for PIM behaves in accordance with how FRR handles debugging. You can specify debugging at the enable cli mode as well as the configure cli mode. If you specify debug commands in the configuration cli mode, the debug commands can be persistent across restarts of the FRR pimd if the config was written out. - -@deffn {PIM Debug Commands} {debug pim events} -This turns on debugging for PIM system events. Especially timers. -@end deffn - -@deffn {PIM Debug Commands} {debug pim nht} -This turns on debugging for PIM nexthop tracking. It will display information about RPF lookups and information about when a nexthop changes. -@end deffn - -@deffn {PIM Debug Commands} {debug pim packet-dump} -This turns on an extraordinary amount of data. Each pim packet sent and received is dumped for debugging purposes. This should be considered a developer only command -@end deffn - -@deffn {PIM Debug Commands} {debug pim packets} -This turns on information about packet generation for sending and about packet handling from a received packet -@end deffn - -@deffn {PIM Debug Commands} {debug pim trace} -This traces pim code and how it is running. -@end deffn - -@deffn {PIM Debug Commands} {debug pim zebra} -This gathers data about events from zebra that come up through the zapi -@end deffn diff --git a/doc/protocol.texi b/doc/protocol.texi deleted file mode 100644 index 7e8a96dc5..000000000 --- a/doc/protocol.texi +++ /dev/null @@ -1,115 +0,0 @@ -@node Zebra Protocol -@appendix Zebra Protocol -@appendixsection Overview of the Zebra Protocol - -Zebra Protocol is used by protocol daemons to communicate with the -zebra daemon. - -Each protocol daemon may request and send information to and from the -zebra daemon such as interface states, routing state, -nexthop-validation, and so on. Protocol daemons may also install routes -with zebra. The zebra daemon manages which route is installed into the -forwarding table with the kernel. - -Zebra Protocol is a streaming protocol, with a common header. Two -versions of the header are in use. Version 0 is implicitely versioned. -Version 1 has an explicit version field. Version 0 can be distinguished -from all other versions by examining the 3rd byte of the header, which -contains a marker value for all versions bar version 0. The marker byte -corresponds to the command field in version 0, and the marker value is -a reserved command in version 0. - -We do not anticipate there will be further versions of the header for -the foreseeable future, as the command field in version 1 is wide -enough to allow for future extensions to done compatibly through -seperate commands. - -Version 0 is used by all versions of GNU Zebra as of this writing, and -versions of Quagga up to and including Quagga 0.98. Version 2 was created -for 0.99.21 of Quagga. Version 3 designates VRF compatibility and was -released in 1.0. Version 4 will be used as of Frr 2.0 to indicate that -we are a different Routing Suite now and to hopefully prevent accidental -Quagga <-> FRR issues. - -@appendixsection Zebra Protocol Definition -@appendixsubsec Zebra Protocol Header (version 0) -@example -@group -0 1 2 3 -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-------------------------------+---------------+ -| Length (2) | Command (1) | -+-------------------------------+---------------+ -@end group -@end example - -@appendixsubsec Zebra Protocol Common Header (version 1) -@example -@group -0 1 2 3 -0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 -+-------------------------------+---------------+-------------+ -| Length (2) | Marker (1) | Version (1) | -+-------------------------------+---------------+-------------+ -| Command (2) | -+-------------------------------+ -@end group -@end example - -@appendixsubsec Zebra Protocol Header Field Definitions -@table @samp -@item Length -Total packet length including this header. The minimum length is 3 -bytes for version 0 messages and 6 bytes for version 1 messages. - -@item Marker -Static marker with a value of 255 always. This is to allow version 0 -Zserv headers (which do not include version explicitely) to be -distinguished from versioned headers. Not present in version 0 -messages. - -@item Version -Version number of the Zserv message. Clients should not continue -processing messages past the version field for versions they do not -recognise. Not present in version 0 messages. - -@item Command -The Zebra Protocol command. -@end table - -@appendixsubsec Zebra Protocol Commands -@multitable {ZEBRA_REDISTRIBUTE_DEFAULT_DELETE_WHATEVER} {99999} -@headitem Command @tab Value -@item ZEBRA_INTERFACE_ADD -@tab 1 -@item ZEBRA_INTERFACE_DELETE -@tab 2 -@item ZEBRA_INTERFACE_ADDRESS_ADD -@tab 3 -@item ZEBRA_INTERFACE_ADDRESS_DELETE -@tab 4 -@item ZEBRA_INTERFACE_UP -@tab 5 -@item ZEBRA_INTERFACE_DOWN -@tab 6 -@item ZEBRA_IPV4_ROUTE_ADD -@tab 7 -@item ZEBRA_IPV4_ROUTE_DELETE -@tab 8 -@item ZEBRA_IPV6_ROUTE_ADD -@tab 9 -@item ZEBRA_IPV6_ROUTE_DELETE -@tab 10 -@item ZEBRA_REDISTRIBUTE_ADD -@tab 11 -@item ZEBRA_REDISTRIBUTE_DELETE -@tab 12 -@item ZEBRA_REDISTRIBUTE_DEFAULT_ADD -@tab 13 -@item ZEBRA_REDISTRIBUTE_DEFAULT_DELETE -@tab 14 -@item ZEBRA_IPV4_NEXTHOP_LOOKUP -@tab 15 -@item ZEBRA_IPV6_NEXTHOP_LOOKUP -@tab 16 -@end multitable diff --git a/doc/ripd.8.in b/doc/ripd.8.in deleted file mode 100644 index a84668e6d..000000000 --- a/doc/ripd.8.in +++ /dev/null @@ -1,121 +0,0 @@ -.TH RIPD 8 "25 November 2004" "@PACKAGE_FULLNAME@ RIP daemon" "Version @PACKAGE_VERSION@" -.SH NAME -ripd \- a RIP routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B ripd -[ -.B \-dhrv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B ripd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B ripd -command: -.SH OPTIONS -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/ripd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When ripd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart ripd. The default is \fB\fI@CFG_STATE@/ripd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the ripd VTY will listen on. This defaults to -2602, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the ripd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-r\fR, \fB\-\-retain\fR -When the program terminates, retain routes added by \fBripd\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR module may be available for -\fBripd\fR, if the package was built with SNMP support. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/ripd -The default location of the -.B ripd -binary. -.TP -.BI @CFG_SYSCONF@/ripd.conf -The default location of the -.B ripd -config file. -.TP -.BI $(PWD)/ripd.log -If the -.B ripd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBripd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The ripd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBripd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B ripd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. diff --git a/doc/ripd.texi b/doc/ripd.texi deleted file mode 100644 index da0f596af..000000000 --- a/doc/ripd.texi +++ /dev/null @@ -1,623 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node RIP -@chapter RIP - -RIP -- Routing Information Protocol is widely deployed interior gateway -protocol. RIP was developed in the 1970s at Xerox Labs as part of the -XNS routing protocol. RIP is a @dfn{distance-vector} protocol and is -based on the @dfn{Bellman-Ford} algorithms. As a distance-vector -protocol, RIP router send updates to its neighbors periodically, thus -allowing the convergence to a known topology. In each update, the -distance to any given network will be broadcasted to its neighboring -router. - -@command{ripd} supports RIP version 2 as described in RFC2453 and RIP -version 1 as described in RFC1058. - -@menu -* Starting and Stopping ripd:: -* RIP Configuration:: -* RIP Version Control:: -* How to Announce RIP route:: -* Filtering RIP Routes:: -* RIP Metric Manipulation:: -* RIP distance:: -* RIP route-map:: -* RIP Authentication:: -* RIP Timers:: -* Show RIP Information:: -* RIP Debug Commands:: -@end menu - -@node Starting and Stopping ripd -@section Starting and Stopping ripd - -The default configuration file name of @command{ripd}'s is -@file{ripd.conf}. When invocation @command{ripd} searches directory -@value{INSTALL_PREFIX_ETC}. If @file{ripd.conf} is not there next -search current directory. - -RIP uses UDP port 520 to send and receive RIP packets. So the user must have -the capability to bind the port, generally this means that the user must -have superuser privileges. RIP protocol requires interface information -maintained by @command{zebra} daemon. So running @command{zebra} -is mandatory to run @command{ripd}. Thus minimum sequence for running -RIP is like below: - -@example -@group -# zebra -d -# ripd -d -@end group -@end example - -Please note that @command{zebra} must be invoked before @command{ripd}. - -To stop @command{ripd}. Please use @command{kill `cat -/var/run/ripd.pid`}. Certain signals have special meaningss to @command{ripd}. - -@table @samp -@item SIGHUP -Reload configuration file @file{ripd.conf}. All configurations are -reseted. All routes learned so far are cleared and removed from routing -table. -@item SIGUSR1 -Rotate @command{ripd} logfile. -@item SIGINT -@itemx SIGTERM -@command{ripd} sweeps all installed RIP routes then terminates properly. -@end table - -@command{ripd} invocation options. Common options that can be specified -(@pxref{Common Invocation Options}). - -@table @samp -@item -r -@itemx --retain -When the program terminates, retain routes added by @command{ripd}. -@end table - -@menu -* RIP netmask:: -@end menu - -@node RIP netmask -@subsection RIP netmask - -The netmask features of @command{ripd} support both version 1 and version 2 of -RIP. Version 1 of RIP originally contained no netmask information. In -RIP version 1, network classes were originally used to determine the -size of the netmask. Class A networks use 8 bits of mask, Class B -networks use 16 bits of masks, while Class C networks use 24 bits of -mask. Today, the most widely used method of a network mask is assigned -to the packet on the basis of the interface that received the packet. -Version 2 of RIP supports a variable length subnet mask (VLSM). By -extending the subnet mask, the mask can be divided and reused. Each -subnet can be used for different purposes such as large to middle size -LANs and WAN links. Frr @command{ripd} does not support the non-sequential -netmasks that are included in RIP Version 2. - -In a case of similar information with the same prefix and metric, the -old information will be suppressed. Ripd does not currently support -equal cost multipath routing. - - -@node RIP Configuration -@section RIP Configuration - -@deffn Command {router rip} {} -The @code{router rip} command is necessary to enable RIP. To disable -RIP, use the @code{no router rip} command. RIP must be enabled before -carrying out any of the RIP commands. -@end deffn - -@deffn Command {no router rip} {} -Disable RIP. -@end deffn - -@deffn {RIP Command} {network @var{network}} {} -@deffnx {RIP Command} {no network @var{network}} {} -Set the RIP enable interface by @var{network}. The interfaces which -have addresses matching with @var{network} are enabled. - -This group of commands either enables or disables RIP interfaces between -certain numbers of a specified network address. For example, if the -network for 10.0.0.0/24 is RIP enabled, this would result in all the -addresses from 10.0.0.0 to 10.0.0.255 being enabled for RIP. The @code{no -network} command will disable RIP for the specified network. -@end deffn - -@deffn {RIP Command} {network @var{ifname}} {} -@deffnx {RIP Command} {no network @var{ifname}} {} -Set a RIP enabled interface by @var{ifname}. Both the sending and -receiving of RIP packets will be enabled on the port specified in the -@code{network ifname} command. The @code{no network ifname} command will disable -RIP on the specified interface. -@end deffn - -@deffn {RIP Command} {neighbor @var{a.b.c.d}} {} -@deffnx {RIP Command} {no neighbor @var{a.b.c.d}} {} -Specify RIP neighbor. When a neighbor doesn't understand multicast, -this command is used to specify neighbors. In some cases, not all -routers will be able to understand multicasting, where packets are sent -to a network or a group of addresses. In a situation where a neighbor -cannot process multicast packets, it is necessary to establish a direct -link between routers. The neighbor command allows the network -administrator to specify a router as a RIP neighbor. The @code{no -neighbor a.b.c.d} command will disable the RIP neighbor. -@end deffn - -Below is very simple RIP configuration. Interface @code{eth0} and -interface which address match to @code{10.0.0.0/8} are RIP enabled. - -@example -@group -! -router rip - network 10.0.0.0/8 - network eth0 -! -@end group -@end example - -Passive interface - -@deffn {RIP command} {passive-interface (@var{IFNAME}|default)} {} -@deffnx {RIP command} {no passive-interface @var{IFNAME}} {} -This command sets the specified interface to passive mode. On passive mode -interface, all receiving packets are processed as normal and ripd does -not send either multicast or unicast RIP packets except to RIP neighbors -specified with @code{neighbor} command. The interface may be specified -as @var{default} to make ripd default to passive on all interfaces. - -The default is to be passive on all interfaces. -@end deffn - -RIP split-horizon - -@deffn {Interface command} {ip split-horizon} {} -@deffnx {Interface command} {no ip split-horizon} {} -Control split-horizon on the interface. Default is @code{ip -split-horizon}. If you don't perform split-horizon on the interface, -please specify @code{no ip split-horizon}. -@end deffn - -@node RIP Version Control -@section RIP Version Control - -RIP can be configured to send either Version 1 or Version 2 packets. -The default is to send RIPv2 while accepting both RIPv1 and RIPv2 (and -replying with packets of the appropriate version for REQUESTS / -triggered updates). The version to receive and send can be specified -globally, and further overriden on a per-interface basis if needs be -for send and receive seperately (see below). - -It is important to note that RIPv1 can not be authenticated. Further, -if RIPv1 is enabled then RIP will reply to REQUEST packets, sending the -state of its RIP routing table to any remote routers that ask on -demand. For a more detailed discussion on the security implications of -RIPv1 see @ref{RIP Authentication}. - -@deffn {RIP Command} {version @var{version}} {} -Set RIP version to accept for reads and send. @var{version} -can be either `1'' or `2''. - -Disabling RIPv1 by specifying version 2 is STRONGLY encouraged, -@xref{RIP Authentication}. This may become the default in a future -release. - -Default: Send Version 2, and accept either version. -@end deffn - -@deffn {RIP Command} {no version} {} -Reset the global version setting back to the default. -@end deffn - -@deffn {Interface command} {ip rip send version @var{version}} {} -@var{version} can be `1', `2' or `1 2'. - -This interface command overrides the global rip version setting, and -selects which version of RIP to send packets with, for this interface -specifically. Choice of RIP Version 1, RIP Version 2, or both versions. -In the latter case, where `1 2' is specified, packets will be both -broadcast and multicast. - -Default: Send packets according to the global version (version 2) -@end deffn - -@deffn {Interface command} {ip rip receive version @var{version}} {} -@var{version} can be `1', `2' or `1 2'. - -This interface command overrides the global rip version setting, and -selects which versions of RIP packets will be accepted on this -interface. Choice of RIP Version 1, RIP Version 2, or both. - -Default: Accept packets according to the global setting (both 1 and 2). -@end deffn - -@node How to Announce RIP route -@section How to Announce RIP route - -@deffn {RIP command} {redistribute kernel} {} -@deffnx {RIP command} {redistribute kernel metric <0-16>} {} -@deffnx {RIP command} {redistribute kernel route-map @var{route-map}} {} -@deffnx {RIP command} {no redistribute kernel} {} -@code{redistribute kernel} redistributes routing information from -kernel route entries into the RIP tables. @code{no redistribute kernel} -disables the routes. -@end deffn - -@deffn {RIP command} {redistribute static} {} -@deffnx {RIP command} {redistribute static metric <0-16>} {} -@deffnx {RIP command} {redistribute static route-map @var{route-map}} {} -@deffnx {RIP command} {no redistribute static} {} -@code{redistribute static} redistributes routing information from -static route entries into the RIP tables. @code{no redistribute static} -disables the routes. -@end deffn - -@deffn {RIP command} {redistribute connected} {} -@deffnx {RIP command} {redistribute connected metric <0-16>} {} -@deffnx {RIP command} {redistribute connected route-map @var{route-map}} {} -@deffnx {RIP command} {no redistribute connected} {} -Redistribute connected routes into the RIP tables. @code{no -redistribute connected} disables the connected routes in the RIP tables. -This command redistribute connected of the interface which RIP disabled. -The connected route on RIP enabled interface is announced by default. -@end deffn - -@deffn {RIP command} {redistribute ospf} {} -@deffnx {RIP command} {redistribute ospf metric <0-16>} {} -@deffnx {RIP command} {redistribute ospf route-map @var{route-map}} {} -@deffnx {RIP command} {no redistribute ospf} {} -@code{redistribute ospf} redistributes routing information from -ospf route entries into the RIP tables. @code{no redistribute ospf} -disables the routes. -@end deffn - -@deffn {RIP command} {redistribute bgp} {} -@deffnx {RIP command} {redistribute bgp metric <0-16>} {} -@deffnx {RIP command} {redistribute bgp route-map @var{route-map}} {} -@deffnx {RIP command} {no redistribute bgp} {} -@code{redistribute bgp} redistributes routing information from -bgp route entries into the RIP tables. @code{no redistribute bgp} -disables the routes. -@end deffn - -If you want to specify RIP only static routes: - -@deffn {RIP command} {default-information originate} {} -@end deffn - -@deffn {RIP command} {route @var{a.b.c.d/m}} {} -@deffnx {RIP command} {no route @var{a.b.c.d/m}} {} -This command is specific to Frr. The @code{route} command makes a static -route only inside RIP. This command should be used only by advanced -users who are particularly knowledgeable about the RIP protocol. In -most cases, we recommend creating a static route in Frr and -redistributing it in RIP using @code{redistribute static}. -@end deffn - -@node Filtering RIP Routes -@section Filtering RIP Routes - -RIP routes can be filtered by a distribute-list. - -@deffn Command {distribute-list @var{access_list} @var{direct} @var{ifname}} {} -You can apply access lists to the interface with a @code{distribute-list} -command. @var{access_list} is the access list name. @var{direct} is -@samp{in} or @samp{out}. If @var{direct} is @samp{in} the access list -is applied to input packets. - -The @code{distribute-list} command can be used to filter the RIP path. -@code{distribute-list} can apply access-lists to a chosen interface. -First, one should specify the access-list. Next, the name of the -access-list is used in the distribute-list command. For example, in the -following configuration @samp{eth0} will permit only the paths that -match the route 10.0.0.0/8 - -@example -@group -! -router rip - distribute-list private in eth0 -! -access-list private permit 10 10.0.0.0/8 -access-list private deny any -! -@end group -@end example -@end deffn - -@code{distribute-list} can be applied to both incoming and outgoing data. - -@deffn Command {distribute-list prefix @var{prefix_list} (in|out) @var{ifname}} {} -You can apply prefix lists to the interface with a -@code{distribute-list} command. @var{prefix_list} is the prefix list -name. Next is the direction of @samp{in} or @samp{out}. If -@var{direct} is @samp{in} the access list is applied to input packets. -@end deffn - -@node RIP Metric Manipulation -@section RIP Metric Manipulation - -RIP metric is a value for distance for the network. Usually -@command{ripd} increment the metric when the network information is -received. Redistributed routes' metric is set to 1. - -@deffn {RIP command} {default-metric <1-16>} {} -@deffnx {RIP command} {no default-metric <1-16>} {} -This command modifies the default metric value for redistributed routes. The -default value is 1. This command does not affect connected route -even if it is redistributed by @command{redistribute connected}. To modify -connected route's metric value, please use @command{redistribute -connected metric} or @command{route-map}. @command{offset-list} also -affects connected routes. -@end deffn - -@deffn {RIP command} {offset-list @var{access-list} (in|out)} {} -@deffnx {RIP command} {offset-list @var{access-list} (in|out) @var{ifname}} {} -@end deffn - -@node RIP distance -@section RIP distance - -Distance value is used in zebra daemon. Default RIP distance is 120. - -@deffn {RIP command} {distance <1-255>} {} -@deffnx {RIP command} {no distance <1-255>} {} -Set default RIP distance to specified value. -@end deffn - -@deffn {RIP command} {distance <1-255> @var{A.B.C.D/M}} {} -@deffnx {RIP command} {no distance <1-255> @var{A.B.C.D/M}} {} -Set default RIP distance to specified value when the route's source IP -address matches the specified prefix. -@end deffn - -@deffn {RIP command} {distance <1-255> @var{A.B.C.D/M} @var{access-list}} {} -@deffnx {RIP command} {no distance <1-255> @var{A.B.C.D/M} @var{access-list}} {} -Set default RIP distance to specified value when the route's source IP -address matches the specified prefix and the specified access-list. -@end deffn - -@node RIP route-map -@section RIP route-map - -Usage of @command{ripd}'s route-map support. - -Optional argument route-map MAP_NAME can be added to each @code{redistribute} -statement. - -@example -redistribute static [route-map MAP_NAME] -redistribute connected [route-map MAP_NAME] -..... -@end example - -Cisco applies route-map _before_ routes will exported to rip route table. -In current Frr's test implementation, @command{ripd} applies route-map -after routes are listed in the route table and before routes will be -announced to an interface (something like output filter). I think it is not -so clear, but it is draft and it may be changed at future. - -Route-map statement (@pxref{Route Map}) is needed to use route-map -functionality. - -@deffn {Route Map} {match interface @var{word}} {} -This command match to incoming interface. Notation of this match is -different from Cisco. Cisco uses a list of interfaces - NAME1 NAME2 -... NAMEN. Ripd allows only one name (maybe will change in the -future). Next - Cisco means interface which includes next-hop of -routes (it is somewhat similar to "ip next-hop" statement). Ripd -means interface where this route will be sent. This difference is -because "next-hop" of same routes which sends to different interfaces -must be different. Maybe it'd be better to made new matches - say -"match interface-out NAME" or something like that. -@end deffn - -@deffn {Route Map} {match ip address @var{word}} {} -@deffnx {Route Map} {match ip address prefix-list @var{word}} {} -Match if route destination is permitted by access-list. -@end deffn - -@deffn {Route Map} {match ip next-hop @var{word}} {} -@deffnx {Route Map} {match ip next-hop prefix-list @var{word}} {} -Match if route next-hop (meaning next-hop listed in the rip route-table -as displayed by "show ip rip") is permitted by access-list. -@end deffn - -@deffn {Route Map} {match metric <0-4294967295>} {} -This command match to the metric value of RIP updates. For other -protocol compatibility metric range is shown as <0-4294967295>. But -for RIP protocol only the value range <0-16> make sense. -@end deffn - -@deffn {Route Map} {set ip next-hop A.B.C.D} {} -This command set next hop value in RIPv2 protocol. This command does -not affect RIPv1 because there is no next hop field in the packet. -@end deffn - -@deffn {Route Map} {set metric <0-4294967295>} {} -Set a metric for matched route when sending announcement. The metric -value range is very large for compatibility with other protocols. For -RIP, valid metric values are from 1 to 16. -@end deffn - -@node RIP Authentication -@section RIP Authentication - -RIPv2 allows packets to be authenticated via either an insecure plain -text password, included with the packet, or via a more secure MD5 based -@acronym{HMAC, keyed-Hashing for Message AuthentiCation}, -RIPv1 can not be authenticated at all, thus when authentication is -configured @code{ripd} will discard routing updates received via RIPv1 -packets. - -However, unless RIPv1 reception is disabled entirely, -@xref{RIP Version Control}, RIPv1 REQUEST packets which are received, -which query the router for routing information, will still be honoured -by @code{ripd}, and @code{ripd} WILL reply to such packets. This allows -@code{ripd} to honour such REQUESTs (which sometimes is used by old -equipment and very simple devices to bootstrap their default route), -while still providing security for route updates which are received. - -In short: Enabling authentication prevents routes being updated by -unauthenticated remote routers, but still can allow routes (I.e. the -entire RIP routing table) to be queried remotely, potentially by anyone -on the internet, via RIPv1. - -To prevent such unauthenticated querying of routes disable RIPv1, -@xref{RIP Version Control}. - -@deffn {Interface command} {ip rip authentication mode md5} {} -@deffnx {Interface command} {no ip rip authentication mode md5} {} -Set the interface with RIPv2 MD5 authentication. -@end deffn - -@deffn {Interface command} {ip rip authentication mode text} {} -@deffnx {Interface command} {no ip rip authentication mode text} {} -Set the interface with RIPv2 simple password authentication. -@end deffn - -@deffn {Interface command} {ip rip authentication string @var{string}} {} -@deffnx {Interface command} {no ip rip authentication string @var{string}} {} -RIP version 2 has simple text authentication. This command sets -authentication string. The string must be shorter than 16 characters. -@end deffn - -@deffn {Interface command} {ip rip authentication key-chain @var{key-chain}} {} -@deffnx {Interface command} {no ip rip authentication key-chain @var{key-chain}} {} -Specifiy Keyed MD5 chain. -@end deffn - -@example -! -key chain test - key 1 - key-string test -! -interface eth1 - ip rip authentication mode md5 - ip rip authentication key-chain test -! -@end example - -@node RIP Timers -@section RIP Timers - -@deffn {RIP command} {timers basic @var{update} @var{timeout} @var{garbage}} {} - -RIP protocol has several timers. User can configure those timers' values -by @code{timers basic} command. - -The default settings for the timers are as follows: - -@itemize @bullet -@item -The update timer is 30 seconds. Every update timer seconds, the RIP -process is awakened to send an unsolicited Response message containing -the complete routing table to all neighboring RIP routers. - -@item -The timeout timer is 180 seconds. Upon expiration of the timeout, the -route is no longer valid; however, it is retained in the routing table -for a short time so that neighbors can be notified that the route has -been dropped. - -@item -The garbage collect timer is 120 seconds. Upon expiration of the -garbage-collection timer, the route is finally removed from the routing -table. - -@end itemize - -The @code{timers basic} command allows the the default values of the timers -listed above to be changed. -@end deffn - -@deffn {RIP command} {no timers basic} {} -The @code{no timers basic} command will reset the timers to the default -settings listed above. -@end deffn - -@node Show RIP Information -@section Show RIP Information - -To display RIP routes. - -@deffn Command {show ip rip} {} -Show RIP routes. -@end deffn - -The command displays all RIP routes. For routes that are received -through RIP, this command will display the time the packet was sent and -the tag information. This command will also display this information -for routes redistributed into RIP. - -@c Exmaple here. - -@deffn Command {show ip rip status} {} -The command displays current RIP status. It includes RIP timer, -filtering, version, RIP enabled interface and RIP peer inforation. -@end deffn - -@example -@group -ripd> @b{show ip rip status} -Routing Protocol is "rip" - Sending updates every 30 seconds with +/-50%, next due in 35 seconds - Timeout after 180 seconds, garbage collect after 120 seconds - Outgoing update filter list for all interface is not set - Incoming update filter list for all interface is not set - Default redistribution metric is 1 - Redistributing: kernel connected - Default version control: send version 2, receive version 2 - Interface Send Recv - Routing for Networks: - eth0 - eth1 - 1.1.1.1 - 203.181.89.241 - Routing Information Sources: - Gateway BadPackets BadRoutes Distance Last Update -@end group -@end example - -@node RIP Debug Commands -@section RIP Debug Commands - -Debug for RIP protocol. - -@deffn Command {debug rip events} {} -Debug rip events. -@end deffn - -@code{debug rip} will show RIP events. Sending and receiving -packets, timers, and changes in interfaces are events shown with @command{ripd}. - -@deffn Command {debug rip packet} {} -Debug rip packet. -@end deffn - -@code{debug rip packet} will display detailed information about the RIP -packets. The origin and port number of the packet as well as a packet -dump is shown. - -@deffn Command {debug rip zebra} {} -Debug rip between zebra communication. -@end deffn - -This command will show the communication between @command{ripd} and -@command{zebra}. The main information will include addition and deletion of -paths to the kernel and the sending and receiving of interface information. - -@deffn Command {show debugging rip} {} -Display @command{ripd}'s debugging option. -@end deffn - -@code{show debugging rip} will show all information currently set for ripd -debug. diff --git a/doc/ripngd.8.in b/doc/ripngd.8.in deleted file mode 100644 index 98039219a..000000000 --- a/doc/ripngd.8.in +++ /dev/null @@ -1,122 +0,0 @@ -.TH RIPNGD 8 "25 November 2004" "@PACKAGE_FULLNAME@ RIPNG daemon" "Version @PACKAGE_VERSION@" -.SH NAME -ripngd \- a RIPNG routing engine for use with @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B ripngd -[ -.B \-dhlrv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] -.SH DESCRIPTION -.B ripngd -is a routing component that works with the -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B ripngd -command: -.SH OPTIONS -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/ripngd.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When ripngd starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart ripngd. The default is \fB\fI@CFG_STATE@/ripngd.pid\fR. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the ripngd VTY will listen on. This defaults to -2603, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the ripngd VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-r\fR, \fB\-\-retain\fR -When the program terminates, retain routes added by \fBripd\fR. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -There are currently no such modules for -\fBripngd\fR in the base package. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/ripngd -The default location of the -.B ripngd -binary. -.TP -.BI @CFG_SYSCONF@/ripngd.conf -The default location of the -.B ripngd -config file. -.TP -.BI $(PWD)/ripngd.log -If the -.B ripngd -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBripngd\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The ripngd process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBripngd\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8), -.BR vtysh (1) -.SH BUGS -.B ripngd -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/ripngd.texi b/doc/ripngd.texi deleted file mode 100644 index 1adda6943..000000000 --- a/doc/ripngd.texi +++ /dev/null @@ -1,84 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node RIPng -@chapter RIPng - -@command{ripngd} supports the RIPng protocol as described in RFC2080. It's an -IPv6 reincarnation of the RIP protocol. - -@menu -* Invoking ripngd:: -* ripngd Configuration:: -* ripngd Terminal Mode Commands:: -* ripngd Filtering Commands:: -@end menu - -@node Invoking ripngd -@section Invoking ripngd - -There are no @code{ripngd} specific invocation options. Common options -can be specified (@pxref{Common Invocation Options}). - -@node ripngd Configuration -@section ripngd Configuration - -Currently ripngd supports the following commands: - -@deffn Command {router ripng} {} -Enable RIPng. -@end deffn - -@deffn {RIPng Command} {flush_timer @var{time}} {} -Set flush timer. -@end deffn - -@deffn {RIPng Command} {network @var{network}} {} -Set RIPng enabled interface by @var{network} -@end deffn - -@deffn {RIPng Command} {network @var{ifname}} {} -Set RIPng enabled interface by @var{ifname} -@end deffn - -@deffn {RIPng Command} {route @var{network}} {} -Set RIPng static routing announcement of @var{network}. -@end deffn - -@deffn Command {router zebra} {} -This command is the default and does not appear in the configuration. -With this statement, RIPng routes go to the @command{zebra} daemon. -@end deffn - -@node ripngd Terminal Mode Commands -@section ripngd Terminal Mode Commands - -@deffn Command {show ip ripng} {} -@end deffn - -@deffn Command {show debugging ripng} {} -@end deffn - -@deffn Command {debug ripng events} {} -@end deffn - -@deffn Command {debug ripng packet} {} -@end deffn - -@deffn Command {debug ripng zebra} {} -@end deffn - -@node ripngd Filtering Commands -@section ripngd Filtering Commands - -@deffn Command {distribute-list @var{access_list} (in|out) @var{ifname}} {} -You can apply an access-list to the interface using the -@code{distribute-list} command. @var{access_list} is an access-list -name. @var{direct} is @samp{in} or @samp{out}. If @var{direct} is -@samp{in}, the access-list is applied only to incoming packets. - -@example -distribute-list local-only out sit1 -@end example -@end deffn diff --git a/doc/routemap.texi b/doc/routemap.texi deleted file mode 100644 index 3e683f44d..000000000 --- a/doc/routemap.texi +++ /dev/null @@ -1,285 +0,0 @@ -@node Route Map -@chapter Route Map - -Route maps provide a means to both filter and/or apply actions to -route, hence allowing policy to be applied to routes. - -@menu -* Route Map Command:: -* Route Map Match Command:: -* Route Map Set Command:: -* Route Map Call Command:: -* Route Map Exit Action Command:: -* Route Map Examples:: -@end menu - -Route-maps are an ordered list of route-map entries. Each entry may -specify up to four distincts sets of clauses: - -@table @samp -@item Matching Policy - -This specifies the policy implied if the @samp{Matching Conditions} are -met or not met, and which actions of the route-map are to be taken, if -any. The two possibilities are: - -@itemize @minus -@item -@samp{permit}: If the entry matches, then carry out the @samp{Set -Actions}. Then finish processing the route-map, permitting the route, -unless an @samp{Exit Action} indicates otherwise. - -@item -@samp{deny}: If the entry matches, then finish processing the route-map and -deny the route (return @samp{deny}). -@end itemize - -The @samp{Matching Policy} is specified as part of the command which -defines the ordered entry in the route-map. See below. - -@item Matching Conditions - -A route-map entry may, optionally, specify one or more conditions which -must be matched if the entry is to be considered further, as governed -by the Match Policy. If a route-map entry does not explicitely specify -any matching conditions, then it always matches. - -@item Set Actions - -A route-map entry may, optionally, specify one or more @samp{Set -Actions} to set or modify attributes of the route. - -@item Call Action - -Call to another route-map, after any @samp{Set Actions} have been -carried out. If the route-map called returns @samp{deny} then -processing of the route-map finishes and the route is denied, -regardless of the @samp{Matching Policy} or the @samp{Exit Policy}. If -the called route-map returns @samp{permit}, then @samp{Matching Policy} -and @samp{Exit Policy} govern further behaviour, as normal. - -@item Exit Policy - -An entry may, optionally, specify an alternative @samp{Exit Policy} to -take if the entry matched, rather than the normal policy of exiting the -route-map and permitting the route. The two possibilities are: - -@itemize @minus -@item -@samp{next}: Continue on with processing of the route-map entries. - -@item -@samp{goto N}: Jump ahead to the first route-map entry whose order in -the route-map is >= N. Jumping to a previous entry is not permitted. -@end itemize -@end table - -The default action of a route-map, if no entries match, is to deny. -I.e. a route-map essentially has as its last entry an empty @samp{deny} -entry, which matches all routes. To change this behaviour, one must -specify an empty @samp{permit} entry as the last entry in the route-map. - -To summarise the above: - -@multitable {permit} {action} {No Match} -@headitem @tab Match @tab No Match -@item @emph{Permit} @tab action @tab cont -@item @emph{Deny} @tab deny @tab cont -@end multitable - -@table @samp - -@item action -@itemize @minus -@item -Apply @emph{set} statements - -@item -If @emph{call} is present, call given route-map. If that returns a @samp{deny}, finish -processing and return @samp{deny}. - -@item -If @samp{Exit Policy} is @emph{next}, goto next route-map entry - -@item -If @samp{Exit Policy} is @emph{goto}, goto first entry whose order in the list -is >= the given order. - -@item -Finish processing the route-map and permit the route. -@end itemize - -@item deny -@itemize @minus -@item -The route is denied by the route-map (return @samp{deny}). -@end itemize - -@item cont -@itemize @minus -@item -goto next route-map entry -@end itemize -@end table - -@node Route Map Command -@section Route Map Command - -@deffn {Command} {route-map @var{route-map-name} (permit|deny) @var{order}} {} - -Configure the @var{order}'th entry in @var{route-map-name} with -@samp{Match Policy} of either @emph{permit} or @emph{deny}. - -@end deffn - -@node Route Map Match Command -@section Route Map Match Command - -@deffn {Route-map Command} {match ip address @var{access_list}} {} -Matches the specified @var{access_list} -@end deffn - -@deffn {Route-map Command} {match ip address @var{prefix-list}} {} -Matches the specified @var{prefix-list} -@end deffn - -@deffn {Route-map Command} {match ip address prefix-len @var{0-32}} {} -Matches the specified @var{prefix-len}. This is a Zebra specific command. -@end deffn - -@deffn {Route-map Command} {match ipv6 address @var{access_list}} {} -Matches the specified @var{access_list} -@end deffn - -@deffn {Route-map Command} {match ipv6 address @var{prefix-list}} {} -Matches the specified @var{prefix-list} -@end deffn - -@deffn {Route-map Command} {match ipv6 address prefix-len @var{0-128}} {} -Matches the specified @var{prefix-len}. This is a Zebra specific command. -@end deffn - -@deffn {Route-map Command} {match ip next-hop @var{ipv4_addr}} {} -Matches the specified @var{ipv4_addr}. -@end deffn - -@deffn {Route-map Command} {match aspath @var{as_path}} {} -Matches the specified @var{as_path}. -@end deffn - -@deffn {Route-map Command} {match metric @var{metric}} {} -Matches the specified @var{metric}. -@end deffn - -@deffn {Route-map Command} {match tag @var{tag}} {} -Matches the specified tag value associated with the route. -This tag value can be in the range of (1-4294967295). -@end deffn - -@deffn {Route-map Command} {match local-preference @var{metric}} {} -Matches the specified @var{local-preference}. -@end deffn - -@deffn {Route-map Command} {match community @var{community_list}} {} -Matches the specified @var{community_list} -@end deffn - -@deffn {Route-map Command} {match peer @var{ipv4_addr}} {} -This is a BGP specific match command. Matches the peer ip address -if the neighbor was specified in this manner. -@end deffn - -@deffn {Route-map Command} {match peer @var{ipv6_addr}} {} -This is a BGP specific match command. Matches the peer ipv6 -address if the neighbor was specified in this manner. -@end deffn - -@deffn {Route-map Command} {match peer @var{interface_name}} {} -This is a BGP specific match command. Matches the peer -interface name specified if the neighbor was specified -in this manner. -@end deffn - -@node Route Map Set Command -@section Route Map Set Command - -@deffn {Route-map Command} {set tag @var{tag}} {} -Set a tag on the matched route. This tag value can be from -(1-4294967295). Additionally if you have compiled with -the --enable-realms configure option. Tag values from (1-255) -are sent to the linux kernel as a realm value. Then route -policy can be applied. See the tc man page. -@end deffn - -@deffn {Route-map Command} {set ip next-hop @var{ipv4_address}} {} -Set the BGP nexthop address. -@end deffn - -@deffn {Route-map Command} {set local-preference @var{local_pref}} {} -Set the BGP local preference to @var{local_pref}. -@end deffn - -@deffn {Route-map Command} {set weight @var{weight}} {} -Set the route's weight. -@end deffn - -@deffn {Route-map Command} {set metric @var{metric}} {} -@anchor{routemap set metric} -Set the BGP attribute MED. -@end deffn - -@deffn {Route-map Command} {set as-path prepend @var{as_path}} {} -Set the BGP AS path to prepend. -@end deffn - -@deffn {Route-map Command} {set community @var{community}} {} -Set the BGP community attribute. -@end deffn - -@deffn {Route-map Command} {set ipv6 next-hop global @var{ipv6_address}} {} -Set the BGP-4+ global IPv6 nexthop address. -@end deffn - -@deffn {Route-map Command} {set ipv6 next-hop local @var{ipv6_address}} {} -Set the BGP-4+ link local IPv6 nexthop address. -@end deffn - -@node Route Map Call Command -@section Route Map Call Command - -@deffn {Route-map Command} {call @var{name}} {} -Call route-map @var{name}. If it returns deny, deny the route and -finish processing the route-map. -@end deffn - -@node Route Map Exit Action Command -@section Route Map Exit Action Command - -@deffn {Route-map Command} {on-match next} {} -@deffnx {Route-map Command} {continue} {} -Proceed on to the next entry in the route-map. -@end deffn - -@deffn {Route-map Command} {on-match goto @var{N}} {} -@deffnx {Route-map Command} {continue @var{N}} {} -Proceed processing the route-map at the first entry whose order is >= N -@end deffn - -@node Route Map Examples -@section Route Map Examples - -A simple example of a route-map: - -@example -@group -route-map test permit 10 - match ip address 10 - set local-preference 200 -@end group -@end example - -This means that if a route matches ip access-list number 10 it's -local-preference value is set to 200. - -See @ref{BGP Configuration Examples} for examples of more sophisticated -useage of route-maps, including of the @samp{call} action. diff --git a/doc/routeserver.texi b/doc/routeserver.texi deleted file mode 100644 index b25800107..000000000 --- a/doc/routeserver.texi +++ /dev/null @@ -1,561 +0,0 @@ -@c -*-texinfo-*- -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@c -@c This file is a modified version of Jose Luis Rubio's TeX sources -@c of his RS-Manual document - -@node Configuring Frr as a Route Server -@chapter Configuring Frr as a Route Server - -The purpose of a Route Server is to centralize the peerings between BGP -speakers. For example if we have an exchange point scenario with four BGP -speakers, each of which maintaining a BGP peering with the other three -(@pxref{fig:full-mesh}), we can convert it into a centralized scenario where -each of the four establishes a single BGP peering against the Route Server -(@pxref{fig:route-server}). - -We will first describe briefly the Route Server model implemented by Frr. -We will explain the commands that have been added for configuring that -model. And finally we will show a full example of Frr configured as Route -Server. - -@menu -* Description of the Route Server model:: -* Commands for configuring a Route Server:: -* Example of Route Server Configuration:: -@end menu - -@node Description of the Route Server model -@section Description of the Route Server model - -First we are going to describe the normal processing that BGP announcements -suffer inside a standard BGP speaker, as shown in @ref{fig:normal-processing}, -it consists of three steps: - -@itemize @bullet -@item -When an announcement is received from some peer, the `In' filters -configured for that peer are applied to the announcement. These filters can -reject the announcement, accept it unmodified, or accept it with some of its -attributes modified. - -@item -The announcements that pass the `In' filters go into the -Best Path Selection process, where they are compared to other -announcements referred to the same destination that have been -received from different peers (in case such other -announcements exist). For each different destination, the announcement -which is selected as the best is inserted into the BGP speaker's Loc-RIB. - -@item -The routes which are inserted in the Loc-RIB are -considered for announcement to all the peers (except the one -from which the route came). This is done by passing the routes -in the Loc-RIB through the `Out' filters corresponding to each -peer. These filters can reject the route, -accept it unmodified, or accept it with some of its attributes -modified. Those routes which are accepted by the `Out' filters -of a peer are announced to that peer. -@end itemize - -@float Figure,fig:normal-processing -@image{fig-normal-processing,400pt,,Normal announcement processing} -@caption{Announcement processing inside a ``normal'' BGP speaker} -@end float - -@float Figure,fig:full-mesh -@image{fig_topologies_full,120pt,,Full Mesh BGP Topology} -@caption{Full Mesh} -@end float - -@float Figure,fig:route-server -@image{fig_topologies_rs,120pt,,Route Server BGP Topology} -@caption{Route Server and clients} -@end float - -Of course we want that the routing tables obtained in each of the routers -are the same when using the route server than when not. But as a consequence -of having a single BGP peering (against the route server), the BGP speakers -can no longer distinguish from/to which peer each announce comes/goes. -@anchor{filter-delegation}This means that the routers connected to the route -server are not able to apply by themselves the same input/output filters -as in the full mesh scenario, so they have to delegate those functions to -the route server. - -Even more, the ``best path'' selection must be also performed inside -the route server on behalf of its clients. The reason is that if, after -applying the filters of the announcer and the (potential) receiver, the -route server decides to send to some client two or more different -announcements referred to the same destination, the client will only -retain the last one, considering it as an implicit withdrawal of the -previous announcements for the same destination. This is the expected -behavior of a BGP speaker as defined in @cite{RFC1771}, and even though -there are some proposals of mechanisms that permit multiple paths for -the same destination to be sent through a single BGP peering, none are -currently supported by most existing BGP implementations. - -As a consequence a route server must maintain additional information and -perform additional tasks for a RS-client that those necessary for common BGP -peerings. Essentially a route server must: - -@anchor{Route Server tasks} -@itemize @bullet -@item -Maintain a separated Routing Information Base (Loc-RIB) -for each peer configured as RS-client, containing the routes -selected as a result of the ``Best Path Selection'' process -that is performed on behalf of that RS-client. - -@item -Whenever it receives an announcement from a RS-client, -it must consider it for the Loc-RIBs of the other RS-clients. - -@anchor{Route-server path filter process} -@itemize @bullet -@item -This means that for each of them the route server must pass the -announcement through the appropriate `Out' filter of the -announcer. - -@item -Then through the appropriate `In' filter of -the potential receiver. - -@item -Only if the announcement is accepted by both filters it will be passed -to the ``Best Path Selection'' process. - -@item -Finally, it might go into the Loc-RIB of the receiver. -@end itemize -@end itemize - -When we talk about the ``appropriate'' filter, both the announcer and the -receiver of the route must be taken into account. Suppose that the route -server receives an announcement from client A, and the route server is -considering it for the Loc-RIB of client B. The filters that should be -applied are the same that would be used in the full mesh scenario, i.e., -first the `Out' filter of router A for announcements going to router B, and -then the `In' filter of router B for announcements coming from router A. - -We call ``Export Policy'' of a RS-client to the set of `Out' filters that -the client would use if there was no route server. The same applies for the -``Import Policy'' of a RS-client and the set of `In' filters of the client -if there was no route server. - -It is also common to demand from a route server that it does not -modify some BGP attributes (next-hop, as-path and MED) that are usually -modified by standard BGP speakers before announcing a route. - -The announcement processing model implemented by Frr is shown in -@ref{fig:rs-processing}. The figure shows a mixture of RS-clients (B, C and D) -with normal BGP peers (A). There are some details that worth additional -comments: - -@itemize @bullet -@item -Announcements coming from a normal BGP peer are also -considered for the Loc-RIBs of all the RS-clients. But -logically they do not pass through any export policy. - -@item -Those peers that are configured as RS-clients do not -receive any announce from the `Main' Loc-RIB. - -@item -Apart from import and export policies, -`In' and `Out' filters can also be set for RS-clients. `In' -filters might be useful when the route server has also normal -BGP peers. On the other hand, `Out' filters for RS-clients are -probably unnecessary, but we decided not to remove them as -they do not hurt anybody (they can always be left empty). -@end itemize - -@float Figure,fig:rs-processing -@image{fig-rs-processing,450pt,,Route Server Processing Model} -@caption{Announcement processing model implemented by the Route Server} -@end float - -@node Commands for configuring a Route Server -@section Commands for configuring a Route Server - -Now we will describe the commands that have been added to frr -in order to support the route server features. - -@deffn {Route-Server} {neighbor @var{peer-group} route-server-client} {} -@deffnx {Route-Server} {neighbor @var{A.B.C.D} route-server-client} {} -@deffnx {Route-Server} {neighbor @var{X:X::X:X} route-server-client} {} -This command configures the peer given by @var{peer}, @var{A.B.C.D} or -@var{X:X::X:X} as an RS-client. - -Actually this command is not new, it already existed in standard Frr. It -enables the transparent mode for the specified peer. This means that some -BGP attributes (as-path, next-hop and MED) of the routes announced to that -peer are not modified. - -With the route server patch, this command, apart from setting the -transparent mode, creates a new Loc-RIB dedicated to the specified peer -(those named `Loc-RIB for X' in @ref{fig:rs-processing}.). Starting from -that moment, every announcement received by the route server will be also -considered for the new Loc-RIB. -@end deffn - -@deffn {Route-Server} {neigbor @{A.B.C.D|X.X::X.X|peer-group@} route-map WORD @{import|export@}} {} -This set of commands can be used to specify the route-map that -represents the Import or Export policy of a peer which is -configured as a RS-client (with the previous command). -@end deffn - -@deffn {Route-Server} {match peer @{A.B.C.D|X:X::X:X@}} {} -This is a new @emph{match} statement for use in route-maps, enabling them to -describe import/export policies. As we said before, an import/export policy -represents a set of input/output filters of the RS-client. This statement -makes possible that a single route-map represents the full set of filters -that a BGP speaker would use for its different peers in a non-RS scenario. - -The @emph{match peer} statement has different semantics whether it is used -inside an import or an export route-map. In the first case the statement -matches if the address of the peer who sends the announce is the same that -the address specified by @{A.B.C.D|X:X::X:X@}. For export route-maps it -matches when @{A.B.C.D|X:X::X:X@} is the address of the RS-Client into whose -Loc-RIB the announce is going to be inserted (how the same export policy is -applied before different Loc-RIBs is shown in @ref{fig:rs-processing}.). -@end deffn - -@deffn {Route-map Command} {call @var{WORD}} {} -This command (also used inside a route-map) jumps into a different -route-map, whose name is specified by @var{WORD}. When the called -route-map finishes, depending on its result the original route-map -continues or not. Apart from being useful for making import/export -route-maps easier to write, this command can also be used inside -any normal (in or out) route-map. -@end deffn - -@node Example of Route Server Configuration -@section Example of Route Server Configuration - -Finally we are going to show how to configure a Frr daemon to act as a -Route Server. For this purpose we are going to present a scenario without -route server, and then we will show how to use the configurations of the BGP -routers to generate the configuration of the route server. - -All the configuration files shown in this section have been taken -from scenarios which were tested using the VNUML tool -@uref{http://www.dit.upm.es/vnuml,VNUML}. - -@menu -* Configuration of the BGP routers without Route Server:: -* Configuration of the BGP routers with Route Server:: -* Configuration of the Route Server itself:: -* Further considerations about Import and Export route-maps:: -@end menu - -@node Configuration of the BGP routers without Route Server -@subsection Configuration of the BGP routers without Route Server - -We will suppose that our initial scenario is an exchange point with three -BGP capable routers, named RA, RB and RC. Each of the BGP speakers generates -some routes (with the @var{network} command), and establishes BGP peerings -against the other two routers. These peerings have In and Out route-maps -configured, named like ``PEER-X-IN'' or ``PEER-X-OUT''. For example the -configuration file for router RA could be the following: - -@exampleindent 0 -@example -#Configuration for router 'RA' -! -hostname RA -password **** -! -router bgp 65001 - no bgp default ipv4-unicast - neighbor 2001:0DB8::B remote-as 65002 - neighbor 2001:0DB8::C remote-as 65003 -! - address-family ipv6 - network 2001:0DB8:AAAA:1::/64 - network 2001:0DB8:AAAA:2::/64 - network 2001:0DB8:0000:1::/64 - network 2001:0DB8:0000:2::/64 - - neighbor 2001:0DB8::B activate - neighbor 2001:0DB8::B soft-reconfiguration inbound - neighbor 2001:0DB8::B route-map PEER-B-IN in - neighbor 2001:0DB8::B route-map PEER-B-OUT out - - neighbor 2001:0DB8::C activate - neighbor 2001:0DB8::C soft-reconfiguration inbound - neighbor 2001:0DB8::C route-map PEER-C-IN in - neighbor 2001:0DB8::C route-map PEER-C-OUT out - exit-address-family -! -ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64 -ipv6 prefix-list COMMON-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64 -ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64 -ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64 -ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any -! -route-map PEER-B-IN permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set metric 100 -route-map PEER-B-IN permit 20 - match ipv6 address prefix-list PEER-B-PREFIXES - set community 65001:11111 -! -route-map PEER-C-IN permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set metric 200 -route-map PEER-C-IN permit 20 - match ipv6 address prefix-list PEER-C-PREFIXES - set community 65001:22222 -! -route-map PEER-B-OUT permit 10 - match ipv6 address prefix-list PEER-A-PREFIXES -! -route-map PEER-C-OUT permit 10 - match ipv6 address prefix-list PEER-A-PREFIXES -! -line vty -! -@end example - -@node Configuration of the BGP routers with Route Server -@subsection Configuration of the BGP routers with Route Server - -To convert the initial scenario into one with route server, first we must -modify the configuration of routers RA, RB and RC. Now they must not peer -between them, but only with the route server. For example, RA's -configuration would turn into: - -@example -# Configuration for router 'RA' -! -hostname RA -password **** -! -router bgp 65001 - no bgp default ipv4-unicast - neighbor 2001:0DB8::FFFF remote-as 65000 -! - address-family ipv6 - network 2001:0DB8:AAAA:1::/64 - network 2001:0DB8:AAAA:2::/64 - network 2001:0DB8:0000:1::/64 - network 2001:0DB8:0000:2::/64 - - neighbor 2001:0DB8::FFFF activate - neighbor 2001:0DB8::FFFF soft-reconfiguration inbound - exit-address-family -! -line vty -! -@end example - -Which is logically much simpler than its initial configuration, as it now -maintains only one BGP peering and all the filters (route-maps) have -disappeared. - -@node Configuration of the Route Server itself -@subsection Configuration of the Route Server itself - -As we said when we described the functions of a route server -(@pxref{Description of the Route Server model}), it is in charge of all the -route filtering. To achieve that, the In and Out filters from the RA, RB and -RC configurations must be converted into Import and Export policies in the -route server. - -This is a fragment of the route server configuration (we only show -the policies for client RA): - -@example -# Configuration for Route Server ('RS') -! -hostname RS -password ix -! -bgp multiple-instance -! -router bgp 65000 view RS - no bgp default ipv4-unicast - neighbor 2001:0DB8::A remote-as 65001 - neighbor 2001:0DB8::B remote-as 65002 - neighbor 2001:0DB8::C remote-as 65003 -! - address-family ipv6 - neighbor 2001:0DB8::A activate - neighbor 2001:0DB8::A route-server-client - neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import - neighbor 2001:0DB8::A route-map RSCLIENT-A-EXPORT export - neighbor 2001:0DB8::A soft-reconfiguration inbound - - neighbor 2001:0DB8::B activate - neighbor 2001:0DB8::B route-server-client - neighbor 2001:0DB8::B route-map RSCLIENT-B-IMPORT import - neighbor 2001:0DB8::B route-map RSCLIENT-B-EXPORT export - neighbor 2001:0DB8::B soft-reconfiguration inbound - - neighbor 2001:0DB8::C activate - neighbor 2001:0DB8::C route-server-client - neighbor 2001:0DB8::C route-map RSCLIENT-C-IMPORT import - neighbor 2001:0DB8::C route-map RSCLIENT-C-EXPORT export - neighbor 2001:0DB8::C soft-reconfiguration inbound - exit-address-family -! -ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64 -ipv6 prefix-list COMMON-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64 -ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64 -ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any -! -ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64 -ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any -! -route-map RSCLIENT-A-IMPORT permit 10 - match peer 2001:0DB8::B - call A-IMPORT-FROM-B -route-map RSCLIENT-A-IMPORT permit 20 - match peer 2001:0DB8::C - call A-IMPORT-FROM-C -! -route-map A-IMPORT-FROM-B permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set metric 100 -route-map A-IMPORT-FROM-B permit 20 - match ipv6 address prefix-list PEER-B-PREFIXES - set community 65001:11111 -! -route-map A-IMPORT-FROM-C permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set metric 200 -route-map A-IMPORT-FROM-C permit 20 - match ipv6 address prefix-list PEER-C-PREFIXES - set community 65001:22222 -! -route-map RSCLIENT-A-EXPORT permit 10 - match peer 2001:0DB8::B - match ipv6 address prefix-list PEER-A-PREFIXES -route-map RSCLIENT-A-EXPORT permit 20 - match peer 2001:0DB8::C - match ipv6 address prefix-list PEER-A-PREFIXES -! -... -... -... -@end example - -If you compare the initial configuration of RA with the route server -configuration above, you can see how easy it is to generate the Import and -Export policies for RA from the In and Out route-maps of RA's original -configuration. - -When there was no route server, RA maintained two peerings, one with RB and -another with RC. Each of this peerings had an In route-map configured. To -build the Import route-map for client RA in the route server, simply add -route-map entries following this scheme: - -@example -route-map <NAME> permit 10 - match peer <Peer Address> - call <In Route-Map for this Peer> -route-map <NAME> permit 20 - match peer <Another Peer Address> - call <In Route-Map for this Peer> -@end example - -This is exactly the process that has been followed to generate the route-map -RSCLIENT-A-IMPORT. The route-maps that are called inside it (A-IMPORT-FROM-B -and A-IMPORT-FROM-C) are exactly the same than the In route-maps from the -original configuration of RA (PEER-B-IN and PEER-C-IN), only the name is -different. - -The same could have been done to create the Export policy for RA (route-map -RSCLIENT-A-EXPORT), but in this case the original Out route-maps where so -simple that we decided not to use the @var{call WORD} commands, and we -integrated all in a single route-map (RSCLIENT-A-EXPORT). - -The Import and Export policies for RB and RC are not shown, but -the process would be identical. - -@node Further considerations about Import and Export route-maps -@subsection Further considerations about Import and Export route-maps - -The current version of the route server patch only allows to specify a -route-map for import and export policies, while in a standard BGP speaker -apart from route-maps there are other tools for performing input and output -filtering (access-lists, community-lists, ...). But this does not represent -any limitation, as all kinds of filters can be included in import/export -route-maps. For example suppose that in the non-route-server scenario peer -RA had the following filters configured for input from peer B: - -@example - neighbor 2001:0DB8::B prefix-list LIST-1 in - neighbor 2001:0DB8::B filter-list LIST-2 in - neighbor 2001:0DB8::B route-map PEER-B-IN in - ... - ... -route-map PEER-B-IN permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set local-preference 100 -route-map PEER-B-IN permit 20 - match ipv6 address prefix-list PEER-B-PREFIXES - set community 65001:11111 -@end example - -It is posible to write a single route-map which is equivalent to -the three filters (the community-list, the prefix-list and the -route-map). That route-map can then be used inside the Import -policy in the route server. Lets see how to do it: - -@example - neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import - ... -! -... -route-map RSCLIENT-A-IMPORT permit 10 - match peer 2001:0DB8::B - call A-IMPORT-FROM-B -... -... -! -route-map A-IMPORT-FROM-B permit 1 - match ipv6 address prefix-list LIST-1 - match as-path LIST-2 - on-match goto 10 -route-map A-IMPORT-FROM-B deny 2 -route-map A-IMPORT-FROM-B permit 10 - match ipv6 address prefix-list COMMON-PREFIXES - set local-preference 100 -route-map A-IMPORT-FROM-B permit 20 - match ipv6 address prefix-list PEER-B-PREFIXES - set community 65001:11111 -! -... -... -@end example - -The route-map A-IMPORT-FROM-B is equivalent to the three filters -(LIST-1, LIST-2 and PEER-B-IN). The first entry of route-map -A-IMPORT-FROM-B (sequence number 1) matches if and only if both -the prefix-list LIST-1 and the filter-list LIST-2 match. If that -happens, due to the ``on-match goto 10'' statement the next -route-map entry to be processed will be number 10, and as of that -point route-map A-IMPORT-FROM-B is identical to PEER-B-IN. If -the first entry does not match, `on-match goto 10'' will be -ignored and the next processed entry will be number 2, which will -deny the route. - -Thus, the result is the same that with the three original filters, -i.e., if either LIST-1 or LIST-2 rejects the route, it does not -reach the route-map PEER-B-IN. In case both LIST-1 and LIST-2 -accept the route, it passes to PEER-B-IN, which can reject, accept -or modify the route. diff --git a/doc/rpki.texi b/doc/rpki.texi deleted file mode 100644 index c1c8a8aa5..000000000 --- a/doc/rpki.texi +++ /dev/null @@ -1,256 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the FRR Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. -@node Prefix Origin Validation Using RPKI -@section Prefix Origin Validation Using RPKI - -Prefix Origin Validation allows BGP routers to verify if the origin AS of -an IP prefix is legitimate to announce this IP prefix. The required -attestation objects are stored in the Resource Public Key Infrastructure -(@acronym{RPKI}). However, RPKI-enabled routers do not store cryptographic -data itself but only validation information. The validation of the -cryptographic data (so called Route Origin Authorization, or short -@acronym{ROA}, objects) will be performed by trusted cache servers. The -RPKI/RTR protocol defines a standard mechanism to maintain the exchange of -the prefix/origin AS mapping between the cache server and routers. -In combination with a BGP Prefix Origin Validation scheme a router is able -to verify received BGP updates without suffering from cryptographic -complexity. - - -The RPKI/RTR protocol is defined in @cite{RFC6810, The Resource Public Key -Infrastructure (RPKI) to Router Protocol}, and the validation scheme in -@cite{RFC6811, BGP Prefix Origin Validation}. The current version of Prefix -Origin Validation in FRR implements both RFCs. - -For a more detailed but still easy-to-read background, we suggest the -following two articles: -@enumerate -@item @cite{Geoff Huston, Randy Bush: Securing BGP, In: The Internet -Protocol Journal, Volume 14, No. 2, 2011.} -@uref{http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_14-2/142_bgp.html} - -@item @cite{Geoff Huston: Resource Certification, In: The Internet Protocol -Journal, Volume 12, No.1, 2009.} -@uref{http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_12-1/121_resource.html} -@end enumerate - -@menu -* Features of the Current Implementation:: -* Enabling RPKI:: -* Configuring RPKI/RTR Cache Servers:: -* Validating BGP Updates:: -* Debugging:: -* Displaying RPKI:: -* RPKI Configuration Example:: -@end menu - -@node Features of the Current Implementation -@subsection Features of the Current Implementation - -In a nutshell, the current implementation provides the following features -@itemize @bullet -@item The BGP router can connect to one or more RPKI cache servers to -receive validated prefix to origin AS mappings. -Advanced failover can be implemented by server sockets with different -preference values. - -@item If no connection to an RPKI cache server can be established after a -pre-defined timeout, the router will process routes without prefix origin -validation. It still will try to establish a connection to an RPKI cache -server in the background. - -@item By default, enabling RPKI does not change best path selection. In -particular, invalid prefixes will still be considered during best path -selection. However, the router can be configured to ignore all invalid -prefixes. - -@item Route maps can be configured to match a specific RPKI validation -state. This allows the creation of local policies, which handle BGP routes -based on the outcome of the Prefix Origin Validation. - -@c @item When the router receives updated validation information from the RPKI -@c cache server, all routes in the local routing table will be re-evaluated. - -@end itemize - - -@node Enabling RPKI -@subsection Enabling RPKI -@deffn {Command} {rpki} {} -This command enables the RPKI configuration mode. Most commands that start -with @command{rpki} can only be used in this mode. - -When it is used in a telnet session, leaving of this mode cause rpki to be initialized. - -Executing this command alone does not activate prefix -validation. You need to configure at least one reachable cache server. See section -@ref{Configuring RPKI/RTR Cache Servers} for configuring a cache server. -@end deffn - -@node Configuring RPKI/RTR Cache Servers -@subsection Configuring RPKI/RTR Cache Servers - -The following commands are independent of a specific cache server. - -@deffn {RPKI Command} {rpki polling_period <1-3600>} {} -@deffnx {RPKI Command} {no rpki polling_period} {} -Set the number of seconds the router waits until the router asks the cache again -for updated data. - -The default value is 300 seconds. -@end deffn - -@deffn {RPKI Command} {rpki timeout <1-4,294,967,296>} {} -@deffnx {RPKI Command} {no rpki timeout} {} -Set the number of seconds the router waits for the cache reply. If the -cache server is not replying within this time period, the router deletes -all received prefix records from the prefix table. - -The default value is 600 seconds. -@end deffn - -@deffn {RPKI Command} {rpki initial-synchronisation-timeout <1-4,294,967,296>} {} -@deffnx {RPKI Command} {no rpki initial-synchronisation-timeout} {} -Set the number of seconds until the first synchronization with the cache -server needs to be completed. If the timeout expires, BGP routing is -started without RPKI. The router will try to establish the cache server -connection in the background. - -The default value is 30 seconds. -@end deffn - -@noindent The following commands configure one or multiple cache servers. - -@deffn {RPKI Socket Command} {rpki cache (@var{A.B.C.D}|@var{WORD}) @var{PORT} [@var{SSH_USERNAME}] [@var{SSH_PRIVKEY_PATH}] [@var{SSH_PUBKEY_PATH}] [@var{KNOWN_HOSTS_PATH}] @var{PREFERENCE}} {} -@deffnx {RPKI Socket Command} {no rpki cache (@var{A.B.C.D}|@var{WORD}) [@var{PORT}] @var{PREFERENCE}} {} -Add a cache server to the socket. By default, the connection between -router and cache server is based on plain TCP. Protecting the connection -between router and cache server by SSH is optional. -Deleting a socket removes the associated cache server and -terminates the existing connection. -@end deffn - -@table @code -@item @var{A.B.C.D}|@var{WORD} -Address of the cache server. - -@item @var{PORT} -Port number to connect to the cache server - -@item @var{SSH_USERNAME} -SSH username to establish an SSH connection to the cache server. - -@item @var{SSH_PRIVKEY_PATH} -Local path that includes the private key file of the router. - -@item @var{SSH_PUBKEY_PATH} -Local path that includes the public key file of the router. - -@item @var{KNOWN_HOSTS_PATH} -Local path that includes the known hosts file. The default value depends on the -configuration of the operating system environment, usually -@file{~/.ssh/known_hosts}. - -@end table - -@node Validating BGP Updates -@subsection Validating BGP Updates - -@deffn {Route Map Command} {match rpki @{notfound|invalid|valid@}} {} -@deffnx {Route Map Command} {no match rpki @{notfound|invalid|valid@}} {} -Create a clause for a route map to match prefixes with the specified RPKI state. - -@strong{Note} that the matching of invalid prefixes requires that invalid -prefixes are considered for best path selection, i.e., @command{bgp -bestpath prefix-validate disallow-invalid} is not enabled. - -In the following example, the router prefers valid routes over invalid -prefixes because invalid routes have a lower local preference. -@example - ! Allow for invalid routes in route selection process - route bgp 60001 - ! - ! Set local preference of invalid prefixes to 10 - route-map rpki permit 10 - match rpki invalid - set local-preference 10 - ! - ! Set local preference of valid prefixes to 500 - route-map rpki permit 500 - match rpki valid - set local-preference 500 -@end example - -@end deffn - -@node Debugging -@subsection Debugging - -@deffn {Command} {debug rpki} {} -@deffnx {Command} {no debug rpki} {} -Enable or disable debugging output for RPKI. -@end deffn - - -@node Displaying RPKI -@subsection Displaying RPKI - -@deffn {Command} {show rpki prefix-table} {} -Display all validated prefix to origin AS mappings/records which have been -received from the cache servers and stored in the router. Based on this data, -the router validates BGP Updates. -@end deffn - -@deffn {Command} {show rpki cache-connection} {} -Display all configured cache servers, whether active or not. -@end deffn - -@node RPKI Configuration Example -@subsection RPKI Configuration Example - - -@example -hostname bgpd1 -password zebra -! log stdout -debug bgp updates -debug bgp keepalives -debug rpki -! -rpki - rpki polling_period 1000 - rpki timeout 10 - ! SSH Example: - rpki cache example.com 22 rtr-ssh ./ssh_key/id_rsa ./ssh_key/id_rsa.pub preference 1 - ! TCP Example: - rpki cache rpki-validator.realmv6.org 8282 preference 2 - exit -! -router bgp 60001 - bgp router-id 141.22.28.223 - network 192.168.0.0/16 - neighbor 123.123.123.0 remote-as 60002 - neighbor 123.123.123.0 route-map rpki in -! - address-family ipv6 - neighbor 123.123.123.0 activate - neighbor 123.123.123.0 route-map rpki in - exit-address-family -! -route-map rpki permit 10 - match rpki invalid - set local-preference 10 -! -route-map rpki permit 20 - match rpki notfound - set local-preference 20 -! -route-map rpki permit 30 - match rpki valid - set local-preference 30 -! -route-map rpki permit 40 -! -@end example diff --git a/doc/snmp.texi b/doc/snmp.texi deleted file mode 100644 index d9656941d..000000000 --- a/doc/snmp.texi +++ /dev/null @@ -1,189 +0,0 @@ -@node SNMP Support -@chapter SNMP Support - -@acronym{SNMP,Simple Network Managing Protocol} is a widely implemented -feature for collecting network information from router and/or host. -Frr itself does not support SNMP agent (server daemon) functionality -but is able to connect to a SNMP agent using the SMUX protocol -(@cite{RFC1227}) or the AgentX protocol (@cite{RFC2741}) and make the -routing protocol MIBs available through it. - -Note that SNMP Support needs to be enabled at compile-time and loaded as -module on daemon startup. Refer to @ref{Loadable Module Support} on -the latter. - -@menu -* Getting and installing an SNMP agent:: -* AgentX configuration:: -* SMUX configuration:: -* MIB and command reference:: -* Handling SNMP Traps:: -@end menu - -@node Getting and installing an SNMP agent -@section Getting and installing an SNMP agent - -There are several SNMP agent which support SMUX or AgentX. We recommend to use the latest -version of @code{net-snmp} which was formerly known as @code{ucd-snmp}. -It is free and open software and available at @uref{http://www.net-snmp.org/} -and as binary package for most Linux distributions. -@code{net-snmp} has to be compiled with @code{--with-mib-modules=agentx} to -be able to accept connections from Frr using AgentX protocol or with -@code{--with-mib-modules=smux} to use SMUX protocol. - -Nowadays, SMUX is a legacy protocol. The AgentX protocol should be -preferred for any new deployment. Both protocols have the same coverage. - -@node AgentX configuration -@section AgentX configuration - -To enable AgentX protocol support, Frr must have been build with the -@code{--enable-snmp} or @code{--enable-snmp=agentx} option. Both the -master SNMP agent (snmpd) and each of the Frr daemons must be -configured. In @code{/etc/snmp/snmpd.conf}, @code{master agentx} -directive should be added. In each of the Frr daemons, @code{agentx} -command will enable AgentX support. - -@example -/etc/snmp/snmpd.conf: - # - # example access restrictions setup - # - com2sec readonly default public - group MyROGroup v1 readonly - view all included .1 80 - access MyROGroup "" any noauth exact all none none - # - # enable master agent for AgentX subagents - # - master agentx - -/etc/frr/ospfd.conf: - ! ... the rest of ospfd.conf has been omitted for clarity ... - ! - agentx - ! -@end example - -Upon successful connection, you should get something like this in the -log of each Frr daemons: - -@example -2012/05/25 11:39:08 ZEBRA: snmp[info]: NET-SNMP version 5.4.3 AgentX subagent connected -@end example - -Then, you can use the following command to check everything works as expected: - -@example -# snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1 -OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109 -[...] -@end example - -The AgentX protocol can be transported over a Unix socket or using TCP -or UDP. It usually defaults to a Unix socket and depends on how NetSNMP -was built. If need to configure Frr to use another transport, you can -configure it through @code{/etc/snmp/frr.conf}: - -@example -/etc/snmp/frr.conf: - [snmpd] - # Use a remote master agent - agentXSocket tcp:192.168.15.12:705 -@end example - -@node SMUX configuration -@section SMUX configuration - -To enable SMUX protocol support, Frr must have been build with the -@code{--enable-snmp=smux} option. - -A separate connection has then to be established between the -SNMP agent (snmpd) and each of the Frr daemons. This connections -each use different OID numbers and passwords. Be aware that this OID -number is not the one that is used in queries by clients, it is solely -used for the intercommunication of the daemons. - -In the following example the ospfd daemon will be connected to the -snmpd daemon using the password "frr_ospfd". For testing it is -recommending to take exactly the below snmpd.conf as wrong access -restrictions can be hard to debug. - -@example -/etc/snmp/snmpd.conf: - # - # example access restrictions setup - # - com2sec readonly default public - group MyROGroup v1 readonly - view all included .1 80 - access MyROGroup "" any noauth exact all none none - # - # the following line is relevant for Frr - # - smuxpeer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd - -/etc/frr/ospf: - ! ... the rest of ospfd.conf has been omitted for clarity ... - ! - smux peer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd - ! -@end example - -After restarting snmpd and frr, a successful connection can be verified in -the syslog and by querying the SNMP daemon: - -@example -snmpd[12300]: [smux_accept] accepted fd 12 from 127.0.0.1:36255 -snmpd[12300]: accepted smux peer: \ - oid GNOME-PRODUCT-ZEBRA-MIB::ospfd, frr-0.96.5 - -# snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1 -OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109 -@end example - -Be warned that the current version (5.1.1) of the Net-SNMP daemon writes a line -for every SNMP connect to the syslog which can lead to enormous log file sizes. -If that is a problem you should consider to patch snmpd and comment out the -troublesome @code{snmp_log()} line in the function -@code{netsnmp_agent_check_packet()} in @code{agent/snmp_agent.c}. - -@node MIB and command reference -@section MIB and command reference - -The following OID numbers are used for the interprocess communication of snmpd and -the Frr daemons with SMUX only. -@example - (OIDs below .iso.org.dod.internet.private.enterprises) -zebra .1.3.6.1.4.1.3317.1.2.1 .gnome.gnomeProducts.zebra.zserv -bgpd .1.3.6.1.4.1.3317.1.2.2 .gnome.gnomeProducts.zebra.bgpd -ripd .1.3.6.1.4.1.3317.1.2.3 .gnome.gnomeProducts.zebra.ripd -ospfd .1.3.6.1.4.1.3317.1.2.5 .gnome.gnomeProducts.zebra.ospfd -ospf6d .1.3.6.1.4.1.3317.1.2.6 .gnome.gnomeProducts.zebra.ospf6d -@end example - -Sadly, SNMP has not been implemented in all daemons yet. The following -OID numbers are used for querying the SNMP daemon by a client: -@example -zebra .1.3.6.1.2.1.4.24 .iso.org.dot.internet.mgmt.mib-2.ip.ipForward -ospfd .1.3.6.1.2.1.14 .iso.org.dot.internet.mgmt.mib-2.ospf -bgpd .1.3.6.1.2.1.15 .iso.org.dot.internet.mgmt.mib-2.bgp -ripd .1.3.6.1.2.1.23 .iso.org.dot.internet.mgmt.mib-2.rip2 -ospf6d .1.3.6.1.3.102 .iso.org.dod.internet.experimental.ospfv3 -@end example - -The following syntax is understood by the Frr daemons for configuring SNMP using SMUX: -@deffn {Command} {smux peer @var{oid}} {} -@deffnx {Command} {no smux peer @var{oid}} {} -@end deffn - -@deffn {Command} {smux peer @var{oid} @var{password}} {} -@deffnx {Command} {no smux peer @var{oid} @var{password}} {} -@end deffn - -Here is the syntax for using AgentX: -@deffn {Command} {agentx} {} -@deffnx {Command} {no agentx} {} -@end deffn - -@include snmptrap.texi diff --git a/doc/snmptrap.texi b/doc/snmptrap.texi deleted file mode 100644 index 0dd3a703a..000000000 --- a/doc/snmptrap.texi +++ /dev/null @@ -1,205 +0,0 @@ -@c Documentation on configuring Frr and snmpd for SNMP traps -@c contributed by Jeroen Simonetti, jsimonetti@denit.net - -@node Handling SNMP Traps -@section Handling SNMP Traps - -To handle snmp traps make sure your snmp setup of frr works -correctly as described in the frr documentation in @xref{SNMP Support}. - -The BGP4 mib will send traps on peer up/down events. These should be -visible in your snmp logs with a message similar to: - -@samp{snmpd[13733]: Got trap from peer on fd 14} - -To react on these traps they should be handled by a trapsink. Configure -your trapsink by adding the following lines to @file{/etc/snmpd/snmpd.conf}: - -@example - # send traps to the snmptrapd on localhost - trapsink localhost -@end example - -This will send all traps to an snmptrapd running on localhost. You can -of course also use a dedicated management station to catch traps. -Configure the snmptrapd daemon by adding the following line to -@file{/etc/snmpd/snmptrapd.conf}: - -@c Documentation contributed by Jeroen Simonetti, jsimonetti@denit.net - -@example - traphandle .1.3.6.1.4.1.3317.1.2.2 /etc/snmp/snmptrap_handle.sh -@end example - -This will use the bash script @file{/etc/snmp/snmptrap_handle.sh} to handle -the BGP4 traps. To add traps for other protocol daemons, lookup their -appropriate OID from their mib. (For additional information about which -traps are supported by your mib, lookup the mib on -@uref{http://www.oidview.com/mibs/detail.html}). - -Make sure snmptrapd is started. - -The snmptrap_handle.sh script I personally use for handling BGP4 traps -is below. You can of course do all sorts of things when handling traps, -like sound a siren, have your display flash, etc., be creative ;). - -@verbatim - #!/bin/bash - - # routers name - ROUTER=`hostname -s` - - #email address use to sent out notification - EMAILADDR="john@doe.com" - #email address used (allongside above) where warnings should be sent - EMAILADDR_WARN="sms-john@doe.com" - - # type of notification - TYPE="Notice" - - # local snmp community for getting AS belonging to peer - COMMUNITY="<community>" - - # if a peer address is in $WARN_PEERS a warning should be sent - WARN_PEERS="192.0.2.1" - - - # get stdin - INPUT=`cat -` - - # get some vars from stdin - uptime=`echo $INPUT | cut -d' ' -f5` - peer=`echo $INPUT | cut -d' ' -f8 | sed -e 's/SNMPv2-SMI::mib-2.15.3.1.14.//g'` - peerstate=`echo $INPUT | cut -d' ' -f13` - errorcode=`echo $INPUT | cut -d' ' -f9 | sed -e 's/\"//g'` - suberrorcode=`echo $INPUT | cut -d' ' -f10 | sed -e 's/\"//g'` - remoteas=`snmpget -v2c -c $COMMUNITY localhost SNMPv2-SMI::mib-2.15.3.1.9.$peer | cut -d' ' -f4` - - WHOISINFO=`whois -h whois.ripe.net " -r AS$remoteas" | egrep '(as-name|descr)'` - asname=`echo "$WHOISINFO" | grep "^as-name:" | sed -e 's/^as-name://g' -e 's/ //g' -e 's/^ //g' | uniq` - asdescr=`echo "$WHOISINFO" | grep "^descr:" | sed -e 's/^descr://g' -e 's/ //g' -e 's/^ //g' | uniq` - - # if peer address is in $WARN_PEER, the email should also - # be sent to $EMAILADDR_WARN - for ip in $WARN_PEERS; do - if [ "x$ip" == "x$peer" ]; then - EMAILADDR="$EMAILADDR,$EMAILADDR_WARN" - TYPE="WARNING" - break - fi - done - - - # convert peer state - case "$peerstate" in - 1) peerstate="Idle" ;; - 2) peerstate="Connect" ;; - 3) peerstate="Active" ;; - 4) peerstate="Opensent" ;; - 5) peerstate="Openconfirm" ;; - 6) peerstate="Established" ;; - *) peerstate="Unknown" ;; - esac - - # get textual messages for errors - case "$errorcode" in - 00) - error="No error" - suberror="" - ;; - 01) - error="Message Header Error" - case "$suberrorcode" in - 01) suberror="Connection Not Synchronized" ;; - 02) suberror="Bad Message Length" ;; - 03) suberror="Bad Message Type" ;; - *) suberror="Unknown" ;; - esac - ;; - 02) - error="OPEN Message Error" - case "$suberrorcode" in - 01) suberror="Unsupported Version Number" ;; - 02) suberror="Bad Peer AS" ;; - 03) suberror="Bad BGP Identifier" ;; - 04) suberror="Unsupported Optional Parameter" ;; - 05) suberror="Authentication Failure" ;; - 06) suberror="Unacceptable Hold Time" ;; - *) suberror="Unknown" ;; - esac - ;; - 03) - error="UPDATE Message Error" - case "$suberrorcode" in - 01) suberror="Malformed Attribute List" ;; - 02) suberror="Unrecognized Well-known Attribute" ;; - 03) suberror="Missing Well-known Attribute" ;; - 04) suberror="Attribute Flags Error" ;; - 05) suberror="Attribute Length Error" ;; - 06) suberror="Invalid ORIGIN Attribute" ;; - 07) suberror="AS Routing Loop" ;; - 08) suberror="Invalid NEXT_HOP Attribute" ;; - 09) suberror="Optional Attribute Error" ;; - 10) suberror="Invalid Network Field" ;; - 11) suberror="Malformed AS_PATH" ;; - *) suberror="Unknown" ;; - esac - ;; - 04) - error="Hold Timer Expired" - suberror="" - ;; - 05) - error="Finite State Machine Error" - suberror="" - ;; - 06) - error="Cease" - case "$suberrorcode" in - 01) suberror="Maximum Number of Prefixes Reached" ;; - 02) suberror="Administratively Shutdown" ;; - 03) suberror="Peer Unconfigured" ;; - 04) suberror="Administratively Reset" ;; - 05) suberror="Connection Rejected" ;; - 06) suberror="Other Configuration Change" ;; - 07) suberror="Connection collision resolution" ;; - 08) suberror="Out of Resource" ;; - 09) suberror="MAX" ;; - *) suberror="Unknown" ;; - esac - ;; - *) - error="Unknown" - suberror="" - ;; - esac - - # create textual message from errorcodes - if [ "x$suberror" == "x" ]; then - NOTIFY="$errorcode ($error)" - else - NOTIFY="$errorcode/$suberrorcode ($error/$suberror)" - fi - - - # form a decent subject - SUBJECT="$TYPE: $ROUTER [bgp] $peer is $peerstate: $NOTIFY" - # create the email body - MAIL=`cat << EOF - BGP notification on router $ROUTER. - - Peer: $peer - AS: $remoteas - New state: $peerstate - Notification: $NOTIFY - - Info: - $asname - $asdescr - - Snmpd uptime: $uptime - EOF` - - # mail the notification - echo "$MAIL" | mail -s "$SUBJECT" $EMAILADDR -@end verbatim diff --git a/doc/user/.gitignore b/doc/user/.gitignore new file mode 100644 index 000000000..050553715 --- /dev/null +++ b/doc/user/.gitignore @@ -0,0 +1,3 @@ +/_templates +/_build +!/Makefile diff --git a/doc/user/Makefile b/doc/user/Makefile new file mode 100644 index 000000000..223f8a64a --- /dev/null +++ b/doc/user/Makefile @@ -0,0 +1,55 @@ +include ../frr-sphinx.mk + +# ----------------------------------------------------------------------------- +# Automake requires that 3rd-party Makefiles recognize these targets. +# ----------------------------------------------------------------------------- +# install +# install-data +# install-exec +# uninstall +# install-dvi +# install-html +# install-info +# install-ps +# install-pdf +# installdirs +# check +# installcheck +# mostlyclean +# clean +# distclean +# maintainer-clean +# dvi +# pdf +# ps +# info +# html +# tags +# ctags + +# ignore these targets +EMPTY_AUTOMAKE_TARGETS = dvi ps tags ctags distdir install-exec install-dvi install-ps installdirs check installcheck install-html install-pdf install-data install +.PHONY: $(EMPTY_AUTOMAKE_TARGETS) +$(EMPTY_AUTOMAKE_TARGETS): + +# When building 'all', the logic is that we want to make docs that are easily +# readable by the person that just built them. Technically the reST source is +# readable in its own right, but we'll also build info and html because those +# offer sequentially better reading experiences. PDF is not built by default +# because it takes quite a while. +all: info + +# info and html already have built-in sphinx rules; pdf goes to latexpdf +pdf: latexpdf + +# install user manual as info file +install-info: info + install -d ${DESTDIR}${infodir} + gzip < _build/texinfo/frr.info > ${DESTDIR}${infodir}/frr.info.gz + install-info _build/texinfo/frr.info ${DESTDIR}${infodir}/dir + +install-data: install-info + +install: install-data + +mostlyclean distclean maintainer-clean: clean diff --git a/doc/Useful_Sysctl_Settings.md b/doc/user/Useful_Sysctl_Settings.md index 4244b5fdf..4244b5fdf 100644 --- a/doc/Useful_Sysctl_Settings.md +++ b/doc/user/Useful_Sysctl_Settings.md diff --git a/doc/user/appendix.rst b/doc/user/appendix.rst new file mode 100644 index 000000000..6120c3b98 --- /dev/null +++ b/doc/user/appendix.rst @@ -0,0 +1,221 @@ +.. _packet-binary-dump-format: + +Packet Binary Dump Format +========================= + +FRR can dump routing protocol packets into a file with a binary format. + +It seems to be better that we share the MRT's header format for +backward compatibility with MRT's dump logs. We should also define the +binary format excluding the header, because we must support both IP +v4 and v6 addresses as socket addresses and / or routing entries. + +In the last meeting, we discussed to have a version field in the +header. But Masaki told us that we can define new 'type' value rather +than having a 'version' field, and it seems to be better because we +don't need to change header format. + +Here is the common header format. This is same as that of MRT.:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Subtype | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + +If 'type' is PROTOCOL_BGP4MP_ET, the common header format will +contain an additional microsecond field (RFC6396 2011).:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Type | Subtype | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Microsecond | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_STATE_CHANGE, and +Address Family == IP (version 4):: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source AS number | Destination AS number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Interface Index | Address Family | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Old State | New State | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Where State is the value defined in RFC1771. + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_STATE_CHANGE, +and Address Family == IP version 6:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source AS number | Destination AS number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Interface Index | Address Family | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Old State | New State | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_MESSAGE, +and Address Family == IP (version 4):: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source AS number | Destination AS number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Interface Index | Address Family | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | BGP Message Packet | + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Where BGP Message Packet is the whole contents of the +BGP4 message including header portion. + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_MESSAGE, +and Address Family == IP version 6:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source AS number | Destination AS number | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Interface Index | Address Family | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Source IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Destination IP address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | BGP Message Packet | + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_ENTRY, +and Address Family == IP (version 4):: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | View # | Status | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time Last Change | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Address Family | SAFI | Next-Hop-Len | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next Hop Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Prefix Length | Address Prefix [variable] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Attribute Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | BGP Attribute [variable length] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +If 'type' is PROTOCOL_BGP4MP, 'subtype' is BGP4MP_ENTRY, +and Address Family == IP version 6:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | View # | Status | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Time Last Change | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Address Family | SAFI | Next-Hop-Len | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next Hop Address | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next Hop Address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next Hop Address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next Hop Address (Cont'd) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Prefix Length | Address Prefix [variable] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Address Prefix (cont'd) [variable] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Attribute Length | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | BGP Attribute [variable length] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +BGP4 Attribute must not contain MP_UNREACH_NLRI. If BGP Attribute has +MP_REACH_NLRI field, it must has zero length NLRI, e.g., MP_REACH_NLRI has only +Address Family, SAFI and next-hop values. + +If 'type' is PROTOCOL_BGP4MP and 'subtype' is BGP4MP_SNAPSHOT:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | View # | File Name [variable] | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +The file specified in "File Name" contains all routing entries, +which are in the format of ``subtype == BGP4MP_ENTRY``. + +:: + + Constants: + + /\* type value \*/ + #define MSG_PROTOCOL_BGP4MP 16 + #define MSG_PROTOCOL_BGP4MP_ET 17 + /\* subtype value \*/ + #define BGP4MP_STATE_CHANGE 0 + #define BGP4MP_MESSAGE 1 + #define BGP4MP_ENTRY 2 + #define BGP4MP_SNAPSHOT 3 diff --git a/doc/user/babeld.rst b/doc/user/babeld.rst new file mode 100644 index 000000000..d46550d97 --- /dev/null +++ b/doc/user/babeld.rst @@ -0,0 +1,291 @@ +.. _babel: + +***** +Babel +***** + +Babel is an interior gateway protocol that is suitable both for wired networks +and for wireless mesh networks. Babel has been described as 'RIP on speed' -- +it is based on the same principles as RIP, but includes a number of refinements +that make it react much faster to topology changes without ever counting to +infinity, and allow it to perform reliable link quality estimation on wireless +links. Babel is a double-stack routing protocol, meaning that a single Babel +instance is able to perform routing for both IPv4 and IPv6. + +FRR implements Babel as described in :rfc:`6126`. + +.. _configuring-babeld: + +Configuring babeld +================== + +The *babeld* daemon can be invoked with any of the common +options (:ref:`common-invocation-options`). + +The *zebra* daemon must be running before *babeld* is +invoked. Also, if *zebra* is restarted then *babeld* +must be too. + +Configuration of *babeld* is done in its configuration file +:file:`babeld.conf`. + +.. _babel-configuration: + +Babel configuration +=================== + +.. index:: + single: router babel + single: no router babel + +.. clicmd:: [no] router babel + + Enable or disable Babel routing. + +.. index:: + single: babel resend-delay (20-655340) + single: no babel resend-delay [(20-655340)] + +.. clicmd:: [no] babel resend-delay (20-655340) + + Specifies the time after which important messages are resent when + avoiding a black-hole. The default is 2000 ms. + +.. index:: + single: babel diversity + single: no babel diversity + +.. clicmd:: [no] babel diversity + + Enable or disable routing using radio frequency diversity. This is + highly recommended in networks with many wireless nodes. + If you enable this, you will probably want to set `babel + diversity-factor` and `babel channel` below. + +.. index:: babel diversity-factor (1-256) + +.. clicmd:: babel diversity-factor (1-256) + + Sets the multiplicative factor used for diversity routing, in units of + 1/256; lower values cause diversity to play a more important role in + route selection. The default it 256, which means that diversity plays + no role in route selection; you will probably want to set that to 128 + or less on nodes with multiple independent radios. + +.. index:: + single: network IFNAME + single: no network IFNAME + +.. clicmd:: no network IFNAME + + Enable or disable Babel on the given interface. + +.. index:: babel <wired|wireless> + +.. clicmd:: babel <wired|wireless> + + Specifies whether this interface is wireless, which disables a number + of optimisations that are only correct on wired interfaces. + Specifying `wireless` (the default) is always correct, but may + cause slower convergence and extra routing traffic. + +.. index:: + single: babel split-horizon + single: no babel split-horizon + +.. clicmd:: [no] babel split-horizon + + Specifies whether to perform split-horizon on the interface. Specifying + ``no babel split-horizon`` is always correct, while ``babel + split-horizon`` is an optimisation that should only be used on symmetric + and transitive (wired) networks. The default is ``babel split-horizon`` + on wired interfaces, and ``no babel split-horizon`` on wireless + interfaces. This flag is reset when the wired/wireless status of an + interface is changed. + +.. index:: babel hello-interval (20-655340) + +.. clicmd:: babel hello-interval (20-655340) + + Specifies the time in milliseconds between two scheduled hellos. On + wired links, Babel notices a link failure within two hello intervals; + on wireless links, the link quality value is reestimated at every + hello interval. The default is 4000 ms. + +.. index:: babel update-interval (20-655340) + +.. clicmd:: babel update-interval (20-655340) + + Specifies the time in milliseconds between two scheduled updates. Since + Babel makes extensive use of triggered updates, this can be set to fairly + high values on links with little packet loss. The default is 20000 ms. + +.. index:: + single: babel channel (1-254) + single: babel channel interfering + single: babel channel noninterfering + +.. clicmd:: babel channel (1-254) +.. clicmd:: babel channel interfering +.. clicmd:: babel channel noninterfering + + Set the channel number that diversity routing uses for this interface (see + `babel diversity` above). Noninterfering interfaces are assumed to only + interfere with themselves, interfering interfaces are assumed to interfere + with all other channels except noninterfering channels, and interfaces with + a channel number interfere with interfering interfaces and interfaces with + the same channel number. The default is ``babel channel interfering`` for + wireless interfaces, and ``babel channel noninterfering`` for wired + interfaces. This is reset when the wired/wireless status of an interface is + changed. + +.. index:: babel rxcost (1-65534) + +.. clicmd:: babel rxcost (1-65534) + + Specifies the base receive cost for this interface. For wireless + interfaces, it specifies the multiplier used for computing the ETX + reception cost (default 256); for wired interfaces, it specifies the + cost that will be advertised to neighbours. This value is reset when + the wired/wireless attribute of the interface is changed. + +.. note:: + Do not use this command unless you know what you are doing; in most + networks, acting directly on the cost using route maps is a better + technique. + +.. index:: babel rtt-decay (1-256) + +.. clicmd:: babel rtt-decay (1-256) + + This specifies the decay factor for the exponential moving average of + RTT samples, in units of 1/256. Higher values discard old samples + faster. The default is 42. + +.. index:: babel rtt-min (1-65535) + +.. clicmd:: babel rtt-min (1-65535) + + This specifies the minimum RTT, in milliseconds, starting from which we + increase the cost to a neighbour. The additional cost is linear in + (rtt - rtt-min). The default is 100 ms. + +.. index:: babel rtt-max (1-65535) + +.. clicmd:: babel rtt-max (1-65535) + + This specifies the maximum RTT, in milliseconds, above which we don't + increase the cost to a neighbour. The default is 120 ms. + +.. index:: babel max-rtt-penalty (0-65535) + +.. clicmd:: babel max-rtt-penalty (0-65535) + + This specifies the maximum cost added to a neighbour because of RTT, i.e. + when the RTT is higher or equal than rtt-max. The default is 0, which + effectively disables the use of a RTT-based cost. + +.. index:: + single: babel enable-timestamps + single: no babel enable-timestamps + +.. clicmd:: [no] babel enable-timestamps + + Enable or disable sending timestamps with each Hello and IHU message in + order to compute RTT values. The default is `no babel enable-timestamps`. + +.. index:: babel resend-delay (20-655340) + +.. clicmd:: babel resend-delay (20-655340) + + Specifies the time in milliseconds after which an 'important' request or + update will be resent. The default is 2000 ms. You probably don't want to + tweak this value. + +.. index:: babel smoothing-half-life (0-65534) + +.. clicmd:: babel smoothing-half-life (0-65534) + + Specifies the time constant, in seconds, of the smoothing algorithm used for + implementing hysteresis. Larger values reduce route oscillation at the cost + of very slightly increasing convergence time. The value 0 disables + hysteresis, and is suitable for wired networks. The default is 4 s. + +.. _babel-redistribution: + +Babel redistribution +==================== + +.. index:: + single: redistribute <ipv4|ipv6> KIND + single: no redistribute <ipv4|ipv6> KIND + +.. clicmd:: [no] redistribute <ipv4|ipv6> KIND + + Specify which kind of routes should be redistributed into Babel. + +.. _show-babel-information: + +Show Babel information +====================== + +These commands dump various parts of *babeld*'s internal state. + +.. index:: show babel route + +.. clicmd:: show babel route + +.. index:: show babel route A.B.C.D + +.. clicmd:: show babel route A.B.C.D + +.. index:: show babel route X:X::X:X + +.. clicmd:: show babel route X:X::X:X + +.. index:: show babel route A.B.C.D/M + +.. clicmd:: show babel route A.B.C.D/M + +.. index:: show babel route X:X::X:X/M + +.. clicmd:: show babel route X:X::X:X/M + +.. index:: show babel interface + +.. clicmd:: show babel interface + +.. index:: show babel interface IFNAME + +.. clicmd:: show babel interface IFNAME + +.. index:: show babel neighbor + +.. clicmd:: show babel neighbor + +.. index:: show babel parameters + +.. clicmd:: show babel parameters + +Babel debugging commands +======================== + +.. index:: + simple: debug babel KIND + simple: no debug babel KIND + +.. clicmd:: [no] debug babel KIND + + Enable or disable debugging messages of a given kind. ``KIND`` can + be one of: + + - ``common`` + - ``filter`` + - ``timeout`` + - ``interface`` + - ``route`` + - ``all`` + +.. note:: + If you have compiled with the ``NO_DEBUG`` flag, then these commands aren't + available. diff --git a/doc/user/basic.rst b/doc/user/basic.rst new file mode 100644 index 000000000..29d05abba --- /dev/null +++ b/doc/user/basic.rst @@ -0,0 +1,642 @@ +.. _basic-commands: + +************** +Basic commands +************** + +There are five routing daemons in use, and there is one manager daemon. +These daemons may be located on separate machines from the manager +daemon. Each of these daemons will listen on a particular port for +incoming VTY connections. The routing daemons are: + +- *ripd* +- *ripngd* +- *ospfd* +- *ospf6d* +- *bgpd* +- *zebra* + +The following sections discuss commands common to all the routing +daemons. + +.. _config-commands: + +Config Commands +=============== + +.. index:: Configuration files for running the software + +.. index:: Files for running configurations + +.. index:: Modifying the herd's behavior + +.. index:: Getting the herd running + +In a config file, you can write the debugging options, a vty's password, +routing daemon configurations, a log file name, and so forth. This +information forms the initial command set for a routing beast as it is +starting. + +Config files are generally found in |INSTALL_PREFIX_ETC|. + +Each of the daemons has its own config file. The daemon name plus ``.conf`` is +the default config file name. For example, zebra's default config file name is +:file:`zebra.conf`. You can specify a config file using the :option:`-f` or +:option:`--config-file` options when starting the daemon. + +.. _basic-config-commands: + +Basic Config Commands +--------------------- + +.. index:: hostname HOSTNAME + +.. clicmd:: hostname HOSTNAME + + Set hostname of the router. + +.. index:: password PASSWORD + +.. clicmd:: password PASSWORD + + Set password for vty interface. If there is no password, a vty won't + accept connections. + +.. index:: enable password PASSWORD + +.. clicmd:: enable password PASSWORD + + Set enable password. + +.. index:: + single: no log trap [LEVEL] + single: log trap LEVEL + +.. clicmd:: [no] log trap LEVEL + + These commands are deprecated and are present only for historical + compatibility. The log trap command sets the current logging level for all + enabled logging destinations, and it sets the default for all future logging + commands that do not specify a level. The normal default logging level is + debugging. The ``no`` form of the command resets the default level for future + logging commands to debugging, but it does not change the logging level of + existing logging destinations. + +.. index:: + single: no log stdout [LEVEL] + single: log stdout [LEVEL] + +.. clicmd:: [no] log stdout LEVEL + + Enable logging output to stdout. If the optional second argument specifying + the logging level is not present, the default logging level (typically + debugging, but can be changed using the deprecated ``log trap`` command) will + be used. The ``no`` form of the command disables logging to stdout. The + ``LEVEL`` argument must have one of these values: emergencies, alerts, + critical, errors, warnings, notifications, informational, or debugging. Note + that the existing code logs its most important messages with severity + ``errors``. + +.. index:: + single: no log file [FILENAME [LEVEL]] + single: log file FILENAME [LEVEL] + +.. clicmd:: [no] log file [FILENAME [LEVEL]] + + If you want to log into a file, please specify ``filename`` as + in this example: :: + + log file /var/log/frr/bgpd.log informational + + If the optional second argument specifying the logging level is not present, + the default logging level (typically debugging, but can be changed using the + deprecated ``log trap`` command) will be used. The ``no`` form of the command + disables logging to a file. *Note:* if you do not configure any file logging, + and a daemon crashes due to a signal or an assertion failure, it will attempt + to save the crash information in a file named /var/tmp/frr.<daemon + name>.crashlog. For security reasons, this will not happen if the file exists + already, so it is important to delete the file after reporting the crash + information. + +.. index:: + single: no log syslog [LEVEL] + single: log syslog [LEVEL] + +.. clicmd:: [no] log syslog [LEVEL] + + Enable logging output to syslog. If the optional second argument specifying + the logging level is not present, the default logging level (typically + debugging, but can be changed using the deprecated ``log trap`` command) will + be used. The ``no`` form of the command disables logging to syslog. + +.. index:: + single: no log monitor [LEVEL] + single: log monitor [LEVEL] + +.. clicmd:: [no] log monitor [LEVEL] + + Enable logging output to vty terminals that have enabled logging using the + ``terminal monitor`` command. By default, monitor logging is enabled at the + debugging level, but this command (or the deprecated ``log trap`` command) can + be used to change the monitor logging level. If the optional second argument + specifying the logging level is not present, the default logging level + (typically debugging, but can be changed using the deprecated ``log trap`` + command) will be used. The ``no`` form of the command disables logging to + terminal monitors. + +.. index:: + single: no log facility [FACILITY] + single: log facility [FACILITY] + +.. clicmd:: [no] log facility [FACILITY] + + This command changes the facility used in syslog messages. The default + facility is ``daemon``. The ``no`` form of the command resets + the facility to the default ``daemon`` facility. + +.. index:: + single: no log record-priority + single: log record-priority + +.. clicmd:: [no] log record-priority + + To include the severity in all messages logged to a file, to stdout, or to + a terminal monitor (i.e. anything except syslog), + use the ``log record-priority`` global configuration command. + To disable this option, use the ``no`` form of the command. By default, + the severity level is not included in logged messages. Note: some + versions of syslogd (including Solaris) can be configured to include + the facility and level in the messages emitted. + +.. index:: + single: log timestamp precision (0-6) + single: [no] log timestamp precision (0-6) + +.. clicmd:: [no] log timestamp precision [(0-6)] + + This command sets the precision of log message timestamps to the given number + of digits after the decimal point. Currently, the value must be in the range + 0 to 6 (i.e. the maximum precision is microseconds). To restore the default + behavior (1-second accuracy), use the ``no`` form of the command, or set the + precision explicitly to 0. + +:: + + log timestamp precision 3 + + In this example, the precision is set to provide timestamps with + millisecond accuracy. + +.. index:: log commands + +.. clicmd:: log commands + + This command enables the logging of all commands typed by a user to + all enabled log destinations. The note that logging includes full + command lines, including passwords. Once set, command logging can only + be turned off by restarting the daemon. + +.. index:: service password-encryption + +.. clicmd:: service password-encryption + + Encrypt password. + +.. index:: service advanced-vty + +.. clicmd:: service advanced-vty + + Enable advanced mode VTY. + +.. index:: service terminal-length (0-512) + +.. clicmd:: service terminal-length (0-512) + + Set system wide line configuration. This configuration command applies + to all VTY interfaces. + +.. index:: line vty + +.. clicmd:: line vty + + Enter vty configuration mode. + +.. index:: banner motd default + +.. clicmd:: banner motd default + + Set default motd string. + +.. index:: no banner motd + +.. clicmd:: no banner motd + + No motd banner string will be printed. + +.. index:: exec-timeout MINUTE [SECOND] + +.. clicmd:: exec-timeout MINUTE [SECOND] + + Set VTY connection timeout value. When only one argument is specified + it is used for timeout value in minutes. Optional second argument is + used for timeout value in seconds. Default timeout value is 10 minutes. + When timeout value is zero, it means no timeout. + +.. index:: no exec-timeout + +.. clicmd:: no exec-timeout + + Do not perform timeout at all. This command is as same as *exec-timeout 0 0*. + +.. index:: access-class ACCESS-LIST + +.. clicmd:: access-class ACCESS-LIST + + Restrict vty connections with an access list. + +.. _sample-config-file: + +Sample Config File +------------------ + +Below is a sample configuration file for the zebra daemon. + +:: + + ! + ! Zebra configuration file + ! + hostname Router + password zebra + enable password zebra + ! + log stdout + ! + ! + + +'!' and '#' are comment characters. If the first character of the word +is one of the comment characters then from the rest of the line forward +will be ignored as a comment. + +:: + + password zebra!password + +If a comment character is not the first character of the word, it's a +normal character. So in the above example '!' will not be regarded as a +comment and the password is set to 'zebra!password'. + +.. _terminal-mode-commands: + +Terminal Mode Commands +====================== + +.. index:: write terminal + +.. clicmd:: write terminal + + Displays the current configuration to the vty interface. + +.. index:: write file + +.. clicmd:: write file + + Write current configuration to configuration file. + +.. index:: configure terminal + +.. clicmd:: configure terminal + + Change to configuration mode. This command is the first step to + configuration. + +.. index:: terminal length (0-512) + +.. clicmd:: terminal length (0-512) + + Set terminal display length to ``(0-512)``. If length is 0, no + display control is performed. + +.. index:: who + +.. clicmd:: who + + Show a list of currently connected vty sessions. + +.. index:: list + +.. clicmd:: list + + List all available commands. + +.. index:: show version + +.. clicmd:: show version + + Show the current version of |PACKAGE_NAME| and its build host information. + +.. index:: show logging + +.. clicmd:: show logging + + Shows the current configuration of the logging system. This includes + the status of all logging destinations. + +.. index:: logmsg LEVEL MESSAGE + +.. clicmd:: logmsg LEVEL MESSAGE + + Send a message to all logging destinations that are enabled for messages + of the given severity. + +.. _common-invocation-options: + +Common Invocation Options +========================= + +These options apply to all |PACKAGE_NAME| daemons. + + +.. option:: -d +.. option:: --daemon + + Run in daemon mode. + +.. option:: -f <file> +.. option:: --config-file <file> + + Set configuration file name. + +.. option:: -h, --help + + Display this help and exit. + +.. option:: -i <file> +.. option:: --pid-file <file> + + Upon startup the process identifier of the daemon is written to a file, + typically in :file:`/var/run`. This file can be used by the init system + to implement commands such as ``.../init.d/zebra status``, + ``.../init.d/zebra restart`` or ``.../init.d/zebra stop``. + + The file name is an run-time option rather than a configure-time option + so that multiple routing daemons can be run simultaneously. This is + useful when using |PACKAGE_NAME| to implement a routing looking glass. One + machine can be used to collect differing routing views from differing + points in the network. + +.. option:: -A <address> +.. option:: --vty-addr <address> + + Set the VTY local address to bind to. If set, the VTY socket will only + be bound to this address. + +.. option:: -P <port> +.. option:: --vty-port <port> + + Set the VTY TCP port number. If set to 0 then the TCP VTY sockets will not + be opened. + +.. option:: -u <user> +.. option:: --vty_addr <user> + + Set the user and group to run as. + +.. option:: -v +.. option:: --version + + Print program version. + +.. _loadable-module-support: + +Loadable Module Support +======================= + +FRR supports loading extension modules at startup. Loading, reloading or +unloading modules at runtime is not supported (yet). To load a module, use +the following command line option at daemon startup: + + +.. option:: -M <module:options> +.. option:: --module <module:options> + + Load the specified module, optionally passing options to it. If the module + name contains a slash (/), it is assumed to be a full pathname to a file to + be loaded. If it does not contain a slash, the |INSTALL_PREFIX_MODULES| + directory is searched for a module of the given name; first with the daemon + name prepended (e.g. ``zebra_mod`` for ``mod``), then without the daemon + name prepended. + + This option is available on all daemons, though some daemons may not have + any modules available to be loaded. + +The SNMP Module +--------------- + +If SNMP is enabled during compile-time and installed as part of the package, +the ``snmp`` module can be loaded for the *zebra*, *bgpd*, *ospfd*, *ospf6d* +and *ripd* daemons. + +The module ignores any options passed to it. Refer to :ref:`snmp-support` +for information on its usage. + +The FPM Module +-------------- + +If FPM is enabled during compile-time and installed as part of the package, the +``fpm`` module can be loaded for the *zebra* daemon. This provides the +Forwarding Plane Manager ("FPM") API. + +The module expects its argument to be either ``netlink`` or ``protobuf``, +specifying the encapsulation to use. ``netlink`` is the default, and +``protobuf`` may not be available if the module was built without protobuf +support. Refer to :ref:`zebra-fib-push-interface` for more information. + +.. _virtual-terminal-interfaces: + +Virtual Terminal Interfaces +=========================== + +VTY -- Virtual Terminal [aka TeletYpe] Interface is a command line +interface (CLI) for user interaction with the routing daemon. + +.. _vty-overview: + +VTY Overview +------------ + +VTY stands for Virtual TeletYpe interface. It means you can connect to +the daemon via the telnet protocol. + +To enable a VTY interface, you have to setup a VTY password. If there +is no VTY password, one cannot connect to the VTY interface at all. + +:: + + % telnet localhost 2601 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + + Hello, this is |PACKAGE_NAME| (version |PACKAGE_VERSION|) + |COPYRIGHT_STR| + + User Access Verification + + Password: XXXXX + Router> ? + enable . . . Turn on privileged commands + exit . . . Exit current mode and down to previous mode + help . . . Description of the interactive help system + list . . . Print command list + show . . . Show system inform + + wh. . . Display who is on a vty + Router> enable + Password: XXXXX + Router# configure terminal + Router(config)# interface eth0 + Router(config-if)# ip address 10.0.0.1/8 + Router(config-if)# ^Z + Router# + + +:kbd:`?` and the ``find`` command are very useful for looking up commands. + +.. _vty-modes: + +VTY Modes +--------- + +There are three basic VTY modes: + +There are commands that may be restricted to specific VTY modes. + +.. _vty-view-mode: + +VTY View Mode +^^^^^^^^^^^^^ + +This mode is for read-only access to the CLI. One may exit the mode by +leaving the system, or by entering `enable` mode. + +.. _vty-enable-mode: + +VTY Enable Mode +^^^^^^^^^^^^^^^ + +This mode is for read-write access to the CLI. One may exit the mode by +leaving the system, or by escaping to view mode. + +.. _vty-other-modes: + +VTY Other Modes +^^^^^^^^^^^^^^^ + +This page is for describing other modes. + +.. _vty-cli-commands: + +VTY CLI Commands +---------------- + +Commands that you may use at the command-line are described in the following +three subsubsections. + +.. _cli-movement-commands: + +CLI Movement Commands +^^^^^^^^^^^^^^^^^^^^^ + +These commands are used for moving the CLI cursor. The :kbd:`C` character +means press the Control Key. + +:kbd:`C-f` / :kbd:`LEFT` + Move forward one character. + +:kbd:`C-b` / :kbd:`RIGHT` + Move backward one character. + +:kbd:`M-f` + Move forward one word. + +:kbd:`M-b` + Move backward one word. + +:kbd:`C-a` + Move to the beginning of the line. + +:kbd:`C-e` + Move to the end of the line. + + +.. _cli-editing-commands: + +CLI Editing Commands +^^^^^^^^^^^^^^^^^^^^ + +These commands are used for editing text on a line. The :kbd:`C` +character means press the Control Key. + + +:kbd:`C-h` / :kbd:`DEL` + Delete the character before point. + + +:kbd:`C-d` + Delete the character after point. + + +:kbd:`M-d` + Forward kill word. + + +:kbd:`C-w` + Backward kill word. + + +:kbd:`C-k` + Kill to the end of the line. + + +:kbd:`C-u` + Kill line from the beginning, erasing input. + + +:kbd:`C-t` + Transpose character. + + +CLI Advanced Commands +^^^^^^^^^^^^^^^^^^^^^ + +There are several additional CLI commands for command line completions, +insta-help, and VTY session management. + + +:kbd:`C-c` + Interrupt current input and moves to the next line. + + +:kbd:`C-z` + End current configuration session and move to top node. + + +:kbd:`C-n` / :kbd:`DOWN` + Move down to next line in the history buffer. + + +:kbd:`C-p` / :kbd:`UP` + Move up to previous line in the history buffer. + + +:kbd:`TAB` + Use command line completion by typing :kbd:`TAB`. + + +:kbd:`?` + You can use command line help by typing `help` at the beginning of + the line. Typing :kbd:`?` at any point in the line will show possible + completions. + diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst new file mode 100644 index 000000000..0cc2c511c --- /dev/null +++ b/doc/user/bgp.rst @@ -0,0 +1,2303 @@ +.. _bgp: + +*** +BGP +*** + +:abbr:`BGP` stands for a Border Gateway Protocol. The lastest BGP version is 4. +It is referred as BGP-4. BGP-4 is one of the Exterior Gateway Protocols and +de-fact standard of Inter Domain routing protocol. BGP-4 is described in +:rfc:`1771`. + +Many extensions have been added to :rfc:`1771`. :rfc:`2858` provides +multiprotocol support to BGP-4. + +.. _starting-bgp: + +Starting BGP +============ + +Default configuration file of *bgpd* is :file:`bgpd.conf`. *bgpd* searches the +current directory first then |INSTALL_PREFIX_ETC|/bgpd.conf. All of bgpd's +command must be configured in :file:`bgpd.conf`. + +*bgpd* specific invocation options are described below. Common options may also +be specified (:ref:`common-invocation-options`). + +.. program:: bgpd + +.. option:: -p <port> +.. option:: --bgp_port <port> + + Set the bgp protocol's port number. + +.. option:: -r +.. option:: --retain + + When program terminates, retain BGP routes added by zebra. + +.. option:: -l +.. option:: --listenon + + Specify a specific IP address for bgpd to listen on, rather than its + default of INADDR_ANY / IN6ADDR_ANY. This can be useful to constrain bgpd + to an internal address, or to run multiple bgpd processes on one host. + + +.. _bgp-router: + +BGP router +========== + +First of all you must configure BGP router with *router bgp* command. To +configure BGP router, you need AS number. AS number is an identification of +autonomous system. BGP protocol uses the AS number for detecting whether the +BGP connection is internal one or external one. + +.. index:: router bgp ASN +.. clicmd:: router bgp ASN + + Enable a BGP protocol process with the specified ASN. After + this statement you can input any `BGP Commands`. You can not + create different BGP process under different ASN without + specifying `multiple-instance` (:ref:`multiple-instance`). + +.. index:: no router bgp ASN +.. clicmd:: no router bgp ASN + + Destroy a BGP protocol process with the specified ASN. + +.. index:: bgp router-id A.B.C.D +.. clicmd:: bgp router-id A.B.C.D + + This command specifies the router-ID. If *bgpd* connects to *zebra* it gets + interface and address information. In that case default router ID value is + selected as the largest IP Address of the interfaces. When `router zebra` is + not enabled *bgpd* can't get interface information so `router-id` is set to + 0.0.0.0. So please set router-id by hand. + +.. _bgp-distance: + +BGP distance +------------ + +.. index:: distance bgp (1-255) (1-255) (1-255) +.. clicmd:: distance bgp (1-255) (1-255) (1-255) + + This command change distance value of BGP. Each argument is distance value + for external routes, internal routes and local routes. + +.. index:: distance (1-255) A.B.C.D/M +.. clicmd:: distance (1-255) A.B.C.D/M + +.. index:: distance (1-255) A.B.C.D/M word +.. clicmd:: distance (1-255) A.B.C.D/M word + +.. _bgp-decision-process: + +BGP decision process +-------------------- + +The decision process FRR BGP uses to select routes is as follows: + +1. Weight check + + + Prefer higher local weight routes to lower routes. + +2. Local preference check + + + Prefer higher local preference routes to lower. + +3. Local route check + + Prefer local routes (statics, aggregates, redistributed) to received routes. + +4. AS path length check + + Prefer shortest hop-count AS_PATHs. + +5. Origin check + + Prefer the lowest origin type route. That is, prefer IGP origin routes to + EGP, to Incomplete routes. + +6. MED check + + Where routes with a MED were received from the same AS, prefer the route + with the lowest MED. :ref:`bgp-med`. + +7. External check + + Prefer the route received from an external, eBGP peer over routes received + from other types of peers. + +8. IGP cost check + + Prefer the route with the lower IGP cost. + +9. Multi-path check + + If multi-pathing is enabled, then check whether the routes not yet + distinguished in preference may be considered equal. If + :clicmd:`bgp bestpath as-path multipath-relax` is set, all such routes are + considered equal, otherwise routes received via iBGP with identical AS_PATHs + or routes received from eBGP neighbours in the same AS are considered equal. + +10. Already-selected external check + + Where both routes were received from eBGP peers, then prefer the route + which is already selected. Note that this check is not applied if + :clicmd:`bgp bestpath compare-routerid` is configured. This check can + prevent some cases of oscillation. + +11. Router-ID check + + Prefer the route with the lowest `router-ID`. If the route has an + `ORIGINATOR_ID` attribute, through iBGP reflection, then that router ID is + used, otherwise the `router-ID` of the peer the route was received from is + used. + +12. Cluster-List length check + + The route with the shortest cluster-list length is used. The cluster-list + reflects the iBGP reflection path the route has taken. + + +13. Peer address + + Prefer the route received from the peer with the higher + transport layer address, as a last-resort tie-breaker. + + +.. index:: bgp bestpath as-path confed +.. clicmd:: bgp bestpath as-path confed + + This command specifies that the length of confederation path sets and + sequences should should be taken into account during the BGP best path + decision process. + +.. index:: bgp bestpath as-path multipath-relax +.. clicmd:: bgp bestpath as-path multipath-relax + + This command specifies that BGP decision process should consider paths + of equal AS_PATH length candidates for multipath computation. Without + the knob, the entire AS_PATH must match for multipath computation. + +.. clicmd:: bgp bestpath compare-routerid + + Ensure that when comparing routes where both are equal on most metrics, + including local-pref, AS_PATH length, IGP cost, MED, that the tie is broken + based on router-ID. + + If this option is enabled, then the already-selected check, where + already selected eBGP routes are preferred, is skipped. + + If a route has an `ORIGINATOR_ID` attribute because it has been reflected, + that `ORIGINATOR_ID` will be used. Otherwise, the router-ID of the peer the + route was received from will be used. + + The advantage of this is that the route-selection (at this point) will be + more deterministic. The disadvantage is that a few or even one lowest-ID + router may attract all trafic to otherwise-equal paths because of this + check. It may increase the possibility of MED or IGP oscillation, unless + other measures were taken to avoid these. The exact behaviour will be + sensitive to the iBGP and reflection topology. + + +.. _bgp-route-flap-dampening: + +BGP route flap dampening +------------------------ + +.. clicmd:: bgp dampening (1-45) (1-20000) (1-20000) (1-255) + + + This command enables BGP route-flap dampening and specifies dampening parameters. + + + half-life + Half-life time for the penalty + + reuse-threshold + Value to start reusing a route + + suppress-threshold + Value to start suppressing a route + + max-suppress + Maximum duration to suppress a stable route + + The route-flap damping algorithm is compatible with :rfc:`2439`. The use of + this command is not recommended nowadays. + +.. seealso:: + + `http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378 <http://www.ripe.net/ripe/docs/ripe-378,,RIPE-378>`_ + +.. _bgp-med: + +BGP MED +======= + +The BGP :abbr:`MED (Multi Exit Discriminator)` attribute has properties which +can cause subtle convergence problems in BGP. These properties and problems +have proven to be hard to understand, at least historically, and may still not +be widely understood. The following attempts to collect together and present +what is known about MED, to help operators and FRR users in designing and +configuring their networks. + +The BGP :abbr:`MED` attribute is intended to allow one AS to indicate its +preferences for its ingress points to another AS. The MED attribute will not be +propagated on to another AS by the receiving AS - it is 'non-transitive' in the +BGP sense. + +E.g., if AS X and AS Y have 2 different BGP peering points, then AS X might set +a MED of 100 on routes advertised at one and a MED of 200 at the other. When AS +Y selects between otherwise equal routes to or via AS X, AS Y should prefer to +take the path via the lower MED peering of 100 with AS X. Setting the MED +allows an AS to influence the routing taken to it within another, neighbouring +AS. + +In this use of MED it is not really meaningful to compare the MED value on +routes where the next AS on the paths differs. E.g., if AS Y also had a route +for some destination via AS Z in addition to the routes from AS X, and AS Z had +also set a MED, it wouldn't make sense for AS Y to compare AS Z's MED values to +those of AS X. The MED values have been set by different administrators, with +different frames of reference. + +The default behaviour of BGP therefore is to not compare MED values across +routes received from different neighbouring ASes. In FRR this is done by +comparing the neighbouring, left-most AS in the received AS_PATHs of the routes +and only comparing MED if those are the same. + +Unfortunately, this behaviour of MED, of sometimes being compared across routes +and sometimes not, depending on the properties of those other routes, means MED +can cause the order of preference over all the routes to be undefined. That is, +given routes A, B, and C, if A is preferred to B, and B is preferred to C, then +a well-defined order should mean the preference is transitive (in the sense of +orders [#med-transitivity-rant]_) and that A would be preferred to C. + +However, when MED is involved this need not be the case. With MED it is +possible that C is actually preferred over A. So A is preferred to B, B is +preferred to C, but C is preferred to A. This can be true even where BGP +defines a deterministic 'most preferred' route out of the full set of A,B,C. +With MED, for any given set of routes there may be a deterministically +preferred route, but there need not be any way to arrange them into any order +of preference. With unmodified MED, the order of preference of routes literally +becomes undefined. + +That MED can induce non-transitive preferences over routes can cause issues. +Firstly, it may be perceived to cause routing table churn locally at speakers; +secondly, and more seriously, it may cause routing instability in iBGP +topologies, where sets of speakers continually oscillate between different +paths. + +The first issue arises from how speakers often implement routing decisions. +Though BGP defines a selection process that will deterministically select the +same route as best at any given speaker, even with MED, that process requires +evaluating all routes together. For performance and ease of implementation +reasons, many implementations evaluate route preferences in a pair-wise fashion +instead. Given there is no well-defined order when MED is involved, the best +route that will be chosen becomes subject to implementation details, such as +the order the routes are stored in. That may be (locally) non-deterministic, +e.g.: it may be the order the routes were received in. + +This indeterminism may be considered undesirable, though it need not cause +problems. It may mean additional routing churn is perceived, as sometimes more +updates may be produced than at other times in reaction to some event . + +This first issue can be fixed with a more deterministic route selection that +ensures routes are ordered by the neighbouring AS during selection. +:clicmd:`bgp deterministic-med`. This may reduce the number of updates as routes +are received, and may in some cases reduce routing churn. Though, it could +equally deterministically produce the largest possible set of updates in +response to the most common sequence of received updates. + +A deterministic order of evaluation tends to imply an additional overhead of +sorting over any set of n routes to a destination. The implementation of +deterministic MED in FRR scales significantly worse than most sorting +algorithms at present, with the number of paths to a given destination. That +number is often low enough to not cause any issues, but where there are many +paths, the deterministic comparison may quickly become increasingly expensive +in terms of CPU. + +Deterministic local evaluation can *not* fix the second, more major, issue of +MED however. Which is that the non-transitive preference of routes MED can +cause may lead to routing instability or oscillation across multiple speakers +in iBGP topologies. This can occur with full-mesh iBGP, but is particularly +problematic in non-full-mesh iBGP topologies that further reduce the routing +information known to each speaker. This has primarily been documented with iBGP +route-reflection topologies. However, any route-hiding technologies potentially +could also exacerbate oscillation with MED. + +This second issue occurs where speakers each have only a subset of routes, and +there are cycles in the preferences between different combinations of routes - +as the undefined order of preference of MED allows - and the routes are +distributed in a way that causes the BGP speakers to 'chase' those cycles. This +can occur even if all speakers use a deterministic order of evaluation in route +selection. + +E.g., speaker 4 in AS A might receive a route from speaker 2 in AS X, and from +speaker 3 in AS Y; while speaker 5 in AS A might receive that route from +speaker 1 in AS Y. AS Y might set a MED of 200 at speaker 1, and 100 at speaker +3. I.e, using ASN:ID:MED to label the speakers: + +:: + + . + /---------------\\ + X:2------|--A:4-------A:5--|-Y:1:200 + Y:3:100--|-/ | + \\---------------/ + + + +Assuming all other metrics are equal (AS_PATH, ORIGIN, 0 IGP costs), then based +on the RFC4271 decision process speaker 4 will choose X:2 over Y:3:100, based +on the lower ID of 2. Speaker 4 advertises X:2 to speaker 5. Speaker 5 will +continue to prefer Y:1:200 based on the ID, and advertise this to speaker 4. +Speaker 4 will now have the full set of routes, and the Y:1:200 it receives +from 5 will beat X:2, but when speaker 4 compares Y:1:200 to Y:3:100 the MED +check now becomes active as the ASes match, and now Y:3:100 is preferred. +Speaker 4 therefore now advertises Y:3:100 to 5, which will also agrees that +Y:3:100 is preferred to Y:1:200, and so withdraws the latter route from 4. +Speaker 4 now has only X:2 and Y:3:100, and X:2 beats Y:3:100, and so speaker 4 +implicitly updates its route to speaker 5 to X:2. Speaker 5 sees that Y:1:200 +beats X:2 based on the ID, and advertises Y:1:200 to speaker 4, and the cycle +continues. + +The root cause is the lack of a clear order of preference caused by how MED +sometimes is and sometimes is not compared, leading to this cycle in the +preferences between the routes: + +:: + + . + /---> X:2 ---beats---> Y:3:100 --\\ + | | + | | + \\---beats--- Y:1:200 <---beats---/ + + + +This particular type of oscillation in full-mesh iBGP topologies can be +avoided by speakers preferring already selected, external routes rather than +choosing to update to new a route based on a post-MED metric (e.g. router-ID), +at the cost of a non-deterministic selection process. FRR implements this, as +do many other implementations, so long as it is not overridden by setting +:clicmd:`bgp bestpath compare-routerid`, and see also +:ref:`bgp-decision-process`. + +However, more complex and insidious cycles of oscillation are possible with +iBGP route-reflection, which are not so easily avoided. These have been +documented in various places. See, e.g.: + +- [bgp-route-osci-cond]_ +- [stable-flexible-ibgp]_ +- [ibgp-correctness]_ + +for concrete examples and further references. + +There is as of this writing *no* known way to use MED for its original purpose; +*and* reduce routing information in iBGP topologies; *and* be sure to avoid the +instability problems of MED due the non-transitive routing preferences it can +induce; in general on arbitrary networks. + +There may be iBGP topology specific ways to reduce the instability risks, even +while using MED, e.g.: by constraining the reflection topology and by tuning +IGP costs between route-reflector clusters, see :rfc:`3345` for details. In the +near future, the Add-Path extension to BGP may also solve MED oscillation while +still allowing MED to be used as intended, by distributing "best-paths per +neighbour AS". This would be at the cost of distributing at least as many +routes to all speakers as a full-mesh iBGP would, if not more, while also +imposing similar CPU overheads as the "Deterministic MED" feature at each +Add-Path reflector. + +More generally, the instability problems that MED can introduce on more +complex, non-full-mesh, iBGP topologies may be avoided either by: + +- Setting :clicmd:`bgp always-compare-med`, however this allows MED to be compared + across values set by different neighbour ASes, which may not produce + coherent desirable results, of itself. +- Effectively ignoring MED by setting MED to the same value (e.g.: 0) using + :clicmd:`set metric METRIC` on all received routes, in combination with + setting :clicmd:`bgp always-compare-med` on all speakers. This is the simplest + and most performant way to avoid MED oscillation issues, where an AS is happy + not to allow neighbours to inject this problematic metric. + +As MED is evaluated after the AS_PATH length check, another possible use for +MED is for intra-AS steering of routes with equal AS_PATH length, as an +extension of the last case above. As MED is evaluated before IGP metric, this +can allow cold-potato routing to be implemented to send traffic to preferred +hand-offs with neighbours, rather than the closest hand-off according to the +IGP metric. + +Note that even if action is taken to address the MED non-transitivity issues, +other oscillations may still be possible. E.g., on IGP cost if iBGP and IGP +topologies are at cross-purposes with each other - see the Flavel and Roughan +paper above for an example. Hence the guideline that the iBGP topology should +follow the IGP topology. + +.. index:: bgp deterministic-med +.. clicmd:: bgp deterministic-med + + Carry out route-selection in way that produces deterministic answers + locally, even in the face of MED and the lack of a well-defined order of + preference it can induce on routes. Without this option the preferred route + with MED may be determined largely by the order that routes were received + in. + + Setting this option will have a performance cost that may be noticeable when + there are many routes for each destination. Currently in FRR it is + implemented in a way that scales poorly as the number of routes per + destination increases. + + The default is that this option is not set. + +Note that there are other sources of indeterminism in the route selection +process, specifically, the preference for older and already selected routes +from eBGP peers, :ref:`bgp-decision-process`. + +.. index:: bgp always-compare-med +.. clicmd:: bgp always-compare-med + + Always compare the MED on routes, even when they were received from + different neighbouring ASes. Setting this option makes the order of + preference of routes more defined, and should eliminate MED induced + oscillations. + + If using this option, it may also be desirable to use + :clicmd:`set metric METRIC` to set MED to 0 on routes received from external + neighbours. + + This option can be used, together with :clicmd:`set metric METRIC` to use + MED as an intra-AS metric to steer equal-length AS_PATH routes to, e.g., + desired exit points. + +.. _bgp-network: + +BGP network +=========== + + +.. _bgp-route: + +BGP route +--------- + +.. index:: network A.B.C.D/M +.. clicmd:: network A.B.C.D/M + + This command adds the announcement network.:: + + router bgp 1 + address-family ipv4 unicast + network 10.0.0.0/8 + exit-address-family + + This configuration example says that network 10.0.0.0/8 will be + announced to all neighbors. Some vendors' routers don't advertise + routes if they aren't present in their IGP routing tables; `bgpd` + doesn't care about IGP routes when announcing its routes. + +.. index:: no network A.B.C.D/M +.. clicmd:: no network A.B.C.D/M + + +.. _route-aggregation: + +Route Aggregation +----------------- + +.. index:: aggregate-address A.B.C.D/M +.. clicmd:: aggregate-address A.B.C.D/M + + This command specifies an aggregate address. + +.. index:: aggregate-address A.B.C.D/M as-set +.. clicmd:: aggregate-address A.B.C.D/M as-set + + This command specifies an aggregate address. Resulting routes include + AS set. + +.. index:: aggregate-address A.B.C.D/M summary-only +.. clicmd:: aggregate-address A.B.C.D/M summary-only + + This command specifies an aggregate address. Aggreated routes will + not be announce. + +.. index:: no aggregate-address A.B.C.D/M +.. clicmd:: no aggregate-address A.B.C.D/M + + + +.. _redistribute-to-bgp: + +Redistribute to BGP +------------------- + +.. index:: redistribute kernel +.. clicmd:: redistribute kernel + + Redistribute kernel route to BGP process. + +.. index:: redistribute static +.. clicmd:: redistribute static + + Redistribute static route to BGP process. + +.. index:: redistribute connected +.. clicmd:: redistribute connected + + Redistribute connected route to BGP process. + +.. index:: redistribute rip +.. clicmd:: redistribute rip + + Redistribute RIP route to BGP process. + +.. index:: redistribute ospf +.. clicmd:: redistribute ospf + + Redistribute OSPF route to BGP process. + +.. index:: redistribute vpn +.. clicmd:: redistribute vpn + + Redistribute VNC routes to BGP process. + +.. index:: update-delay MAX-DELAY +.. clicmd:: update-delay MAX-DELAY + +.. index:: update-delay MAX-DELAY ESTABLISH-WAIT +.. clicmd:: update-delay MAX-DELAY ESTABLISH-WAIT + + This feature is used to enable read-only mode on BGP process restart or when + BGP process is cleared using 'clear ip bgp \*'. When applicable, read-only + mode would begin as soon as the first peer reaches Established status and a + timer for max-delay seconds is started. + + During this mode BGP doesn't run any best-path or generate any updates to its + peers. This mode continues until: + + 1. All the configured peers, except the shutdown peers, have sent explicit EOR + (End-Of-RIB) or an implicit-EOR. The first keep-alive after BGP has reached + Established is considered an implicit-EOR. + If the establish-wait optional value is given, then BGP will wait for + peers to reach established from the begining of the update-delay till the + establish-wait period is over, i.e. the minimum set of established peers for + which EOR is expected would be peers established during the establish-wait + window, not necessarily all the configured neighbors. + 2. max-delay period is over. + + On hitting any of the above two conditions, BGP resumes the decision process + and generates updates to its peers. + + Default max-delay is 0, i.e. the feature is off by default. + +.. index:: table-map ROUTE-MAP-NAME +.. clicmd:: table-map ROUTE-MAP-NAME + + This feature is used to apply a route-map on route updates from BGP to + Zebra. All the applicable match operations are allowed, such as match on + prefix, next-hop, communities, etc. Set operations for this attach-point are + limited to metric and next-hop only. Any operation of this feature does not + affect BGPs internal RIB. + + Supported for ipv4 and ipv6 address families. It works on multi-paths as + well, however, metric setting is based on the best-path only. + +.. _bgp-peer: + +BGP Peer +======== + +.. _defining-peer: + +Defining Peer +------------- + +.. index:: neighbor PEER remote-as ASN +.. clicmd:: neighbor PEER remote-as ASN + + + Creates a new neighbor whose remote-as is ASN. PEER can be an IPv4 address + or an IPv6 address.:: + + router bgp 1 + neighbor 10.0.0.1 remote-as 2 + + In this case my router, in AS-1, is trying to peer with AS-2 at 10.0.0.1. + + This command must be the first command used when configuring a neighbor. If + the remote-as is not specified, *bgpd* will complain like this::: + + can't find neighbor 10.0.0.1 + + +.. _bgp-peer-commands: + +BGP Peer commands +----------------- + +In a `router bgp` clause there are neighbor specific configurations +required. + +.. index:: neighbor PEER shutdown +.. clicmd:: neighbor PEER shutdown + +.. index:: no neighbor PEER shutdown +.. clicmd:: no neighbor PEER shutdown + + Shutdown the peer. We can delete the neighbor's configuration by + ``no neighbor PEER remote-as ASN`` but all configuration of the neighbor + will be deleted. When you want to preserve the configuration, but want to + drop the BGP peer, use this syntax. + +.. index:: neighbor PEER ebgp-multihop +.. clicmd:: neighbor PEER ebgp-multihop + +.. index:: no neighbor PEER ebgp-multihop +.. clicmd:: no neighbor PEER ebgp-multihop + + +.. index:: neighbor PEER description ... +.. clicmd:: neighbor PEER description ... + + +.. index:: no neighbor PEER description ... +.. clicmd:: no neighbor PEER description ... + + Set description of the peer. + +.. index:: neighbor PEER version VERSION +.. clicmd:: neighbor PEER version VERSION + + Set up the neighbor's BGP version. `version` can be `4`, + `4+` or `4-`. BGP version `4` is the default value used for + BGP peering. BGP version `4+` means that the neighbor supports + Multiprotocol Extensions for BGP-4. BGP version `4-` is similar but + the neighbor speaks the old Internet-Draft revision 00's Multiprotocol + Extensions for BGP-4. Some routing software is still using this + version. + +.. index:: neighbor PEER interface IFNAME +.. clicmd:: neighbor PEER interface IFNAME + + +.. index:: no neighbor PEER interface IFNAME +.. clicmd:: no neighbor PEER interface IFNAME + + When you connect to a BGP peer over an IPv6 link-local address, you have to + specify the IFNAME of the interface used for the connection. To specify + IPv4 session addresses, see the ``neighbor PEER update-source`` command + below. + + This command is deprecated and may be removed in a future release. Its use + should be avoided. + +.. index:: neighbor PEER next-hop-self [all] +.. clicmd:: neighbor PEER next-hop-self [all] + + +.. index:: no neighbor PEER next-hop-self [all] +.. clicmd:: no neighbor PEER next-hop-self [all] + + This command specifies an announced route's nexthop as being equivalent to + the address of the bgp router if it is learned via eBGP. If the optional + keyword `all` is specified the modifiation is done also for routes learned + via iBGP. + +.. index:: neighbor PEER update-source <IFNAME|ADDRESS> +.. clicmd:: neighbor PEER update-source <IFNAME|ADDRESS> + + +.. index:: no neighbor PEER update-source +.. clicmd:: no neighbor PEER update-source + + Specify the IPv4 source address to use for the :abbr:`BGP` session to this + neighbour, may be specified as either an IPv4 address directly or as an + interface name (in which case the *zebra* daemon MUST be running in order + for *bgpd* to be able to retrieve interface state).:: + + router bgp 64555 + neighbor foo update-source 192.168.0.1 + neighbor bar update-source lo0 + + +.. index:: neighbor PEER default-originate +.. clicmd:: neighbor PEER default-originate + +.. index:: no neighbor PEER default-originate +.. clicmd:: no neighbor PEER default-originate + + *bgpd*'s default is to not announce the default route (0.0.0.0/0) even it + is in routing table. When you want to announce default routes to the + peer, use this command. + +.. index:: neighbor PEER port PORT +.. clicmd:: neighbor PEER port PORT + +.. index:: neighbor PEER send-community +.. clicmd:: neighbor PEER send-community + +.. index:: neighbor PEER weight WEIGHT +.. clicmd:: neighbor PEER weight WEIGHT + + +.. index:: no neighbor PEER weight WEIGHT +.. clicmd:: no neighbor PEER weight WEIGHT + + This command specifies a default `weight` value for the neighbor's routes. + +.. index:: neighbor PEER maximum-prefix NUMBER +.. clicmd:: neighbor PEER maximum-prefix NUMBER + + +.. index:: no neighbor PEER maximum-prefix NUMBER +.. clicmd:: no neighbor PEER maximum-prefix NUMBER + + +.. index:: neighbor PEER local-as AS-NUMBER +.. clicmd:: neighbor PEER local-as AS-NUMBER + + +.. index:: neighbor PEER local-as AS-NUMBER no-prepend +.. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend + + +.. index:: neighbor PEER local-as AS-NUMBER no-prepend replace-as +.. clicmd:: neighbor PEER local-as AS-NUMBER no-prepend replace-as + + +.. index:: no neighbor PEER local-as +.. clicmd:: no neighbor PEER local-as + + Specify an alternate AS for this BGP process when interacting with the + specified peer. With no modifiers, the specified local-as is prepended to + the received AS_PATH when receiving routing updates from the peer, and + prepended to the outgoing AS_PATH (after the process local AS) when + transmitting local routes to the peer. + + If the no-prepend attribute is specified, then the supplied local-as is not + prepended to the received AS_PATH. + + If the replace-as attribute is specified, then only the supplied local-as is + prepended to the AS_PATH when transmitting local-route updates to this peer. + + Note that replace-as can only be specified if no-prepend is. + + This command is only allowed for eBGP peers. + +.. index:: neighbor PEER ttl-security hops NUMBER +.. clicmd:: neighbor PEER ttl-security hops NUMBER + + +.. index:: no neighbor PEER ttl-security hops NUMBER +.. clicmd:: no neighbor PEER ttl-security hops NUMBER + + This command enforces Generalized TTL Security Mechanism (GTSM), as + specified in RFC 5082. With this command, only neighbors that are the + specified number of hops away will be allowed to become neighbors. This + command is mututally exclusive with *ebgp-multihop*. + +.. _peer-filtering: + +Peer filtering +-------------- + +.. index:: neighbor PEER distribute-list NAME [in|out] +.. clicmd:: neighbor PEER distribute-list NAME [in|out] + + This command specifies a distribute-list for the peer. `direct` is + ``in`` or ``out``. + +.. index:: neighbor PEER prefix-list NAME [in|out] +.. clicmd:: neighbor PEER prefix-list NAME [in|out] + +.. index:: neighbor PEER filter-list NAME [in|out] +.. clicmd:: neighbor PEER filter-list NAME [in|out] + +.. index:: neighbor PEER route-map NAME [in|out] +.. clicmd:: neighbor PEER route-map NAME [in|out] + + Apply a route-map on the neighbor. `direct` must be `in` or `out`. + +.. index:: bgp route-reflector allow-outbound-policy +.. clicmd:: bgp route-reflector allow-outbound-policy + + By default, attribute modification via route-map policy out is not reflected + on reflected routes. This option allows the modifications to be reflected as + well. Once enabled, it affects all reflected routes. + +.. _bgp-peer-group: + +BGP Peer Group +============== + +.. index:: neighbor WORD peer-group +.. clicmd:: neighbor WORD peer-group + + This command defines a new peer group. + +.. index:: neighbor PEER peer-group WORD +.. clicmd:: neighbor PEER peer-group WORD + + This command bind specific peer to peer group WORD. + +.. _bgp-address-family: + +BGP Address Family +================== + +Multiprotocol BGP enables BGP to carry routing information for multiple Network +Layer protocols. BGP supports multiple Address Family Identifier (AFI), namely +IPv4 and IPv6. Support is also provided for multiple sets of per-AFI +information via Subsequent Address Family Identifiers (SAFI). In addition to +unicast information, VPN information :rfc:`4364` and :rfc:`4659`, and +Encapsulation attribute :rfc:`5512` is supported. + +.. index:: show ip bgp ipv4 vpn +.. clicmd:: show ip bgp ipv4 vpn + +.. index:: show ipv6 bgp ipv6 vpn +.. clicmd:: show ipv6 bgp ipv6 vpn + + Print active IPV4 or IPV6 routes advertised via the VPN SAFI. + +.. index:: show bgp ipv4 vpn summary +.. clicmd:: show bgp ipv4 vpn summary + +.. index:: show bgp ipv6 vpn summary +.. clicmd:: show bgp ipv6 vpn summary + + Print a summary of neighbor connections for the specified AFI/SAFI combination. + +.. _autonomous-system: + +Autonomous System +================= + +The :abbr:`AS (Autonomous System)` number is one of the essential element of +BGP. BGP is a distance vector routing protocol, and the AS-Path framework +provides distance vector metric and loop detection to BGP. :rfc:`1930` provides +some background on the concepts of an AS. + +The AS number is a two octet value, ranging in value from 1 to 65535. The AS +numbers 64512 through 65535 are defined as private AS numbers. Private AS +numbers must not to be advertised in the global Internet. + +.. _display-bgp-routes-by-as-path: + +Display BGP Routes by AS Path +----------------------------- + +To show BGP routes which has specific AS path information `show ip bgp` command +can be used. + +.. index:: show bgp ipv4|ipv6 regexp LINE +.. clicmd:: show bgp ipv4|ipv6 regexp LINE + + This commands displays BGP routes that matches a regular + expression `line` (:ref:`bgp-regular-expressions`). + +.. _as-path-access-list: + +AS Path Access List +------------------- + +AS path access list is user defined AS path. + +.. index:: ip as-path access-list WORD permit|deny LINE +.. clicmd:: ip as-path access-list WORD permit|deny LINE + + This command defines a new AS path access list. + +.. index:: no ip as-path access-list WORD +.. clicmd:: no ip as-path access-list WORD + +.. index:: no ip as-path access-list WORD permit|deny LINE +.. clicmd:: no ip as-path access-list WORD permit|deny LINE + +.. _using-as-path-in-route-map: + +Using AS Path in Route Map +-------------------------- + +.. index:: match as-path WORD +.. clicmd:: match as-path WORD + + +.. index:: set as-path prepend AS-PATH +.. clicmd:: set as-path prepend AS-PATH + + Prepend the given string of AS numbers to the AS_PATH. + +.. index:: set as-path prepend last-as NUM +.. clicmd:: set as-path prepend last-as NUM + + Prepend the existing last AS number (the leftmost ASN) to the AS_PATH. + +.. _private-as-numbers: + +Private AS Numbers +------------------ + +.. _bgp-communities-attribute: + +BGP Communities Attribute +========================= + +BGP communities attribute is widely used for implementing policy routing. +Network operators can manipulate BGP communities attribute based on their +network policy. BGP communities attribute is defined in :rfc:`1997` and +:rfc:`1998`. It is an optional transitive attribute, therefore local policy can +travel through different autonomous system. + +Communities attribute is a set of communities values. Each communities value is +4 octet long. The following format is used to define communities value. + + +AS:VAL + This format represents 4 octet communities value. ``AS`` is high order 2 + octet in digit format. ``VAL`` is low order 2 octet in digit format. This + format is useful to define AS oriented policy value. For example, + ``7675:80`` can be used when AS 7675 wants to pass local policy value 80 to + neighboring peer. + +internet + `internet` represents well-known communities value 0. + +no-export + ``no-export`` represents well-known communities value ``NO_EXPORT`` + ``0xFFFFFF01``. All routes carry this value must not be advertised to + outside a BGP confederation boundary. If neighboring BGP peer is part of BGP + confederation, the peer is considered as inside a BGP confederation + boundary, so the route will be announced to the peer. + +no-advertise + ``no-advertise`` represents well-known communities value ``NO_ADVERTISE`` + ``0xFFFFFF02``. All routes carry this value must not be advertise to other + BGP peers. + +local-AS + ``local-AS`` represents well-known communities value ``NO_EXPORT_SUBCONFED`` + ``0xFFFFFF03``. All routes carry this value must not be advertised to + external BGP peers. Even if the neighboring router is part of confederation, + it is considered as external BGP peer, so the route will not be announced to + the peer. + +When BGP communities attribute is received, duplicated communities value in the +communities attribute is ignored and each communities values are sorted in +numerical order. + +.. _bgp-community-lists: + +BGP Community Lists +------------------- + +BGP community list is a user defined BGP communites attribute list. BGP +community list can be used for matching or manipulating BGP communities +attribute in updates. + +There are two types of community list. One is standard community list and +another is expanded community list. Standard community list defines communities +attribute. Expanded community list defines communities attribute string with +regular expression. Standard community list is compiled into binary format when +user define it. Standard community list will be directly compared to BGP +communities attribute in BGP updates. Therefore the comparison is faster than +expanded community list. + +.. index:: ip community-list standard NAME permit|deny COMMUNITY +.. clicmd:: ip community-list standard NAME permit|deny COMMUNITY + + This command defines a new standard community list. COMUNITY is + communities value. The COMUNITY is compiled into community structure. We + can define multiple community list under same name. In that case match will + happen user defined order. Once the community list matches to communities + attribute in BGP updates it return permit or deny by the community list + definition. When there is no matched entry, deny will be returned. When + COMUNITY is empty it matches to any routes. + +.. index:: ip community-list expanded NAME permit|deny LINE +.. clicmd:: ip community-list expanded NAME permit|deny LINE + + This command defines a new expanded community list. COMUNITY is a + string expression of communities attribute. COMUNITY can be a + regular expression (:ref:`bgp-regular-expressions`) to match + the communities attribute in BGP updates. + +.. index:: no ip community-list NAME +.. clicmd:: no ip community-list NAME + +.. index:: no ip community-list standard NAME +.. clicmd:: no ip community-list standard NAME + +.. index:: no ip community-list expanded NAME +.. clicmd:: no ip community-list expanded NAME + + These commands delete community lists specified by NAME. All of + community lists shares a single name space. So community lists can be + removed simpley specifying community lists name. + +.. index:: show ip community-list +.. clicmd:: show ip community-list + +.. index:: show ip community-list NAME +.. clicmd:: show ip community-list NAME + + This command displays current community list information. When NAME is + specified the specified community list's information is shown. + + :: + + # show ip community-list + Named Community standard list CLIST + permit 7675:80 7675:100 no-export + deny internet + Named Community expanded list EXPAND + permit : + + # show ip community-list CLIST + Named Community standard list CLIST + permit 7675:80 7675:100 no-export + deny internet + + +.. _numbered-bgp-community-lists: + +Numbered BGP Community Lists +---------------------------- + +When number is used for BGP community list name, the number has +special meanings. Community list number in the range from 1 and 99 is +standard community list. Community list number in the range from 100 +to 199 is expanded community list. These community lists are called +as numbered community lists. On the other hand normal community lists +is called as named community lists. + +.. index:: ip community-list (1-99) permit|deny COMMUNITY +.. clicmd:: ip community-list (1-99) permit|deny COMMUNITY + + This command defines a new community list. (1-99) is standard + community list number. Community list name within this range defines + standard community list. When `community` is empty it matches to + any routes. + +.. index:: ip community-list (100-199) permit|deny COMMUNITY +.. clicmd:: ip community-list (100-199) permit|deny COMMUNITY + + This command defines a new community list. (100-199) is expanded + community list number. Community list name within this range defines + expanded community list. + +.. index:: ip community-list NAME permit|deny COMMUNITY +.. clicmd:: ip community-list NAME permit|deny COMMUNITY + + When community list type is not specifed, the community list type is + automatically detected. If COMMUNITY can be compiled into communities + attribute, the community list is defined as a standard community list. + Otherwise it is defined as an expanded community list. This feature is left + for backward compability. Use of this feature is not recommended. + +.. _bgp-community-in-route-map: + +BGP Community in Route Map +-------------------------- + +In Route Map (:ref:`route-map`), we can match or set BGP +communities attribute. Using this feature network operator can +implement their network policy based on BGP communities attribute. + +Following commands can be used in Route Map. + +.. index:: match community WORD +.. clicmd:: match community WORD + +.. index:: match community WORD exact-match +.. clicmd:: match community WORD exact-match + + This command perform match to BGP updates using community list WORD. When + the one of BGP communities value match to the one of communities value in + community list, it is match. When `exact-match` keyword is spcified, match + happen only when BGP updates have completely same communities value + specified in the community list. + +.. index:: set community none +.. clicmd:: set community none + +.. index:: set community COMMUNITY +.. clicmd:: set community COMMUNITY + +.. index:: set community COMMUNITY additive +.. clicmd:: set community COMMUNITY additive + + This command manipulate communities value in BGP updates. When + `none` is specified as communities value, it removes entire + communities attribute from BGP updates. When `community` is not + `none`, specified communities value is set to BGP updates. If + BGP updates already has BGP communities value, the existing BGP + communities value is replaced with specified `community` value. + When `additive` keyword is specified, `community` is appended + to the existing communities value. + +.. index:: set comm-list WORD delete +.. clicmd:: set comm-list WORD delete + + This command remove communities value from BGP communities attribute. + The `word` is community list name. When BGP route's communities + value matches to the community list `word`, the communities value + is removed. When all of communities value is removed eventually, the + BGP update's communities attribute is completely removed. + +.. _display-bgp-routes-by-community: + +Display BGP Routes by Community +------------------------------- + +To show BGP routes which has specific BGP communities attribute, +`show bgp {ipv4|ipv6}` command can be used. The +`community` and `community-list` subcommand can be used. + +.. index:: show bgp ipv4|ipv6 community +.. clicmd:: show bgp ipv4|ipv6 community + +.. index:: show bgp ipv4|ipv6 community COMMUNITY +.. clicmd:: show bgp ipv4|ipv6 community COMMUNITY + +.. index:: show bgp ipv4|ipv6 community COMMUNITY exact-match +.. clicmd:: show bgp ipv4|ipv6 community COMMUNITY exact-match + + `show bgp {ipv4|ipv6} community` displays BGP routes which has communities + attribute. Where the address family can be IPv4 or IPv6 among others. When + `community` is specified, BGP routes that matches `community` value is + displayed. For this command, `internet` keyword can't be used for + `community` value. When `exact-match` is specified, it display only + routes that have an exact match. + +.. index:: show bgp ipv4|ipv6 community-list WORD +.. clicmd:: show bgp ipv4|ipv6 community-list WORD + +.. index:: show bgp ipv4|ipv6 community-list WORD exact-match +.. clicmd:: show bgp ipv4|ipv6 community-list WORD exact-match + + This commands display BGP routes for the address family specified that matches + community list `word`. When `exact-match` is specified, display only + routes that have an exact match. + +.. _using-bgp-communities-attribute: + +Using BGP Communities Attribute +------------------------------- + +Following configuration is the most typical usage of BGP communities +attribute. AS 7675 provides upstream Internet connection to AS 100. +When following configuration exists in AS 7675, AS 100 networks +operator can set local preference in AS 7675 network by setting BGP +communities attribute to the updates.:: + + router bgp 7675 + neighbor 192.168.0.1 remote-as 100 + address-family ipv4 unicast + neighbor 192.168.0.1 route-map RMAP in + exit-address-family + ! + ip community-list 70 permit 7675:70 + ip community-list 70 deny + ip community-list 80 permit 7675:80 + ip community-list 80 deny + ip community-list 90 permit 7675:90 + ip community-list 90 deny + ! + route-map RMAP permit 10 + match community 70 + set local-preference 70 + ! + route-map RMAP permit 20 + match community 80 + set local-preference 80 + ! + route-map RMAP permit 30 + match community 90 + set local-preference 90 + + +Following configuration announce 10.0.0.0/8 from AS 100 to AS 7675. +The route has communities value 7675:80 so when above configuration +exists in AS 7675, announced route's local preference will be set to +value 80.:: + + router bgp 100 + network 10.0.0.0/8 + neighbor 192.168.0.2 remote-as 7675 + address-family ipv4 unicast + neighbor 192.168.0.2 route-map RMAP out + exit-address-family + ! + ip prefix-list PLIST permit 10.0.0.0/8 + ! + route-map RMAP permit 10 + match ip address prefix-list PLIST + set community 7675:80 + + +Following configuration is an example of BGP route filtering using +communities attribute. This configuration only permit BGP routes +which has BGP communities value 0:80 or 0:90. Network operator can +put special internal communities value at BGP border router, then +limit the BGP routes announcement into the internal network.:: + + router bgp 7675 + neighbor 192.168.0.1 remote-as 100 + address-family ipv4 unicast + neighbor 192.168.0.1 route-map RMAP in + exit-address-family + ! + ip community-list 1 permit 0:80 0:90 + ! + route-map RMAP permit in + match community 1 + + +Following exmaple filter BGP routes which has communities value 1:1. +When there is no match community-list returns deny. To avoid +filtering all of routes, we need to define permit any at last.:: + + router bgp 7675 + neighbor 192.168.0.1 remote-as 100 + address-family ipv4 unicast + neighbor 192.168.0.1 route-map RMAP in + exit-address-family + ! + ip community-list standard FILTER deny 1:1 + ip community-list standard FILTER permit + ! + route-map RMAP permit 10 + match community FILTER + + +Communities value keyword `internet` has special meanings in +standard community lists. In below example `internet` act as +match any. It matches all of BGP routes even if the route does not +have communities attribute at all. So community list ``INTERNET`` +is same as above example's ``FILTER``.:: + + ip community-list standard INTERNET deny 1:1 + ip community-list standard INTERNET permit internet + + +Following configuration is an example of communities value deletion. +With this configuration communities value 100:1 and 100:2 is removed +from BGP updates. For communities value deletion, only `permit` +community-list is used. `deny` community-list is ignored.:: + + router bgp 7675 + neighbor 192.168.0.1 remote-as 100 + address-family ipv4 unicast + neighbor 192.168.0.1 route-map RMAP in + exit-address-family + ! + ip community-list standard DEL permit 100:1 100:2 + ! + route-map RMAP permit 10 + set comm-list DEL delete + + +.. _bgp-extended-communities-attribute: + +BGP Extended Communities Attribute +================================== + +BGP extended communities attribute is introduced with MPLS VPN/BGP technology. +MPLS VPN/BGP expands capability of network infrastructure to provide VPN +functionality. At the same time it requires a new framework for policy routing. +With BGP Extended Communities Attribute we can use Route Target or Site of +Origin for implementing network policy for MPLS VPN/BGP. + +BGP Extended Communities Attribute is similar to BGP Communities Attribute. It +is an optional transitive attribute. BGP Extended Communities Attribute can +carry multiple Extended Community value. Each Extended Community value is +eight octet length. + +BGP Extended Communities Attribute provides an extended range compared with BGP +Communities Attribute. Adding to that there is a type field in each value to +provides community space structure. + +There are two format to define Extended Community value. One is AS based format +the other is IP address based format. + +*AS:VAL* + This is a format to define AS based Extended Community value. + `AS` part is 2 octets Global Administrator subfield in Extended + Community value. `VAL` part is 4 octets Local Administrator + subfield. `7675:100` represents AS 7675 policy value 100. + +*IP-Address:VAL* + This is a format to define IP address based Extended Community value. + `IP-Address` part is 4 octets Global Administrator subfield. + `VAL` part is 2 octets Local Administrator subfield. + `10.0.0.1:100` represents + +.. _bgp-extended-community-lists: + +BGP Extended Community Lists +---------------------------- + +Expanded Community Lists is a user defined BGP Expanded Community +Lists. + +.. index:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY +.. clicmd:: ip extcommunity-list standard NAME permit|deny EXTCOMMUNITY + + This command defines a new standard extcommunity-list. + `extcommunity` is extended communities value. The + `extcommunity` is compiled into extended community structure. We + can define multiple extcommunity-list under same name. In that case + match will happen user defined order. Once the extcommunity-list + matches to extended communities attribute in BGP updates it return + permit or deny based upon the extcommunity-list definition. When + there is no matched entry, deny will be returned. When + `extcommunity` is empty it matches to any routes. + +.. index:: ip extcommunity-list expanded NAME permit|deny LINE +.. clicmd:: ip extcommunity-list expanded NAME permit|deny LINE + + This command defines a new expanded extcommunity-list. `line` is + a string expression of extended communities attribute. `line` can + be a regular expression (:ref:`bgp-regular-expressions`) to match an + extended communities attribute in BGP updates. + +.. index:: no ip extcommunity-list NAME +.. clicmd:: no ip extcommunity-list NAME + +.. index:: no ip extcommunity-list standard NAME +.. clicmd:: no ip extcommunity-list standard NAME + +.. index:: no ip extcommunity-list expanded NAME +.. clicmd:: no ip extcommunity-list expanded NAME + + These commands delete extended community lists specified by + `name`. All of extended community lists shares a single name + space. So extended community lists can be removed simpley specifying + the name. + +.. index:: show ip extcommunity-list +.. clicmd:: show ip extcommunity-list + +.. index:: show ip extcommunity-list NAME +.. clicmd:: show ip extcommunity-list NAME + + This command displays current extcommunity-list information. When + `name` is specified the community list's information is shown. + +:: + + # show ip extcommunity-list + + +.. _bgp-extended-communities-in-route-map: + +BGP Extended Communities in Route Map +------------------------------------- + +.. index:: match extcommunity WORD +.. clicmd:: match extcommunity WORD + + +.. index:: set extcommunity rt EXTCOMMUNITY +.. clicmd:: set extcommunity rt EXTCOMMUNITY + + This command set Route Target value. + +.. index:: set extcommunity soo EXTCOMMUNITY +.. clicmd:: set extcommunity soo EXTCOMMUNITY + + This command set Site of Origin value. + +.. _bgp-large-communities-attribute: + +BGP Large Communities Attribute +=============================== + +The BGP Large Communities attribute was introduced in Feb 2017 with +:rfc:`8092`. + +The BGP Large Communities Attribute is similar to the BGP Communities +Attribute except that it has 3 components instead of two and each of +which are 4 octets in length. Large Communities bring additional +functionality and convenience over traditional communities, specifically +the fact that the `GLOBAL` part below is now 4 octets wide allowing +AS4 operators seamless use. + + +*GLOBAL:LOCAL1:LOCAL2* + This is the format to define Large Community values. Referencing + :t:`RFC8195, Use of BGP Large Communities` the values are commonly + referred to as follows. + The `GLOBAL` part is a 4 octet Global Administrator field, common + use of this field is the operators AS number. + The `LOCAL1` part is a 4 octet Local Data Part 1 subfield referred + to as a function. + The `LOCAL2` part is a 4 octet Local Data Part 2 field and referred + to as the parameter subfield. `65551:1:10` represents AS 65551 + function 1 and parameter 10. + The referenced RFC above gives some guidelines on recommended usage. + +.. _bgp-large-community-lists: + +BGP Large Community Lists +------------------------- + +Two types of large community lists are supported, namely `standard` and +`expanded`. + +.. index:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY +.. clicmd:: ip large-community-list standard NAME permit|deny LARGE-COMMUNITY + + This command defines a new standard large-community-list. + `large-community` is the Large Community value. We + can add multiple large communities under same name. In that case + the match will happen in the user defined order. Once the large-community-list + matches the Large Communities attribute in BGP updates it will return + permit or deny based upon the large-community-list definition. When + there is no matched entry, a deny will be returned. When `large-community` + is empty it matches any routes. + +.. index:: ip large-community-list expanded NAME permit|deny LINE +.. clicmd:: ip large-community-list expanded NAME permit|deny LINE + + This command defines a new expanded large-community-list. Where `line` is + a string matching expression, it will be compared to the entire Large Communities + attribute as a string, with each large-community in order from lowest to highest. + `line` can also be a regular expression which matches this Large + Community attribute. + +.. index:: no ip large-community-list NAME +.. clicmd:: no ip large-community-list NAME + +.. index:: no ip large-community-list standard NAME +.. clicmd:: no ip large-community-list standard NAME + +.. index:: no ip large-community-list expanded NAME +.. clicmd:: no ip large-community-list expanded NAME + + These commands delete Large Community lists specified by + `name`. All Large Community lists share a single namespace. + This means Large Community lists can be removed by simply specifying the name. + +.. index:: show ip large-community-list +.. clicmd:: show ip large-community-list + +.. index:: show ip large-community-list NAME +.. clicmd:: show ip large-community-list NAME + + This command display current large-community-list information. When + `name` is specified the community list information is shown. + +.. index:: show ip bgp large-community-info +.. clicmd:: show ip bgp large-community-info + + This command displays the current large communities in use. + +.. _bgp-large-communities-in-route-map: + +BGP Large Communities in Route Map +---------------------------------- + +.. index:: match large-community LINE +.. clicmd:: match large-community LINE + + Where `line` can be a simple string to match, or a regular expression. + It is very important to note that this match occurs on the entire + large-community string as a whole, where each large-community is ordered + from lowest to highest. + +.. index:: set large-community LARGE-COMMUNITY +.. clicmd:: set large-community LARGE-COMMUNITY + +.. index:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY +.. clicmd:: set large-community LARGE-COMMUNITY LARGE-COMMUNITY + +.. index:: set large-community LARGE-COMMUNITY additive +.. clicmd:: set large-community LARGE-COMMUNITY additive + + These commands are used for setting large-community values. The first + command will overwrite any large-communities currently present. + The second specifies two large-communities, which overwrites the current + large-community list. The third will add a large-community value without + overwriting other values. Multiple large-community values can be specified. + +.. _displaying-bgp-information: + +Displaying BGP information +========================== + + +.. _showing-bgp-information: + +Showing BGP information +----------------------- + +.. index:: show ip bgp +.. clicmd:: show ip bgp + +.. index:: show ip bgp A.B.C.D +.. clicmd:: show ip bgp A.B.C.D + +.. index:: show ip bgp X:X::X:X +.. clicmd:: show ip bgp X:X::X:X + + This command displays BGP routes. When no route is specified it + display all of IPv4 BGP routes. + + :: + + BGP table version is 0, local router ID is 10.1.1.1 + Status codes: s suppressed, d damped, h history, * valid, > best, i - internal + Origin codes: i - IGP, e - EGP, ? - incomplete + + Network Next Hop Metric LocPrf Weight Path + \*> 1.1.1.1/32 0.0.0.0 0 32768 i + + Total number of prefixes 1 + + +.. index:: show ip bgp regexp LINE +.. clicmd:: show ip bgp regexp LINE + + This command displays BGP routes using AS path regular expression + (:ref:`bgp-regular-expressions`). + +.. index:: show ip bgp community COMMUNITY +.. clicmd:: show ip bgp community COMMUNITY + +.. index:: show ip bgp community COMMUNITY exact-match +.. clicmd:: show ip bgp community COMMUNITY exact-match + + This command displays BGP routes using `community` (:ref:`display-bgp-routes-by-community`). + +.. index:: show ip bgp community-list WORD +.. clicmd:: show ip bgp community-list WORD + +.. index:: show ip bgp community-list WORD exact-match +.. clicmd:: show ip bgp community-list WORD exact-match + + This command displays BGP routes using community list (:ref:`display-bgp-routes-by-community`). + +.. index:: show bgp ipv4|ipv6 summary +.. clicmd:: show bgp ipv4|ipv6 summary + + Show a bgp peer summary for the specified address family. + +.. index:: show bgp ipv4|ipv6 neighbor [PEER] +.. clicmd:: show bgp ipv4|ipv6 neighbor [PEER] + + This command shows information on a specific BGP `peer`. + +.. index:: show bgp ipv4|ipv6 dampening dampened-paths +.. clicmd:: show bgp ipv4|ipv6 dampening dampened-paths + + Display paths suppressed due to dampening. + +.. index:: show bgp ipv4|ipv6 dampening flap-statistics +.. clicmd:: show bgp ipv4|ipv6 dampening flap-statistics + + Display flap statistics of routes. + +.. _other-bgp-commands: + +Other BGP commands +------------------ + +.. index:: clear bgp ipv4|ipv6 \* +.. clicmd:: clear bgp ipv4|ipv6 \* + + Clear all address family peers. + +.. index:: clear bgp ipv4|ipv6 PEER +.. clicmd:: clear bgp ipv4|ipv6 PEER + + Clear peers which have addresses of X.X.X.X + +.. index:: clear bgp ipv4|ipv6 PEER soft in +.. clicmd:: clear bgp ipv4|ipv6 PEER soft in + + Clear peer using soft reconfiguration. + +.. index:: show debug +.. clicmd:: show debug + +.. index:: debug event +.. clicmd:: debug event + +.. index:: debug update +.. clicmd:: debug update + +.. index:: debug keepalive +.. clicmd:: debug keepalive + +.. index:: no debug event +.. clicmd:: no debug event + +.. index:: no debug update +.. clicmd:: no debug update + +.. index:: no debug keepalive +.. clicmd:: no debug keepalive + + +.. _capability-negotiation: + +Capability Negotiation +====================== + +When adding IPv6 routing information exchange feature to BGP. There were some +proposals. :abbr:`IETF (Internet Engineering Task Force)` :abbr:`IDR ( Inter +Domain Routing)` :abbr:`IDR ( Inter Domain Routing)` adopted a proposal called +Multiprotocol Extension for BGP. The specification is described in :rfc:`2283`. +The protocol does not define new protocols. It defines new attributes to +existing BGP. When it is used exchanging IPv6 routing information it is called +BGP-4+. When it is used for exchanging multicast routing information it is +called MBGP. + +*bgpd* supports Multiprotocol Extension for BGP. So if remote peer supports the +protocol, *bgpd* can exchange IPv6 and/or multicast routing information. + +Traditional BGP did not have the feature to detect remote peer's capabilities, +e.g. whether it can handle prefix types other than IPv4 unicast routes. This +was a big problem using Multiprotocol Extension for BGP to operational network. +:rfc:`2842` adopted a feature called Capability Negotiation. *bgpd* use this +Capability Negotiation to detect the remote peer's capabilities. If the peer is +only configured as IPv4 unicast neighbor, *bgpd* does not send these Capability +Negotiation packets (at least not unless other optional BGP features require +capability negotation). + +By default, FRR will bring up peering with minimal common capability for the +both sides. For example, local router has unicast and multicast capabilitie and +remote router has unicast capability. In this case, the local router will +establish the connection with unicast only capability. When there are no common +capabilities, FRR sends Unsupported Capability error and then resets the +connection. + +If you want to completely match capabilities with remote peer. Please use +*strict-capability-match* command. + +.. index:: neighbor PEER strict-capability-match +.. clicmd:: neighbor PEER strict-capability-match + +.. index:: no neighbor PEER strict-capability-match +.. clicmd:: no neighbor PEER strict-capability-match + + Strictly compares remote capabilities and local capabilities. If capabilities + are different, send Unsupported Capability error then reset connection. + + You may want to disable sending Capability Negotiation OPEN message + optional parameter to the peer when remote peer does not implement + Capability Negotiation. Please use *dont-capability-negotiate* + command to disable the feature. + +.. index:: neighbor PEER dont-capability-negotiate +.. clicmd:: neighbor PEER dont-capability-negotiate + +.. index:: no neighbor PEER dont-capability-negotiate +.. clicmd:: no neighbor PEER dont-capability-negotiate + + Suppress sending Capability Negotiation as OPEN message optional + parameter to the peer. This command only affects the peer is configured + other than IPv4 unicast configuration. + + When remote peer does not have capability negotiation feature, remote + peer will not send any capabilities at all. In that case, bgp + configures the peer with configured capabilities. + + You may prefer locally configured capabilities more than the negotiated + capabilities even though remote peer sends capabilities. If the peer + is configured by *override-capability*, *bgpd* ignores + received capabilities then override negotiated capabilities with + configured values. + +.. index:: neighbor PEER override-capability +.. clicmd:: neighbor PEER override-capability + +.. index:: no neighbor PEER override-capability +.. clicmd:: no neighbor PEER override-capability + + Override the result of Capability Negotiation with local configuration. + Ignore remote peer's capability value. + +.. _route-reflector: + +Route Reflector +=============== + +.. index:: bgp cluster-id A.B.C.D +.. clicmd:: bgp cluster-id A.B.C.D + +.. index:: neighbor PEER route-reflector-client +.. clicmd:: neighbor PEER route-reflector-client + +.. index:: no neighbor PEER route-reflector-client +.. clicmd:: no neighbor PEER route-reflector-client + + +.. _route-server: + +Route Server +============ + +At an Internet Exchange point, many ISPs are connected to each other by the +"full mesh method". As with internal BGP full mesh formation, + +this method has a scaling problem. + +This scaling problem is well known. Route Server is a method to resolve the +problem. Each ISP's BGP router only peers to Route Server. Route Server serves +as BGP information exchange to other BGP routers. By applying this method, +numbers of BGP connections is reduced from O(n*(n-1)/2) to O(n). + +Unlike normal BGP router, Route Server must have several routing tables for +managing different routing policies for each BGP speaker. We call the routing +tables as different "views". *bgpd* can work as normal BGP router or Route +Server or both at the same time. + +.. _multiple-instance: + +Multiple instance +----------------- + +To enable multiple view function of *bgpd*, you must turn on multiple instance +feature beforehand. + +.. index:: bgp multiple-instance +.. clicmd:: bgp multiple-instance + + Enable BGP multiple instance feature. After this feature is enabled, + you can make multiple BGP instances or multiple BGP views. + +.. index:: no bgp multiple-instance +.. clicmd:: no bgp multiple-instance + + Disable BGP multiple instance feature. You can not disable this feature + when BGP multiple instances or views exist. + +When you want to make configuration more Cisco like one, + +.. index:: bgp config-type cisco +.. clicmd:: bgp config-type cisco + + Cisco compatible BGP configuration output. + +When bgp config-type cisco is specified, + +'no synchronization' is displayed. +'no auto-summary' is displayed. + +'network' and 'aggregate-address' argument is displayed as +'A.B.C.D M.M.M.M' + +FRR: network 10.0.0.0/8 +Cisco: network 10.0.0.0 + +FRR: aggregate-address 192.168.0.0/24 +Cisco: aggregate-address 192.168.0.0 255.255.255.0 + +Community attribute handling is also different. If there is no +configuration is specified community attribute and extended community +attribute are sent to neighbor. When user manually disable the +feature community attribute is not sent to the neighbor. In case of +*bgp config-type cisco* is specified, community attribute is not +sent to the neighbor by default. To send community attribute user has +to specify *neighbor A.B.C.D send-community* command.:: + + ! + router bgp 1 + neighbor 10.0.0.1 remote-as 1 + address-family ipv4 unicast + no neighbor 10.0.0.1 send-community + exit-address-family + ! + router bgp 1 + neighbor 10.0.0.1 remote-as 1 + address-family ipv4 unicast + neighbor 10.0.0.1 send-community + exit-address-family + ! + + +.. index:: bgp config-type zebra +.. clicmd:: bgp config-type zebra + + FRR style BGP configuration. This is default. + +.. _bgp-instance-and-view: + +BGP instance and view +--------------------- + +BGP instance is a normal BGP process. The result of route selection +goes to the kernel routing table. You can setup different AS at the +same time when BGP multiple instance feature is enabled. + +.. index:: router bgp AS-NUMBER +.. clicmd:: router bgp AS-NUMBER + + Make a new BGP instance. You can use arbitrary word for the `name`. + + :: + + bgp multiple-instance + ! + router bgp 1 + neighbor 10.0.0.1 remote-as 2 + neighbor 10.0.0.2 remote-as 3 + ! + router bgp 2 + neighbor 10.0.0.3 remote-as 4 + neighbor 10.0.0.4 remote-as 5 + + +BGP view is almost same as normal BGP process. The result of +route selection does not go to the kernel routing table. BGP view is +only for exchanging BGP routing information. + +.. index:: router bgp AS-NUMBER view NAME +.. clicmd:: router bgp AS-NUMBER view NAME + + Make a new BGP view. You can use arbitrary word for the `name`. This view's + route selection result does not go to the kernel routing table. + + With this command, you can setup Route Server like below. + + :: + + bgp multiple-instance + ! + router bgp 1 view 1 + neighbor 10.0.0.1 remote-as 2 + neighbor 10.0.0.2 remote-as 3 + ! + router bgp 2 view 2 + neighbor 10.0.0.3 remote-as 4 + neighbor 10.0.0.4 remote-as 5 + + +.. _routing-policy: + +Routing policy +-------------- + +You can set different routing policy for a peer. For example, you can +set different filter for a peer.:: + + bgp multiple-instance + ! + router bgp 1 view 1 + neighbor 10.0.0.1 remote-as 2 + address-family ipv4 unicast + neighbor 10.0.0.1 distribute-list 1 in + exit-address-family + ! + router bgp 1 view 2 + neighbor 10.0.0.1 remote-as 2 + address-family ipv4 unicast + neighbor 10.0.0.1 distribute-list 2 in + exit-address-family + + +This means BGP update from a peer 10.0.0.1 goes to both BGP view 1 and view +2. When the update is inserted into view 1, distribute-list 1 is +applied. On the other hand, when the update is inserted into view 2, +distribute-list 2 is applied. + +.. _viewing-the-view: + +Viewing the view +---------------- + +To display routing table of BGP view, you must specify view name. + +.. index:: show ip bgp view NAME +.. clicmd:: show ip bgp view NAME + + Display routing table of BGP view ``NAME``. + +.. _bgp-regular-expressions: + +BGP Regular Expressions +======================= + +BGP regular expressions are based on `POSIX 1003.2` regular +expressions. The following description is just a quick subset of the +`POSIX` regular expressions. Adding to that, the special character +'_' is added. + + +.* + Matches any single character. + +* + Matches 0 or more occurrences of pattern. + ++ + Matches 1 or more occurrences of pattern. + +? + Match 0 or 1 occurrences of pattern. + +^ + Matches the beginning of the line. + +$ + Matches the end of the line. + +_ + Character `_` has special meanings in BGP regular expressions. It matches + to space and comma , and AS set delimiter { and } and AS confederation + delimiter `(` and `)`. And it also matches to the beginning of the line and + the end of the line. So `_` can be used for AS value boundaries match. This + character technically evaluates to `(^|[,{}() ]|$)`. + +.. _how-to-set-up-a-6-bone-connection: + +How to set up a 6-Bone connection +================================= + +:: + + zebra configuration + =================== + ! + ! Actually there is no need to configure zebra + ! + + bgpd configuration + ================== + ! + ! This means that routes go through zebra and into the kernel. + ! + router zebra + ! + ! MP-BGP configuration + ! + router bgp 7675 + bgp router-id 10.0.0.1 + neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 remote-as `as-number` + ! + address-family ipv6 + network 3ffe:506::/32 + neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 activate + neighbor 3ffe:1cfa:0:2:2a0:c9ff:fe9e:f56 route-map set-nexthop out + neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 remote-as `as-number` + neighbor 3ffe:1cfa:0:2:2c0:4fff:fe68:a231 route-map set-nexthop out + exit-address-family + ! + ipv6 access-list all permit any + ! + ! Set output nexthop address. + ! + route-map set-nexthop permit 10 + match ipv6 address all + set ipv6 nexthop global 3ffe:1cfa:0:2:2c0:4fff:fe68:a225 + set ipv6 nexthop local fe80::2c0:4fff:fe68:a225 + ! + ! logfile FILENAME is obsolete. Please use log file FILENAME + + log file bgpd.log + ! + + +.. _dump-bgp-packets-and-table: + +Dump BGP packets and table +========================== + +.. index:: dump bgp all PATH [INTERVAL] +.. clicmd:: dump bgp all PATH [INTERVAL] + +.. index:: dump bgp all-et PATH [INTERVAL] +.. clicmd:: dump bgp all-et PATH [INTERVAL] + +.. index:: no dump bgp all [PATH] [INTERVAL] +.. clicmd:: no dump bgp all [PATH] [INTERVAL] + + Dump all BGP packet and events to `path` file. + If `interval` is set, a new file will be created for echo `interval` of seconds. + The path `path` can be set with date and time formatting (strftime). + The type ‘all-et’ enables support for Extended Timestamp Header (:ref:`packet-binary-dump-format`). + (:ref:`packet-binary-dump-format`) + +.. index:: dump bgp updates PATH [INTERVAL] +.. clicmd:: dump bgp updates PATH [INTERVAL] + +.. index:: dump bgp updates-et PATH [INTERVAL] +.. clicmd:: dump bgp updates-et PATH [INTERVAL] + +.. index:: no dump bgp updates [PATH] [INTERVAL] +.. clicmd:: no dump bgp updates [PATH] [INTERVAL] + + Dump only BGP updates messages to `path` file. + If `interval` is set, a new file will be created for echo `interval` of seconds. + The path `path` can be set with date and time formatting (strftime). + The type ‘updates-et’ enables support for Extended Timestamp Header (:ref:`packet-binary-dump-format`). + +.. index:: dump bgp routes-mrt PATH +.. clicmd:: dump bgp routes-mrt PATH + +.. index:: dump bgp routes-mrt PATH INTERVAL +.. clicmd:: dump bgp routes-mrt PATH INTERVAL + +.. index:: no dump bgp route-mrt [PATH] [INTERVAL] +.. clicmd:: no dump bgp route-mrt [PATH] [INTERVAL] + + Dump whole BGP routing table to `path`. This is heavy process. + The path `path` can be set with date and time formatting (strftime). + If `interval` is set, a new file will be created for echo `interval` of seconds. + + Note: the interval variable can also be set using hours and minutes: 04h20m00. + +.. _bgp-configuration-examples: + +BGP Configuration Examples +========================== + +Example of a session to an upstream, advertising only one prefix to it.:: + + router bgp 64512 + bgp router-id 10.236.87.1 + neighbor upstream peer-group + neighbor upstream remote-as 64515 + neighbor upstream capability dynamic + neighbor 10.1.1.1 peer-group upstream + neighbor 10.1.1.1 description ACME ISP + + address-family ipv4 unicast + network 10.236.87.0/24 + neighbor upstream prefix-list pl-allowed-adv out + exit-address-family + ! + ip prefix-list pl-allowed-adv seq 5 permit 82.195.133.0/25 + ip prefix-list pl-allowed-adv seq 10 deny any + +A more complex example. With upstream, peer and customer sessions. +Advertising global prefixes and NO_EXPORT prefixes and providing +actions for customer routes based on community values. Extensive use of +route-maps and the 'call' feature to support selective advertising of +prefixes. This example is intended as guidance only, it has NOT been +tested and almost certainly containts silly mistakes, if not serious +flaws. + +:: + + router bgp 64512 + bgp router-id 10.236.87.1 + neighbor upstream capability dynamic + neighbor cust capability dynamic + neighbor peer capability dynamic + neighbor 10.1.1.1 remote-as 64515 + neighbor 10.1.1.1 peer-group upstream + neighbor 10.2.1.1 remote-as 64516 + neighbor 10.2.1.1 peer-group upstream + neighbor 10.3.1.1 remote-as 64517 + neighbor 10.3.1.1 peer-group cust-default + neighbor 10.3.1.1 description customer1 + neighbor 10.4.1.1 remote-as 64518 + neighbor 10.4.1.1 peer-group cust + neighbor 10.4.1.1 description customer2 + neighbor 10.5.1.1 remote-as 64519 + neighbor 10.5.1.1 peer-group peer + neighbor 10.5.1.1 description peer AS 1 + neighbor 10.6.1.1 remote-as 64520 + neighbor 10.6.1.1 peer-group peer + neighbor 10.6.1.1 description peer AS 2 + + address-family ipv4 unicast + network 10.123.456.0/24 + network 10.123.456.128/25 route-map rm-no-export + neighbor upstream route-map rm-upstream-out out + neighbor cust route-map rm-cust-in in + neighbor cust route-map rm-cust-out out + neighbor cust send-community both + neighbor peer route-map rm-peer-in in + neighbor peer route-map rm-peer-out out + neighbor peer send-community both + neighbor 10.3.1.1 prefix-list pl-cust1-network in + neighbor 10.4.1.1 prefix-list pl-cust2-network in + neighbor 10.5.1.1 prefix-list pl-peer1-network in + neighbor 10.6.1.1 prefix-list pl-peer2-network in + exit-address-family + ! + ip prefix-list pl-default permit 0.0.0.0/0 + ! + ip prefix-list pl-upstream-peers permit 10.1.1.1/32 + ip prefix-list pl-upstream-peers permit 10.2.1.1/32 + ! + ip prefix-list pl-cust1-network permit 10.3.1.0/24 + ip prefix-list pl-cust1-network permit 10.3.2.0/24 + ! + ip prefix-list pl-cust2-network permit 10.4.1.0/24 + ! + ip prefix-list pl-peer1-network permit 10.5.1.0/24 + ip prefix-list pl-peer1-network permit 10.5.2.0/24 + ip prefix-list pl-peer1-network permit 192.168.0.0/24 + ! + ip prefix-list pl-peer2-network permit 10.6.1.0/24 + ip prefix-list pl-peer2-network permit 10.6.2.0/24 + ip prefix-list pl-peer2-network permit 192.168.1.0/24 + ip prefix-list pl-peer2-network permit 192.168.2.0/24 + ip prefix-list pl-peer2-network permit 172.16.1/24 + ! + ip as-path access-list asp-own-as permit ^$ + ip as-path access-list asp-own-as permit _64512_ + ! + ! ################################################################# + ! Match communities we provide actions for, on routes receives from + ! customers. Communities values of <our-ASN>:X, with X, have actions: + ! + ! 100 - blackhole the prefix + ! 200 - set no_export + ! 300 - advertise only to other customers + ! 400 - advertise only to upstreams + ! 500 - set no_export when advertising to upstreams + ! 2X00 - set local_preference to X00 + ! + ! blackhole the prefix of the route + ip community-list standard cm-blackhole permit 64512:100 + ! + ! set no-export community before advertising + ip community-list standard cm-set-no-export permit 64512:200 + ! + ! advertise only to other customers + ip community-list standard cm-cust-only permit 64512:300 + ! + ! advertise only to upstreams + ip community-list standard cm-upstream-only permit 64512:400 + ! + ! advertise to upstreams with no-export + ip community-list standard cm-upstream-noexport permit 64512:500 + ! + ! set local-pref to least significant 3 digits of the community + ip community-list standard cm-prefmod-100 permit 64512:2100 + ip community-list standard cm-prefmod-200 permit 64512:2200 + ip community-list standard cm-prefmod-300 permit 64512:2300 + ip community-list standard cm-prefmod-400 permit 64512:2400 + ip community-list expanded cme-prefmod-range permit 64512:2... + ! + ! Informational communities + ! + ! 3000 - learned from upstream + ! 3100 - learned from customer + ! 3200 - learned from peer + ! + ip community-list standard cm-learnt-upstream permit 64512:3000 + ip community-list standard cm-learnt-cust permit 64512:3100 + ip community-list standard cm-learnt-peer permit 64512:3200 + ! + ! ################################################################### + ! Utility route-maps + ! + ! These utility route-maps generally should not used to permit/deny + ! routes, i.e. they do not have meaning as filters, and hence probably + ! should be used with 'on-match next'. These all finish with an empty + ! permit entry so as not interfere with processing in the caller. + ! + route-map rm-no-export permit 10 + set community additive no-export + route-map rm-no-export permit 20 + ! + route-map rm-blackhole permit 10 + description blackhole, up-pref and ensure it cant escape this AS + set ip next-hop 127.0.0.1 + set local-preference 10 + set community additive no-export + route-map rm-blackhole permit 20 + ! + ! Set local-pref as requested + route-map rm-prefmod permit 10 + match community cm-prefmod-100 + set local-preference 100 + route-map rm-prefmod permit 20 + match community cm-prefmod-200 + set local-preference 200 + route-map rm-prefmod permit 30 + match community cm-prefmod-300 + set local-preference 300 + route-map rm-prefmod permit 40 + match community cm-prefmod-400 + set local-preference 400 + route-map rm-prefmod permit 50 + ! + ! Community actions to take on receipt of route. + route-map rm-community-in permit 10 + description check for blackholing, no point continuing if it matches. + match community cm-blackhole + call rm-blackhole + route-map rm-community-in permit 20 + match community cm-set-no-export + call rm-no-export + on-match next + route-map rm-community-in permit 30 + match community cme-prefmod-range + call rm-prefmod + route-map rm-community-in permit 40 + ! + ! ##################################################################### + ! Community actions to take when advertising a route. + ! These are filtering route-maps, + ! + ! Deny customer routes to upstream with cust-only set. + route-map rm-community-filt-to-upstream deny 10 + match community cm-learnt-cust + match community cm-cust-only + route-map rm-community-filt-to-upstream permit 20 + ! + ! Deny customer routes to other customers with upstream-only set. + route-map rm-community-filt-to-cust deny 10 + match community cm-learnt-cust + match community cm-upstream-only + route-map rm-community-filt-to-cust permit 20 + ! + ! ################################################################### + ! The top-level route-maps applied to sessions. Further entries could + ! be added obviously.. + ! + ! Customers + route-map rm-cust-in permit 10 + call rm-community-in + on-match next + route-map rm-cust-in permit 20 + set community additive 64512:3100 + route-map rm-cust-in permit 30 + ! + route-map rm-cust-out permit 10 + call rm-community-filt-to-cust + on-match next + route-map rm-cust-out permit 20 + ! + ! Upstream transit ASes + route-map rm-upstream-out permit 10 + description filter customer prefixes which are marked cust-only + call rm-community-filt-to-upstream + on-match next + route-map rm-upstream-out permit 20 + description only customer routes are provided to upstreams/peers + match community cm-learnt-cust + ! + ! Peer ASes + ! outbound policy is same as for upstream + route-map rm-peer-out permit 10 + call rm-upstream-out + ! + route-map rm-peer-in permit 10 + set community additive 64512:3200 + +.. include:: routeserver.rst + +.. include:: rpki.rst + + +.. [#med-transitivity-rant] For some set of objects to have an order, there *must* be some binary ordering relation that is defined for *every* combination of those objects, and that relation *must* be transitive. I.e.:, if the relation operator is <, and if a < b and b < c then that relation must carry over and it *must* be that a < c for the objects to have an order. The ordering relation may allow for equality, i.e. a < b and b < a may both be true amd imply that a and b are equal in the order and not distinguished by it, in which case the set has a partial order. Otherwise, if there is an order, all the objects have a distinct place in the order and the set has a total order) +.. [bgp-route-osci-cond] McPherson, D. and Gill, V. and Walton, D., "Border Gateway Protocol (BGP) Persistent Route Oscillation Condition", IETF RFC3345 +.. [stable-flexible-ibgp] Flavel, A. and M. Roughan, "Stable and flexible iBGP", ACM SIGCOMM 2009 +.. [ibgp-correctness] Griffin, T. and G. Wilfong, "On the correctness of IBGP configuration", ACM SIGCOMM 2002 diff --git a/doc/user/conf.py b/doc/user/conf.py new file mode 100644 index 000000000..efe102374 --- /dev/null +++ b/doc/user/conf.py @@ -0,0 +1,341 @@ +# -*- coding: utf-8 -*- +# +# FRR documentation build configuration file, created by +# sphinx-quickstart on Tue Jan 31 16:00:52 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os +import re + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = '1.0' + +# prolog for various variable substitutions +rst_prolog = '' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.todo'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# source_suffix = ['.rst'] +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'FRR' +copyright = u'2017, FRR' +author = u'FRR' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. + +# The short X.Y version. +version = u'?.?' +# The full version, including alpha/beta/rc tags. +release = u'?.?-?' + + +# ----------------------------------------------------------------------------- +# Extract values from codebase for substitution into docs. +# ----------------------------------------------------------------------------- + +# Various installation prefixes. Reasonable defaults are set where possible. +# Values are overridden by logic below. +replace_vars = { + 'AUTHORS': 'Kunihiro Ishiguro, et al.', + 'COPYRIGHT_YEAR': '1999-2005', + 'COPYRIGHT_STR': None, + 'PACKAGE_NAME': project.lower(), + 'PACKAGE_TARNAME': project.lower(), + 'PACKAGE_STRING': None, + 'PACKAGE_URL': 'https://frrouting.org/', + 'PACKAGE_VERSION': None, + 'INSTALL_PREFIX_ETC': None, + 'INSTALL_PREFIX_SBIN': None, + 'INSTALL_PREFIX_STATE': None, + 'INSTALL_PREFIX_MODULES': None, + 'INSTALL_USER': None, + 'INSTALL_GROUP': None, + 'INSTALL_VTY_GROUP': None, +} + +# extract version information, installation location, other stuff we need to +# use when building final documents +val = re.compile('^S\["([^"]+)"\]="(.*)"$') +with open('../../config.status', 'r') as cfgstatus: + for ln in cfgstatus.readlines(): + m = val.match(ln) + if not m or m.group(1) not in replace_vars.keys(): continue + replace_vars[m.group(1)] = m.group(2) + +# manually fill out some of these we can't get from config.status +replace_vars['COPYRIGHT_STR'] = "Copyright (c)" +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['COPYRIGHT_YEAR']) +replace_vars['COPYRIGHT_STR'] += ' {0}'.format(replace_vars['AUTHORS']) +release = replace_vars['PACKAGE_VERSION'] +version = release.split('-')[0] + +# add substitutions to prolog +for key, value in replace_vars.items(): + rst_prolog += '.. |{0}| replace:: {1}\n'.format(key, value) + + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build', 'rpki.rst', 'routeserver.rst', 'ospf_fundamentals.rst'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + 'sidebarbgcolor': '#374249' +} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# "<project> v<release> documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +html_logo = '../figures/frr-icon.svg' + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +html_favicon = '../figures/frr-logo-icon.png' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr' +#html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# Now only 'ja' uses this config value +#html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +#html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'FRRdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', + +# Latex figure (float) alignment +#'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'FRR.tex', u'FRR User Manual', + u'FRR', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +latex_logo = '../figures/frr-logo-medium.png' + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'frr', u'FRR User Manual', + [author], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'frr', u'FRR User Manual', + author, 'FRR', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + +# custom extensions here +def setup(app): + # object type for FRR CLI commands, can be extended to document parent CLI + # node later on + app.add_object_type('clicmd', 'clicmd') diff --git a/doc/user/eigrpd.rst b/doc/user/eigrpd.rst new file mode 100644 index 000000000..309ee27cc --- /dev/null +++ b/doc/user/eigrpd.rst @@ -0,0 +1,243 @@ +.. _eigrp: + +***** +EIGRP +***** + +.. glossary:: + + DUAL + The *Diffusing Update ALgorithm*, a :term:`Bellman-Ford` based routing + algorithm used by EIGRP. + +EIGRP -- Routing Information Protocol is widely deployed interior gateway +routing protocol. EIGRP was developed in the 1990's. EIGRP is a +:term:`distance-vector` protocol and is based on the :term:`DUAL` algorithms. +As a distance-vector protocol, the EIGRP router send updates to its +neighbors as networks change, thus allowing the convergence to a +known topology. + +*eigrpd* supports EIGRP as described in RFC7868 + +.. _starting-and-stopping-eigrpd: + +Starting and Stopping eigrpd +============================ + +The default configuration file name of *eigrpd*'s is :file:`eigrpd.conf`. When +invocation *eigrpd* searches directory |INSTALL_PREFIX_ETC|. If +:file:`eigrpd.conf` is not there next search current directory. If an +integrated config is specified configuration is written into :file:`frr.conf`. + +The EIGRP protocol requires interface information maintained by *zebra* daemon. +So running *zebra* is mandatory to run *eigrpd*. Thus minimum sequence for +running EIGRP is: + +:: + + # zebra -d + # eigrpd -d + + +Please note that *zebra* must be invoked before *eigrpd*. + +To stop *eigrpd*, please use :: + kill `cat /var/run/eigrpd.pid` + +Certain signals have special meanings to *eigrpd*. + ++------------------+-----------------------------------------------------------+ +| Signal | Meaning | ++==================+===========================================================+ +| SIGHUP & SIGUSR1 | Rotate the log file | ++------------------+-----------------------------------------------------------+ +| SIGINT & SIGTERM | Sweep all installed EIGRP routes and gracefully terminate | ++------------------+-----------------------------------------------------------+ + + +*eigrpd* invocation options. Common options that can be specified +(:ref:`common-invocation-options`). + +.. program:: eigrpd + +.. option:: -r +.. option:: --retain + + When the program terminates, retain routes added by *eigrpd*. + +.. _eigrp-configuration: + +EIGRP Configuration +=================== + +.. index:: router eigrp (1-65535) +.. clicmd:: router eigrp (1-65535) + + The `router eigrp` command is necessary to enable EIGRP. To disable EIGRP, + use the `no router eigrp (1-65535)` command. EIGRP must be enabled before + carrying out any of the EIGRP commands. + +.. index:: no router eigrp (1-65535) +.. clicmd:: no router eigrp (1-65535) + + Disable EIGRP. + +.. index:: network NETWORK +.. clicmd:: network NETWORK + +.. index:: no network NETWORK +.. clicmd:: no network NETWORK + + Set the EIGRP enable interface by `network`. The interfaces which + have addresses matching with `network` are enabled. + + This group of commands either enables or disables EIGRP interfaces between + certain numbers of a specified network address. For example, if the + network for 10.0.0.0/24 is EIGRP enabled, this would result in all the + addresses from 10.0.0.0 to 10.0.0.255 being enabled for EIGRP. The `no + network` command will disable EIGRP for the specified network. + + Below is very simple EIGRP configuration. Interface `eth0` and + interface which address match to `10.0.0.0/8` are EIGRP enabled. + + :: + + ! + router eigrp 1 + network 10.0.0.0/8 + ! + + +.. index:: passive-interface (IFNAME|default) +.. clicmd:: passive-interface (IFNAME|default) + +.. index:: no passive-interface IFNAME +.. clicmd:: no passive-interface IFNAME + + This command sets the specified interface to passive mode. On passive mode + interface, all receiving packets are ignored and eigrpd does not send either + multicast or unicast EIGRP packets except to EIGRP neighbors specified with + `neighbor` command. The interface may be specified as `default` to make + eigrpd default to passive on all interfaces. + + The default is to be passive on all interfaces. + +.. _how-to-announce-eigrp-route: + +How to Announce EIGRP route +=========================== + +.. index:: redistribute kernel +.. clicmd:: redistribute kernel + +.. index:: redistribute kernel metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) +.. clicmd:: redistribute kernel metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) + +.. index:: no redistribute kernel +.. clicmd:: no redistribute kernel + + `redistribute kernel` redistributes routing information from kernel route + entries into the EIGRP tables. `no redistribute kernel` disables the routes. + +.. index:: redistribute static +.. clicmd:: redistribute static + +.. index:: redistribute static metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) +.. clicmd:: redistribute static metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) + +.. index:: no redistribute static +.. clicmd:: no redistribute static + + `redistribute static` redistributes routing information from static route + entries into the EIGRP tables. `no redistribute static` disables the routes. + +.. index:: redistribute connected +.. clicmd:: redistribute connected + +.. index:: redistribute connected metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) +.. clicmd:: redistribute connected metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) + +.. index:: no redistribute connected +.. clicmd:: no redistribute connected + + Redistribute connected routes into the EIGRP tables. `no redistribute + connected` disables the connected routes in the EIGRP tables. This command + redistribute connected of the interface which EIGRP disabled. The connected + route on EIGRP enabled interface is announced by default. + +.. index:: redistribute ospf +.. clicmd:: redistribute ospf + +.. index:: redistribute ospf metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) +.. clicmd:: redistribute ospf metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) + +.. index:: no redistribute ospf +.. clicmd:: no redistribute ospf + + `redistribute ospf` redistributes routing information from ospf route + entries into the EIGRP tables. `no redistribute ospf` disables the routes. + +.. index:: redistribute bgp +.. clicmd:: redistribute bgp + +.. index:: redistribute bgp metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) +.. clicmd:: redistribute bgp metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535) + +.. index:: no redistribute bgp +.. clicmd:: no redistribute bgp + + `redistribute bgp` redistributes routing information from bgp route entries + into the EIGRP tables. `no redistribute bgp` disables the routes. + +.. _show-eigrp-information: + +Show EIGRP Information +====================== + +.. index:: show ip eigrp topology +.. clicmd:: show ip eigrp topology + + Display current EIGRP status. + + :: + + eigrpd> **show ip eigrp topology** + # show ip eigrp topo + + EIGRP Topology Table for AS(4)/ID(0.0.0.0) + + Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply + r - reply Status, s - sia Status + + P 10.0.2.0/24, 1 successors, FD is 256256, serno: 0 + via Connected, enp0s3 + + +EIGRP Debug Commands +==================== + +Debug for EIGRP protocol. + +.. index:: debug eigrp packets +.. clicmd:: debug eigrp packets + + Debug eigrp packets + + ``debug eigrp`` will show EIGRP packets that are sent and recevied. + +.. index:: debug eigrp transmit +.. clicmd:: debug eigrp transmit + + Debug eigrp transmit events + + ``debug eigrp transmit`` will display detailed information about the EIGRP + transmit events. + +.. index:: show debugging eigrp +.. clicmd:: show debugging eigrp + + Display *eigrpd*'s debugging option. + + ``show debugging eigrp`` will show all information currently set for eigrpd + debug. + diff --git a/doc/user/filter.rst b/doc/user/filter.rst new file mode 100644 index 000000000..57f9fbe42 --- /dev/null +++ b/doc/user/filter.rst @@ -0,0 +1,178 @@ +********* +Filtering +********* + +FRR provides many very flexible filtering features. Filtering is used +for both input and output of the routing information. Once filtering is +defined, it can be applied in any direction. + +IP Access List +============== + +.. index:: access-list NAME permit IPV4-NETWORK +.. clicmd:: access-list NAME permit IPV4-NETWORK + +.. index:: access-list NAME deny IPV4-NETWORK +.. clicmd:: access-list NAME deny IPV4-NETWORK + + Basic filtering is done by `access-list` as shown in the + following example. + + :: + + access-list filter deny 10.0.0.0/9 + access-list filter permit 10.0.0.0/8 + + +IP Prefix List +============== + +*ip prefix-list* provides the most powerful prefix based +filtering mechanism. In addition to *access-list* functionality, +*ip prefix-list* has prefix length range specification and +sequential number specification. You can add or delete prefix based +filters to arbitrary points of prefix-list using sequential number specification. + +If no ip prefix-list is specified, it acts as permit. If *ip prefix-list* +is defined, and no match is found, default deny is applied. + +.. index:: ip prefix-list NAME (permit|deny) PREFIX [le LEN] [ge LEN] +.. clicmd:: ip prefix-list NAME (permit|deny) PREFIX [le LEN] [ge LEN] + +.. index:: ip prefix-list NAME seq NUMBER (permit|deny) PREFIX [le LEN] [ge LEN] +.. clicmd:: ip prefix-list NAME seq NUMBER (permit|deny) PREFIX [le LEN] [ge LEN] + + You can create *ip prefix-list* using above commands. + + seq + seq `number` can be set either automatically or manually. In the + case that sequential numbers are set manually, the user may pick any + number less than 4294967295. In the case that sequential number are set + automatically, the sequential number will increase by a unit of five (5) + per list. If a list with no specified sequential number is created + after a list with a specified sequential number, the list will + automatically pick the next multiple of five (5) as the list number. + For example, if a list with number 2 already exists and a new list with + no specified number is created, the next list will be numbered 5. If + lists 2 and 7 already exist and a new list with no specified number is + created, the new list will be numbered 10. + + le + Specifies prefix length. The prefix list will be applied if the prefix + length is less than or equal to the le prefix length. + + ge + Specifies prefix length. The prefix list will be applied if the prefix + length is greater than or equal to the ge prefix length. + + + Less than or equal to prefix numbers and greater than or equal to + prefix numbers can be used together. The order of the le and ge + commands does not matter. + + If a prefix list with a different sequential number but with the exact + same rules as a previous list is created, an error will result. + However, in the case that the sequential number and the rules are + exactly similar, no error will result. + + If a list with the same sequential number as a previous list is created, + the new list will overwrite the old list. + + Matching of IP Prefix is performed from the smaller sequential number to the + larger. The matching will stop once any rule has been applied. + + In the case of no le or ge command, the prefix length must match exactly the + length specified in the prefix list. + +.. index:: no ip prefix-list NAME +.. clicmd:: no ip prefix-list NAME + +.. _ip-prefix-list-description: + +ip prefix-list description +-------------------------- + +.. index:: ip prefix-list NAME description DESC +.. clicmd:: ip prefix-list NAME description DESC + + Descriptions may be added to prefix lists. This command adds a + description to the prefix list. + +.. index:: no ip prefix-list NAME description [DESC] +.. clicmd:: no ip prefix-list NAME description [DESC] + + Deletes the description from a prefix list. It is possible to use the + command without the full description. + +.. _ip-prefix-list-sequential-number-control: + +ip prefix-list sequential number control +---------------------------------------- + +.. index:: ip prefix-list sequence-number +.. clicmd:: ip prefix-list sequence-number + + With this command, the IP prefix list sequential number is displayed. + This is the default behavior. + +.. index:: no ip prefix-list sequence-number +.. clicmd:: no ip prefix-list sequence-number + + With this command, the IP prefix list sequential number is not + displayed. + +.. _showing-ip-prefix-list: + +Showing ip prefix-list +---------------------- + +.. index:: show ip prefix-list +.. clicmd:: show ip prefix-list + + Display all IP prefix lists. + +.. index:: show ip prefix-list NAME +.. clicmd:: show ip prefix-list NAME + + Show IP prefix list can be used with a prefix list name. + +.. index:: show ip prefix-list NAME seq NUM +.. clicmd:: show ip prefix-list NAME seq NUM + + Show IP prefix list can be used with a prefix list name and sequential + number. + +.. index:: show ip prefix-list NAME A.B.C.D/M +.. clicmd:: show ip prefix-list NAME A.B.C.D/M + + If the command longer is used, all prefix lists with prefix lengths equal to + or longer than the specified length will be displayed. If the command first + match is used, the first prefix length match will be displayed. + +.. index:: show ip prefix-list NAME A.B.C.D/M longer +.. clicmd:: show ip prefix-list NAME A.B.C.D/M longer +.. index:: show ip prefix-list NAME A.B.C.D/M first-match +.. clicmd:: show ip prefix-list NAME A.B.C.D/M first-match +.. index:: show ip prefix-list summary +.. clicmd:: show ip prefix-list summary +.. index:: show ip prefix-list summary NAME +.. clicmd:: show ip prefix-list summary NAME +.. index:: show ip prefix-list detail +.. clicmd:: show ip prefix-list detail +.. index:: show ip prefix-list detail NAME +.. clicmd:: show ip prefix-list detail NAME + +Clear counter of ip prefix-list +------------------------------- + +.. index:: clear ip prefix-list +.. clicmd:: clear ip prefix-list + + Clears the counters of all IP prefix lists. Clear IP Prefix List can be used + with a specified name and prefix. + +.. index:: clear ip prefix-list NAME +.. clicmd:: clear ip prefix-list NAME + +.. index:: clear ip prefix-list NAME A.B.C.D/M +.. clicmd:: clear ip prefix-list NAME A.B.C.D/M diff --git a/doc/user/glossary.rst b/doc/user/glossary.rst new file mode 100644 index 000000000..6b49336d4 --- /dev/null +++ b/doc/user/glossary.rst @@ -0,0 +1,41 @@ +******** +Glossary +******** + +.. glossary:: + + distance-vector + A distance-vector routing protocol in data networks determines the best + route for data packets based on distance. Distance-vector routing + protocols measure the distance by the number of routers a packet has to + pass. Some distance-vector protocols also take into account network + latency and other factors that influence traffic on a given route. To + determine the best route across a network, routers on which a + distance-vector protocol is implemented exchange information with one + another, usually routing tables plus hop counts for destination networks + and possibly other traffic information. Distance-vector routing protocols + also require that a router informs its neighbours of network topology + changes periodically. [distance-vector-rp]_ + + link-state + Link-state algorithms (also known as shortest path first algorithms) + flood routing information to all nodes in the internetwork. Each router, + however, sends only the portion of the routing table that describes the + state of its own links. In link-state algorithms, each router builds a + picture of the entire network in its routing tables. Distance vector + algorithms (also known as Bellman-Ford algorithms) call for each router + to send all or some portion of its routing table, but only to its + neighbors. In essence, link-state algorithms send small updates + everywhere, while distance vector algorithms send larger updates only to + neighboring routers. Distance vector algorithms know only about their + neighbors. [link-state-rp]_ + + Bellman-Ford + The Bellman–Ford algorithm is an algorithm that computes shortest paths + from a single source vertex to all of the other vertices in a weighted + digraph. [bellman-ford]_ + + +.. [distance-vector-rp] https://en.wikipedia.org/wiki/Distance-vector_routing_protocol +.. [link-state-rp] https://en.wikipedia.org/wiki/Link-state_routing_protocol +.. [bellman-ford] https://en.wikipedia.org/wiki/Bellman-Ford_algorithm diff --git a/doc/user/index.rst b/doc/user/index.rst new file mode 100644 index 000000000..54ee8b12f --- /dev/null +++ b/doc/user/index.rst @@ -0,0 +1,31 @@ +Welcome to FRR's documentation! +=============================== + +.. toctree:: + :maxdepth: 2 + + overview + installation + basic + vtysh + filter + routemap + ipv6 + kernel + snmp + zebra + protocol + bgp + babeld + eigrpd + isisd + nhrpd + ospfd + ospf6d + pim + ripd + ripngd + vnc + glossary + appendix + diff --git a/doc/user/installation.rst b/doc/user/installation.rst new file mode 100644 index 000000000..6c68815ea --- /dev/null +++ b/doc/user/installation.rst @@ -0,0 +1,348 @@ +.. _installation: + +************ +Installation +************ + +.. index:: How to install FRR +.. index:: Installation +.. index:: Installing FRR +.. index:: Building the system +.. index:: Making FRR + +Several distributions provide packages for FRR. Check your distribution's +respositories to find out if a suitable version is available. + +FRR depends on various libraries depending on your operating system. + +After installing these dependencies, change to the frr source directory and +issue the following commands: + +:: + + $ ./bootstrap.sh + $ ./configure + $ make + $ make install + + +.. _configure-the-software: + +Configure the Software +====================== + + +.. _the-configure-script: + +The Configure Script +-------------------- + +.. index:: Configuration options + +.. index:: Options for configuring + +.. index:: Build options + +.. index:: Distribution configuration + +.. index:: Options to `./configure` + +FRR has an excellent configure script which automatically detects most +host configurations. There are several additional configure options to +customize the build to include or exclude specific features and dependencies. + +.. program:: configure + +.. option:: --disable-zebra + + Do not build zebra daemon. + +.. option:: --disable-ripd + + Do not build ripd. + +.. option:: --disable-ripngd + + Do not build ripngd. + +.. option:: --disable-ospfd + + Do not build ospfd. + +.. option:: --disable-ospf6d + + Do not build ospf6d. + +.. option:: --disable-bgpd + + Do not build bgpd. + +.. option:: --disable-bgp-announce + + Make *bgpd* which does not make bgp announcements at all. This + feature is good for using *bgpd* as a BGP announcement listener. + +.. option:: --enable-datacenter + + Enable system defaults to work as if in a Data Center. See defaults.h + for what is changed by this configure option. + +.. option:: --enable-snmp + + Enable SNMP support. By default, SNMP support is disabled. + +.. option:: --disable-ospfapi + + Disable support for OSPF-API, an API to interface directly with ospfd. + OSPF-API is enabled if --enable-opaque-lsa is set. + +.. option:: --disable-ospfclient + + Disable building of the example OSPF-API client. + +.. option:: --disable-ospf-ri + + Disable support for OSPF Router Information (RFC4970 & RFC5088) this + requires support for Opaque LSAs and Traffic Engineering. + +.. option:: --disable-isisd + + Do not build isisd. + +.. option:: --enable-isis-topology + + Enable IS-IS topology generator. + +.. option:: --enable-isis-te + + Enable Traffic Engineering Extension for ISIS (RFC5305) + +.. option:: --enable-multipath <ARG> + + Enable support for Equal Cost Multipath. `ARG` is the maximum number + of ECMP paths to allow, set to 0 to allow unlimited number of paths. + +.. option:: --enable-realms + + Enable the support of Linux Realms. Convert tag values from 1-255 into a + realm value when inserting into the Linux kernel. Then routing policy can be + assigned to the realm. See the tc man page. + +.. option:: --disable-rtadv + + Disable support IPV6 router advertisement in zebra. + +.. option:: --enable-gcc-rdynamic + + Pass the ``-rdynamic`` option to the linker driver. This is in most cases + neccessary for getting usable backtraces. This option defaults to on if the + compiler is detected as gcc, but giving an explicit enable/disable is + suggested. + +.. option:: --disable-backtrace + + Controls backtrace support for the crash handlers. This is autodetected by + default. Using the switch will enforce the requested behaviour, failing with + an error if support is requested but not available. On BSD systems, this + needs libexecinfo, while on glibc support for this is part of libc itself. + +.. option:: --enable-dev-build + + Turn on some options for compiling FRR within a development environment in + mind. Specifically turn on -g3 -O0 for compiling options and add inclusion + of grammar sandbox. + +.. option:: --enable-fuzzing + + Turn on some compile options to allow you to run fuzzing tools against the + system. This flag is intended as a developer only tool and should not be + used for normal operations. + +.. option:: --disable-snmp + + Build without SNMP support. + +.. option:: --disable-vtysh + + Build without VTYSH. + +.. option:: --enable-fpm + + Build with FPM module support. + +.. option:: --enable-numeric-version + + Alpine Linux does not allow non-numeric characters in the version string. + With this option, we provide a way to strip out these characters for apk dev + package builds. + +You may specify any combination of the above options to the configure +script. By default, the executables are placed in :file:`/usr/local/sbin` +and the configuration files in :file:`/usr/local/etc`. The :file:`/usr/local/` +installation prefix and other directories may be changed using the following +options to the configuration script. + +.. option:: --prefix <prefix> + + Install architecture-independent files in `prefix` [/usr/local]. + +.. option:: --sysconfdir <dir> + + Look for configuration files in `dir` [`prefix`/etc]. Note that sample + configuration files will be installed here. + +.. option:: --localstatedir <dir> + + Configure zebra to use `dir` for local state files, such as pid files and + unix sockets. + +.. _least-privilege-support: + +Least-Privilege Support +----------------------- + +.. index:: FRR Least-Privileges + +.. index:: FRR Privileges + +Additionally, you may configure zebra to drop its elevated privileges +shortly after startup and switch to another user. The configure script will +automatically try to configure this support. There are three configure +options to control the behaviour of FRR daemons. + +.. option:: --enable-user <user> + + Switch to user `user shortly after startup, and run as user `user` in normal + operation. + +.. option:: --enable-group <user> + + Switch real and effective group to `group` shortly after startup. + +.. option:: --enable-vty-group <group> + + Create Unix Vty sockets (for use with vtysh) with group owndership set to + `group`. This allows one to create a seperate group which is restricted to + accessing only the vty sockets, hence allowing one to delegate this group to + individual users, or to run vtysh setgid to this group. + +The default user and group which will be configured is 'frr' if no user or +group is specified. Note that this user or group requires write access to the +local state directory (see :option:`--localstatedir`) and requires at least +read access, and write access if you wish to allow daemons to write out their +configuration, to the configuration directory (see :option:`--sysconfdir`). + +On systems which have the 'libcap' capabilities manipulation library (currently +only Linux), FRR will retain only minimal capabilities required and will only +raise these capabilities for brief periods. On systems without libcap, FRR will +run as the user specified and only raise its UID to 0 for brief periods. + +.. _linux-notes: + +Linux Notes +----------- + +.. index:: Configuring FRR + +.. index:: Building on Linux boxes + +.. index:: Linux configurations + +There are several options available only to GNU/Linux systems [#]_. +If you use GNU/Linux, make sure that the current kernel configuration is what +you want. FRR will run with any kernel configuration but some recommendations +do exist. + + +- :makevar:`CONFIG_NETLINK` + Kernel/User netlink socket. This is a brand new feature which enables an + advanced interface between the Linux kernel and zebra (:ref:`kernel-interface`). +- :makevar:`CONFIG_RTNETLINK` + Routing messages. + This makes it possible to receive netlink routing messages. If you + specify this option, *zebra* can detect routing information + updates directly from the kernel (:ref:`kernel-interface`). +- :makevar:`CONFIG_IP_MULTICAST` + IP: multicasting. + This option should be specified when you use *ripd* (:ref:`rip`) or + *ospfd* (:ref:`ospfv2`) because these protocols use multicast. + +IPv6 support has been added in GNU/Linux kernel version 2.2. If you +try to use the FRR IPv6 feature on a GNU/Linux kernel, please +make sure the following libraries have been installed. Please note that +these libraries will not be needed when you uses GNU C library 2.1 +or upper. + +- inet6-apps + + The `inet6-apps` package includes basic IPv6 related libraries such + as `inet_ntop` and `inet_pton`. Some basic IPv6 programs such + as *ping*, *ftp*, and *inetd* are also + included. The `inet-apps` can be found at + `ftp://ftp.inner.net/pub/ipv6/ <ftp://ftp.inner.net/pub/ipv6/>`_. + +- net-tools + + The `net-tools` package provides an IPv6 enabled interface and routing + utility. It contains *ifconfig*, *route*, *netstat*, and other tools. + `net-tools` may be found at http://www.tazenda.demon.co.uk/phil/net-tools/. + +.. _build-the-software: + +Build the Software +================== + +After configuring the software, you will need to compile it for your system. +Simply issue the command *make* in the root of the source directory and the +software will be compiled. Cliff Notes versions of different compilation +examples can be found in the Developer's Manual Appendix. If you have *any* +problems at this stage, please send a bug report :ref:`bug-reports`. + +:: + + $ ./bootstrap.sh + $ ./configure <appropriate to your system> + $ make + + +Install the Software +==================== + +Installing the software to your system consists of copying the compiled +programs and supporting files to a standard location. After the +installation process has completed, these files have been copied +from your work directory to :file:`/usr/local/bin`, and :file:`/usr/local/etc`. + +To install the FRR suite, issue the following command at your shell +prompt::: + + $ make install + +FRR daemons have their own terminal interface or VTY. After +installation, you have to setup each beast's port number to connect to +them. Please add the following entries to :file:`/etc/services`. + +:: + + zebrasrv 2600/tcp # zebra service + zebra 2601/tcp # zebra vty + ripd 2602/tcp # RIPd vty + ripngd 2603/tcp # RIPngd vty + ospfd 2604/tcp # OSPFd vty + bgpd 2605/tcp # BGPd vty + ospf6d 2606/tcp # OSPF6d vty + ospfapi 2607/tcp # ospfapi + isisd 2608/tcp # ISISd vty + nhrpd 2610/tcp # nhrpd vty + pimd 2611/tcp # PIMd vty + + +If you use a FreeBSD newer than 2.2.8, the above entries are already +added to :file:`/etc/services` so there is no need to add it. If you +specify a port number when starting the daemon, these entries may not be +needed. + +You may need to make changes to the config files in +|INSTALL_PREFIX_ETC|. :ref:`config-commands`. + +.. [#] GNU/Linux has very flexible kernel configuration features. diff --git a/doc/user/ipv6.rst b/doc/user/ipv6.rst new file mode 100644 index 000000000..9d079028c --- /dev/null +++ b/doc/user/ipv6.rst @@ -0,0 +1,193 @@ +.. _ipv6-support: + +************ +IPv6 Support +************ + +FRR fully supports IPv6 routing. As described so far, Frr supports RIPng, +OSPFv3, and BGP-4+. You can give IPv6 addresses to an interface and configure +static IPv6 routing information. FRR IPv6 also provides automatic address +configuration via a feature called ``address auto configuration``. To do it, +the router must send router advertisement messages to the all nodes that exist +on the network. + +Previous versions of FRR could be built without IPv6 support. This is +no longer possible. + +Router Advertisement +==================== + +.. index:: no ipv6 nd suppress-ra +.. clicmd:: no ipv6 nd suppress-ra + + Send router advertisment messages. + +.. index:: ipv6 nd suppress-ra +.. clicmd:: ipv6 nd suppress-ra + + Don't send router advertisment messages. + +.. index:: ipv6 nd prefix ipv6prefix [valid-lifetime] [preferred-lifetime] [off-link] [no-autoconfig] [router-address] +.. clicmd:: ipv6 nd prefix ipv6prefix [valid-lifetime] [preferred-lifetime] [off-link] [no-autoconfig] [router-address] + + Configuring the IPv6 prefix to include in router advertisements. Several prefix + specific optional parameters and flags may follow: + + - ``valid-lifetime``: the length of time in seconds during what the prefix is + valid for the purpose of on-link determination. Value ``infinite`` represents + infinity (i.e. a value of all one bits (``0xffffffff``)). + Range: ``(0-4294967295)`` Default: ``2592000`` + + - ``preferred-lifetime``: the length of time in seconds during what addresses + generated from the prefix remain preferred. Value ``infinite`` represents + infinity. + Range: ``(0-4294967295)`` Default: ``604800`` + + - ``off-link``: indicates that advertisement makes no statement about on-link or + off-link properties of the prefix. + Default: not set, i.e. this prefix can be used for on-link determination. + + - ``no-autoconfig``: indicates to hosts on the local link that the specified prefix + cannot be used for IPv6 autoconfiguration. + + Default: not set, i.e. prefix can be used for autoconfiguration. + + - ``router-address``: indicates to hosts on the local link that the specified + prefix contains a complete IP address by setting R flag. + + Default: not set, i.e. hosts do not assume a complete IP address is placed. + +.. index:: + single: no ipv6 nd ra-interval [(1-1800)] + single: no ipv6 nd ra-interval [(1-1800)] +.. clicmd:: [no] ipv6 nd ra-interval [(1-1800)] + + The maximum time allowed between sending unsolicited multicast router + advertisements from the interface, in seconds. + Default: ``600`` + +.. index:: ipv6 nd ra-interval msec (70-1800000) +.. index:: + single: no ipv6 nd ra-interval [msec (70-1800000)] + single: ipv6 nd ra-interval msec (70-1800000) +.. clicmd:: [no] ipv6 nd ra-interval [msec (70-1800000)] + + The maximum time allowed between sending unsolicited multicast router + advertisements from the interface, in milliseconds. + Default: ``600000`` + +.. index:: + single: ipv6 nd ra-lifetime (0-9000) + single: no ipv6 nd ra-lifetime [(0-9000)] +.. clicmd:: [no] ipv6 nd ra-lifetime [(0-9000)] + + The value to be placed in the Router Lifetime field of router advertisements + sent from the interface, in seconds. Indicates the usefulness of the router + as a default router on this interface. Setting the value to zero indicates + that the router should not be considered a default router on this interface. + Must be either zero or between value specified with ``ipv6 nd ra-interval`` + (or default) and 9000 seconds. + Default: ``1800`` + +.. index:: + single: no ipv6 nd reachable-time [(1-3600000)] + single: ipv6 nd reachable-time (1-3600000) +.. clicmd:: [no] ipv6 nd reachable-time [(1-3600000)] + + The value to be placed in the Reachable Time field in the Router + Advertisement messages sent by the router, in milliseconds. The configured + time enables the router to detect unavailable neighbors. The value zero + means unspecified (by this router). + Default: ``0`` + +.. index:: + single: ipv6 nd managed-config-flag + single: no ipv6 nd managed-config-flag +.. clicmd:: [no] ipv6 nd managed-config-flag + + Set/unset flag in IPv6 router advertisements which indicates to hosts that + they should use managed (stateful) protocol for addresses autoconfiguration + in addition to any addresses autoconfigured using stateless address + autoconfiguration. + Default: not set + +.. index:: + single: ipv6 nd other-config-flag + single: no ipv6 nd other-config-flag +.. clicmd:: [no] ipv6 nd other-config-flag + + Set/unset flag in IPv6 router advertisements which indicates to hosts that + they should use administered (stateful) protocol to obtain autoconfiguration + information other than addresses. + Default: not set + +.. index:: + single: ipv6 nd home-agent-config-flag + single: no ipv6 nd home-agent-config-flag +.. clicmd:: [no] ipv6 nd home-agent-config-flag + + Set/unset flag in IPv6 router advertisements which indicates to hosts that + the router acts as a Home Agent and includes a Home Agent Option. + Default: not set + +.. index:: ipv6 nd home-agent-preference (0-65535) + +.. index:: + single: no ipv6 nd home-agent-preference [(0-65535)] + single: ipv6 nd home-agent-preference (0-65535) +.. clicmd:: [no] ipv6 nd home-agent-preference [(0-65535)] + + The value to be placed in Home Agent Option, when Home Agent config flag is + set, which indicates to hosts Home Agent preference. The default value of 0 + stands for the lowest preference possible. + Default: ``0`` + +.. index:: + single: ipv6 nd home-agent-lifetime (0-65520) + single: no ipv6 nd home-agent-lifetime (0-65520) +.. clicmd:: [no] ipv6 nd home-agent-lifetime [(0-65520)] + + The value to be placed in Home Agent Option, when Home Agent config flag is set, + which indicates to hosts Home Agent Lifetime. The default value of 0 means to + place the current Router Lifetime value. + + Default: ``0`` + +.. index:: + single: ipv6 nd adv-interval-option + single: no ipv6 nd adv-interval-option +.. clicmd:: [no] ipv6 nd adv-interval-option + + Include an Advertisement Interval option which indicates to hosts the maximum time, + in milliseconds, between successive unsolicited Router Advertisements. + Default: not set + +.. index:: + single: ipv6 nd router-preference (high|medium|low) + single: no ipv6 nd router-preference (high|medium|low) +.. clicmd:: [no] ipv6 nd router-preference [(high|medium|low)] + + Set default router preference in IPv6 router advertisements per RFC4191. + Default: medium + +.. index:: + single: ipv6 nd mtu (1-65535) + single: no ipv6 nd mtu [(1-65535)] +.. clicmd:: [no] ipv6 nd mtu [(1-65535)] + + Include an MTU (type 5) option in each RA packet to assist the attached + hosts in proper interface configuration. The announced value is not verified + to be consistent with router interface MTU. + + Default: don't advertise any MTU option.:: + interface eth0 + no ipv6 nd suppress-ra + ipv6 nd prefix 2001:0DB8:5009::/64 + + +.. seealso:: + + - :rfc:`2462` (IPv6 Stateless Address Autoconfiguration) + - :rfc:`4861` (Neighbor Discovery for IP Version 6 (IPv6)) + - :rfc:`6275` (Mobility Support in IPv6) + - :rfc:`4191` (Default Router Preferences and More-Specific Routes) diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst new file mode 100644 index 000000000..b6989809a --- /dev/null +++ b/doc/user/isisd.rst @@ -0,0 +1,636 @@ +.. _isis: + +**** +ISIS +**** + +:abbr:`ISIS (Intermediate System to Intermediate System)` is a routing protocol +which is described in :t:`ISO10589`, :rfc:`1195`, :rfc:`5308`. ISIS is an +:abbr:`IGP (Interior Gateway Protocol)`. Compared with :abbr:`RIP`, +:abbr:`ISIS` can provide scalable network support and faster convergence times +like :abbr:`OSPF`. ISIS is widely used in large networks such as :abbr:`ISP +(Internet Service Provider)` and carrier backbone networks. + +.. _configuring-isisd: + +Configuring isisd +================= + +There are no *isisd* specific options. Common options can be specified +(:ref:`common-invocation-options`) to *isisd*. *isisd* needs to acquire +interface information from *zebra* in order to function. Therefore *zebra* must +be running before invoking *isisd*. Also, if *zebra* is restarted then *isisd* +must be too. + +Like other daemons, *isisd* configuration is done in :abbr:`ISIS` specific +configuration file :file:`isisd.conf`. + +.. _isis-router: + +ISIS router +=========== + +To start ISIS process you have to specify the ISIS router. As of this +writing, *isisd* does not support multiple ISIS processes. + +.. index:: router isis WORD +.. clicmd:: router isis WORD + +.. index:: no router isis WORD +.. clicmd:: no router isis WORD + + Enable or disable the ISIS process by specifying the ISIS domain with + 'WORD'. *isisd* does not yet support multiple ISIS processes but you must + specify the name of ISIS process. The ISIS process name 'WORD' is then used + for interface (see command :clicmd:`ip router isis WORD`). + +.. index:: net XX.XXXX. ... .XXX.XX +.. clicmd:: net XX.XXXX. ... .XXX.XX + +.. index:: no net XX.XXXX. ... .XXX.XX +.. clicmd:: no net XX.XXXX. ... .XXX.XX + + Set/Unset network entity title (NET) provided in ISO format. + +.. index:: hostname dynamic +.. clicmd:: hostname dynamic + +.. index:: no hostname dynamic +.. clicmd:: no hostname dynamic + + Enable support for dynamic hostname. + +.. index:: area-password [clear | md5] <password> +.. clicmd:: area-password [clear | md5] <password> + +.. index:: domain-password [clear | md5] <password> +.. clicmd:: domain-password [clear | md5] <password> + +.. index:: no area-password +.. clicmd:: no area-password + +.. index:: no domain-password +.. clicmd:: no domain-password + + Configure the authentication password for an area, respectively a domain, as + clear text or md5 one. + +.. index:: log-adjacency-changes +.. clicmd:: log-adjacency-changes + +.. index:: no log-adjacency-changes +.. clicmd:: no log-adjacency-changes + + Log changes in adjacency state. + +.. index:: metric-style [narrow | transition | wide] +.. clicmd:: metric-style [narrow | transition | wide] + +.. index:: no metric-style +.. clicmd:: no metric-style + + Set old-style (ISO 10589) or new-style packet formats: + + - narrow + Use old style of TLVs with narrow metric + - transition + Send and accept both styles of TLVs during transition + - wide + Use new style of TLVs to carry wider metric + +.. index:: set-overload-bit +.. clicmd:: set-overload-bit + +.. index:: no set-overload-bit +.. clicmd:: no set-overload-bit + + Set overload bit to avoid any transit traffic. + +.. _isis-timer: + +ISIS Timer +========== + +.. index:: lsp-gen-interval (1-120) +.. clicmd:: lsp-gen-interval (1-120) + +.. index:: lsp-gen-interval [level-1 | level-2] (1-120) +.. clicmd:: lsp-gen-interval [level-1 | level-2] (1-120) + +.. index:: no lsp-gen-interval +.. clicmd:: no lsp-gen-interval + +.. index:: no lsp-gen-interval [level-1 | level-2] +.. clicmd:: no lsp-gen-interval [level-1 | level-2] + + Set minimum interval in seconds between regenerating same LSP, + globally, for an area (level-1) or a domain (level-2). + +.. index:: lsp-refresh-interval [level-1 | level-2] (1-65235) +.. clicmd:: lsp-refresh-interval [level-1 | level-2] (1-65235) + +.. index:: no lsp-refresh-interval [level-1 | level-2] +.. clicmd:: no lsp-refresh-interval [level-1 | level-2] + + Set LSP refresh interval in seconds, globally, for an area (level-1) or a + domain (level-2). + +.. index:: max-lsp-lifetime (360-65535) +.. clicmd:: max-lsp-lifetime (360-65535) + +.. index:: max-lsp-lifetime [level-1 | level-2] (360-65535) +.. clicmd:: max-lsp-lifetime [level-1 | level-2] (360-65535) + +.. index:: no max-lsp-lifetime +.. clicmd:: no max-lsp-lifetime + +.. index:: no max-lsp-lifetime [level-1 | level-2] +.. clicmd:: no max-lsp-lifetime [level-1 | level-2] + + Set LSP maximum LSP lifetime in seconds, globally, for an area (level-1) or + a domain (level-2). + +.. index:: spf-interval (1-120) +.. clicmd:: spf-interval (1-120) + +.. index:: spf-interval [level-1 | level-2] (1-120) +.. clicmd:: spf-interval [level-1 | level-2] (1-120) + +.. index:: no spf-interval +.. clicmd:: no spf-interval + +.. index:: no spf-interval [level-1 | level-2] +.. clicmd:: no spf-interval [level-1 | level-2] + + Set minimum interval between consecutive SPF calculations in seconds. + +.. _isis-region: + +ISIS region +=========== + +.. index:: is-type [level-1 | level-1-2 | level-2-only] +.. clicmd:: is-type [level-1 | level-1-2 | level-2-only] + +.. index:: no is-type +.. clicmd:: no is-type + + Define the ISIS router behavior: + + - level-1 + Act as a station router only + - level-1-2 + Act as both a station router and an area router + - level-2-only + Act as an area router only + +.. _isis-interface: + +ISIS interface +============== + +.. index:: ip router isis WORD +.. clicmd:: ip router isis WORD + +.. index:: no ip router isis WORD +.. clicmd:: no ip router isis WORD + +.. _ip-router-isis-word: + + Activate ISIS adjacency on this interface. Note that the name + of ISIS instance must be the same as the one used to configure the ISIS process + (see command :clicmd:`router isis WORD`). + +.. index:: isis circuit-type [level-1 | level-1-2 | level-2] +.. clicmd:: isis circuit-type [level-1 | level-1-2 | level-2] + +.. index:: no isis circuit-type +.. clicmd:: no isis circuit-type + + Configure circuit type for interface: + + - level-1 + Level-1 only adjacencies are formed + - level-1-2 + Level-1-2 adjacencies are formed + - level-2-only + Level-2 only adjacencies are formed + +.. index:: isis csnp-interval (1-600) +.. clicmd:: isis csnp-interval (1-600) + +.. index:: isis csnp-interval (1-600) [level-1 | level-2] +.. clicmd:: isis csnp-interval (1-600) [level-1 | level-2] + +.. index:: no isis csnp-interval +.. clicmd:: no isis csnp-interval + +.. index:: no isis csnp-interval [level-1 | level-2] +.. clicmd:: no isis csnp-interval [level-1 | level-2] + + Set CSNP interval in seconds globally, for an area (level-1) or a domain + (level-2). + +.. index:: isis hello padding +.. clicmd:: isis hello padding + + Add padding to IS-IS hello packets. + +.. index:: isis hello-interval (1-600) +.. clicmd:: isis hello-interval (1-600) + +.. index:: isis hello-interval (1-600) [level-1 | level-2] +.. clicmd:: isis hello-interval (1-600) [level-1 | level-2] + +.. index:: no isis hello-interval +.. clicmd:: no isis hello-interval + +.. index:: no isis hello-interval [level-1 | level-2] +.. clicmd:: no isis hello-interval [level-1 | level-2] + + Set Hello interval in seconds globally, for an area (level-1) or a domain + (level-2). + +.. index:: isis hello-multiplier (2-100) +.. clicmd:: isis hello-multiplier (2-100) + +.. index:: isis hello-multiplier (2-100) [level-1 | level-2] +.. clicmd:: isis hello-multiplier (2-100) [level-1 | level-2] + +.. index:: no isis hello-multiplier +.. clicmd:: no isis hello-multiplier + +.. index:: no isis hello-multiplier [level-1 | level-2] +.. clicmd:: no isis hello-multiplier [level-1 | level-2] + + Set multiplier for Hello holding time globally, for an area (level-1) or a + domain (level-2). + +.. index:: isis metric [(0-255) | (0-16777215)] +.. clicmd:: isis metric [(0-255) | (0-16777215)] + +.. index:: isis metric [(0-255) | (0-16777215)] [level-1 | level-2] +.. clicmd:: isis metric [(0-255) | (0-16777215)] [level-1 | level-2] + +.. index:: no isis metric +.. clicmd:: no isis metric + +.. index:: no isis metric [level-1 | level-2] +.. clicmd:: no isis metric [level-1 | level-2] + + Set default metric value globally, for an area (level-1) or a domain + (level-2). Max value depend if metric support narrow or wide value (see + command :clicmd:`metric-style [narrow | transition | wide]`). + +.. index:: isis network point-to-point +.. clicmd:: isis network point-to-point + +.. index:: no isis network point-to-point +.. clicmd:: no isis network point-to-point + + Set network type to 'Point-to-Point' (broadcast by default). + +.. index:: isis passive +.. clicmd:: isis passive + +.. index:: no isis passive +.. clicmd:: no isis passive + + Configure the passive mode for this interface. + +.. index:: isis password [clear | md5] <password> +.. clicmd:: isis password [clear | md5] <password> + +.. index:: no isis password +.. clicmd:: no isis password + + Configure the authentication password (clear or encoded text) for the + interface. + +.. index:: isis priority (0-127) +.. clicmd:: isis priority (0-127) + +.. index:: isis priority (0-127) [level-1 | level-2] +.. clicmd:: isis priority (0-127) [level-1 | level-2] + +.. index:: no isis priority +.. clicmd:: no isis priority + +.. index:: no isis priority [level-1 | level-2] +.. clicmd:: no isis priority [level-1 | level-2] + + Set priority for Designated Router election, globally, for the area + (level-1) or the domain (level-2). + +.. index:: isis psnp-interval (1-120) +.. clicmd:: isis psnp-interval (1-120) + +.. index:: isis psnp-interval (1-120) [level-1 | level-2] +.. clicmd:: isis psnp-interval (1-120) [level-1 | level-2] + +.. index:: no isis psnp-interval +.. clicmd:: no isis psnp-interval + +.. index:: no isis psnp-interval [level-1 | level-2] +.. clicmd:: no isis psnp-interval [level-1 | level-2] + + Set PSNP interval in seconds globally, for an area (level-1) or a domain + (level-2). + +.. index:: isis three-way-handshake +.. clicmd:: isis three-way-handshake + +.. index:: no isis three-way-handshake +.. clicmd:: no isis three-way-handshake + + Enable or disable :rfc:`5303` Three-Way Handshake for P2P adjacencies. + Three-Way Handshake is enabled by default. + +.. _showing-isis-information: + +Showing ISIS information +======================== + +.. index:: show isis summary +.. clicmd:: show isis summary + + Show summary information about ISIS. + +.. index:: show isis hostname +.. clicmd:: show isis hostname + + Show information about ISIS node. + +.. index:: show isis interface +.. clicmd:: show isis interface + +.. index:: show isis interface detail +.. clicmd:: show isis interface detail + +.. index:: show isis interface <interface name> +.. clicmd:: show isis interface <interface name> + + Show state and configuration of ISIS specified interface, or all interfaces + if no interface is given with or without details. + +.. index:: show isis neighbor +.. clicmd:: show isis neighbor + +.. index:: show isis neighbor <System Id> +.. clicmd:: show isis neighbor <System Id> + +.. index:: show isis neighbor detail +.. clicmd:: show isis neighbor detail + + Show state and information of ISIS specified neighbor, or all neighbors if + no system id is given with or without details. + +.. index:: show isis database +.. clicmd:: show isis database + +.. index:: show isis database [detail] +.. clicmd:: show isis database [detail] + +.. index:: show isis database <LSP id> [detail] +.. clicmd:: show isis database <LSP id> [detail] + +.. index:: show isis database detail <LSP id> +.. clicmd:: show isis database detail <LSP id> + + Show the ISIS database globally, for a specific LSP id without or with + details. + +.. index:: show isis topology +.. clicmd:: show isis topology + +.. index:: show isis topology [level-1|level-2] +.. clicmd:: show isis topology [level-1|level-2] + + Show topology IS-IS paths to Intermediate Systems, globally, in area + (level-1) or domain (level-2). + +.. index:: show ip route isis +.. clicmd:: show ip route isis + + Show the ISIS routing table, as determined by the most recent SPF + calculation. + +.. _isis-traffic-engineering: + +Traffic Engineering +=================== + +.. index:: mpls-te on +.. clicmd:: mpls-te on + +.. index:: no mpls-te +.. clicmd:: no mpls-te + + Enable Traffic Engineering LSP flooding. + +.. index:: mpls-te router-address <A.B.C.D> +.. clicmd:: mpls-te router-address <A.B.C.D> + +.. index:: no mpls-te router-address +.. clicmd:: no mpls-te router-address + + Configure stable IP address for MPLS-TE. + +.. index:: show isis mpls-te interface +.. clicmd:: show isis mpls-te interface + +.. index:: show isis mpls-te interface INTERFACE +.. clicmd:: show isis mpls-te interface INTERFACE + + Show MPLS Traffic Engineering parameters for all or specified interface. + +.. index:: show isis mpls-te router +.. clicmd:: show isis mpls-te router + + Show Traffic Engineering router parameters. + +.. seealso:: + + :ref:`ospf-traffic-engineering` + +.. _debugging-isis: + +Debugging ISIS +============== + +.. index:: debug isis adj-packets +.. clicmd:: debug isis adj-packets + +.. index:: no debug isis adj-packets +.. clicmd:: no debug isis adj-packets + + IS-IS Adjacency related packets. + +.. index:: debug isis checksum-errors +.. clicmd:: debug isis checksum-errors + +.. index:: no debug isis checksum-errors +.. clicmd:: no debug isis checksum-errors + + IS-IS LSP checksum errors. + +.. index:: debug isis events +.. clicmd:: debug isis events + +.. index:: no debug isis events +.. clicmd:: no debug isis events + + IS-IS Events. + +.. index:: debug isis local-updates +.. clicmd:: debug isis local-updates + +.. index:: no debug isis local-updates +.. clicmd:: no debug isis local-updates + + IS-IS local update packets. + +.. index:: debug isis packet-dump +.. clicmd:: debug isis packet-dump + +.. index:: no debug isis packet-dump +.. clicmd:: no debug isis packet-dump + + IS-IS packet dump. + +.. index:: debug isis protocol-errors +.. clicmd:: debug isis protocol-errors + +.. index:: no debug isis protocol-errors +.. clicmd:: no debug isis protocol-errors + + IS-IS LSP protocol errors. + +.. index:: debug isis route-events +.. clicmd:: debug isis route-events + +.. index:: no debug isis route-events +.. clicmd:: no debug isis route-events + + IS-IS Route related events. + +.. index:: debug isis snp-packets +.. clicmd:: debug isis snp-packets + +.. index:: no debug isis snp-packets +.. clicmd:: no debug isis snp-packets + + IS-IS CSNP/PSNP packets. + +.. index:: debug isis spf-events +.. clicmd:: debug isis spf-events + +.. index:: debug isis spf-statistics +.. clicmd:: debug isis spf-statistics + +.. index:: debug isis spf-triggers +.. clicmd:: debug isis spf-triggers + +.. index:: no debug isis spf-events +.. clicmd:: no debug isis spf-events + +.. index:: no debug isis spf-statistics +.. clicmd:: no debug isis spf-statistics + +.. index:: no debug isis spf-triggers +.. clicmd:: no debug isis spf-triggers + + IS-IS Shortest Path First Events, Timing and Statistic Data and triggering + events. + +.. index:: debug isis update-packets +.. clicmd:: debug isis update-packets + +.. index:: no debug isis update-packets +.. clicmd:: no debug isis update-packets + + Update related packets. + +.. index:: show debugging isis +.. clicmd:: show debugging isis + + Print which ISIS debug level is activate. + +ISIS Configuration Examples +=========================== + +A simple example, with MD5 authentication enabled::: + + ! + interface eth0 + ip router isis FOO + isis network point-to-point + isis circuit-type level-2-only + ! + router isis FOO + net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00 + metric-style wide + is-type level-2-only + + +A Traffic Engineering configuration, with Inter-ASv2 support. + +First, the 'zebra.conf' part::: + + hostname HOSTNAME + password PASSWORD + log file /var/log/zebra.log + ! + interface eth0 + ip address 10.2.2.2/24 + link-params + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + admin-grp 0xab + ! + interface eth1 + ip address 10.1.1.1/24 + link-params + enable + metric 100 + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + neighbor 10.1.1.2 as 65000 + + +Then the 'isisd.conf' itself::: + + hostname HOSTNAME + password PASSWORD + log file /var/log/isisd.log + ! + ! + interface eth0 + ip router isis FOO + ! + interface eth1 + ip router isis FOO + ! + ! + router isis FOO + isis net 47.0023.0000.0000.0000.0000.0000.0000.1900.0004.00 + mpls-te on + mpls-te router-address 10.1.1.1 + ! + line vty diff --git a/doc/user/kernel.rst b/doc/user/kernel.rst new file mode 100644 index 000000000..8c65901a0 --- /dev/null +++ b/doc/user/kernel.rst @@ -0,0 +1,42 @@ +.. _kernel-interface: + +**************** +Kernel Interface +**************** + +There are several different methods for reading kernel routing table +information, updating kernel routing tables, and for looking up interfaces. + +- ioctl + This method is a very traditional way for reading or writing kernel + information. `ioctl` can be used for looking up interfaces and for + modifying interface addresses, flags, mtu settings and other types of + information. Also, `ioctl` can insert and delete kernel routing table + entries. It will soon be available on almost any platform which zebra + supports, but it is a little bit ugly thus far, so if a better method is + supported by the kernel, zebra will use that. + +- sysctl + This is a program that can lookup kernel information using MIB (Management + Information Base) syntax. Normally, it only provides a way of getting + information from the kernel. So one would usually want to change kernel + information using another method such as `ioctl`. + +- proc filesystem + This is a special filesystem mount that provides an easy way of getting + kernel information. + +- routing socket / netlink + On recent Linux kernels (2.0.x and 2.2.x), there is a kernel/user + communication support called `netlink`. It makes asynchronous communication + between kernel and FRR possible, similar to a routing socket on BSD systems. + + Before you use this feature, be sure to select (in kernel configuration) the + kernel/netlink support option 'Kernel/User network link driver' and 'Routing + messages'. + + Today, the :file:`/dev/route` special device file is obsolete. Netlink + communication is done by reading/writing over netlink socket. + + After the kernel configuration, please reconfigure and rebuild FRR. You can + use netlink as a dynamic routing update channel between FRR and the kernel. diff --git a/doc/nhrpd.texi b/doc/user/nhrpd.rst index 069b46495..28e78f66f 100644 --- a/doc/nhrpd.texi +++ b/doc/user/nhrpd.rst @@ -1,31 +1,25 @@ -@cindex NHRP -@node NHRP -@chapter NHRP - -@command{nhrpd} is a daemon to support Next Hop Routing Protocol (NHRP). -NHRP is described in RFC2332. - -NHRP is used to improve the efficiency of routing computer network -traffic over Non-Broadcast, Multiple Access (NBMA) Networks. NHRP provides -an ARP-like solution that allows a system to dynamically learn the NBMA -address of the other systems that are part of that network, allowing -these systems to directly communicate without requiring traffic to use -an intermediate hop. - -Cisco Dynamic Multipoint VPN (DMVPN) is based on NHRP, and -@value{PACKAGE_NAME} nhrpd implements this scenario. - -@menu -* Routing Design:: -* Configuring NHRP:: -* Hub Functionality:: -* Integration with IKE:: -* NHRP Events:: -* Configuration Example:: -@end menu - -@node Routing Design -@section Routing Design +.. _nhrp: + +**** +NHRP +**** + +*nhrpd* is an implementation of the :abbr:NHRP `(Next Hop Routing Protocol)`. +NHRP is described in :rfc`2332`. + +NHRP is used to improve the efficiency of routing computer network traffic over +:abbr:`NBMA (Non-Broadcast, Multiple Access)` networks. NHRP provides an +ARP-like solution that allows a system to dynamically learn the NBMA address of +the other systems that are part of that network, allowing these systems to +directly communicate without requiring traffic to use an intermediate hop. + +Cisco Dynamic Multipoint VPN (DMVPN) is based on NHRP, and |PACKAGE_NAME| nhrpd +implements this scenario. + +.. _routing-design: + +Routing Design +============== nhrpd never handles routing of prefixes itself. You need to run some real routing protocol (e.g. BGP) to advertise routes over the tunnels. @@ -36,15 +30,13 @@ nhrpd does route NHRP domain addresses individually using per-host prefixes. This is similar to Cisco FlexVPN; but in contrast to opennhrp which uses a generic subnet route. -To create NBMA GRE tunnel you might use the following (linux terminal -commands): -@example -@group - ip tunnel add gre1 mode gre key 42 ttl 64 - ip addr add 10.255.255.2/32 dev gre1 - ip link set gre1 up -@end group -@end example +To create NBMA GRE tunnel you might use the following (Linux terminal +commands)::: + + ip tunnel add gre1 mode gre key 42 ttl 64 + ip addr add 10.255.255.2/32 dev gre1 + ip link set gre1 up + Note that the IP-address is assigned as host prefix to gre1. nhrpd will automatically create additional host routes pointing to gre1 when @@ -60,25 +52,26 @@ hub nodes, these routes should be internally redistributed using some routing protocol (e.g. iBGP) to allow hubs to be able to relay all traffic. This can be achieved in hubs with the following bgp configuration (network -command defines the GRE subnet): -@example -@group -router bgp 65555 - address-family ipv4 unicast - network 172.16.0.0/16 - redistribute nhrp - exit-address-family -@end group -@end example +command defines the GRE subnet)::: + + router bgp 65555 + address-family ipv4 unicast + network 172.16.0.0/16 + redistribute nhrp + exit-address-family -@node Configuring NHRP -@section Configuring NHRP +.. _configuring-nhrp: + +Configuring NHRP +================ FIXME -@node Hub Functionality -@section Hub Functionality +.. _hub-functionality: + +Hub Functionality +================= In addition to routing nhrp redistributed host prefixes, the hub nodes are also responsible to send NHRP Traffic Indication messages that @@ -89,38 +82,33 @@ using NFLOG. Typically you want to send Traffic Indications for network traffic that is routed from gre1 back to gre1 in rate limited manner. This can be achieved with the following iptables rule. -@example -@group -iptables -A FORWARD -i gre1 -o gre1 \ - -m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 \ - --hashlimit-mode srcip,dstip --hashlimit-srcmask 24 --hashlimit-dstmask 24 \ - --hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128 -@end group -@end example +:: + + iptables -A FORWARD -i gre1 -o gre1 \\ + -m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 \\ + --hashlimit-mode srcip,dstip --hashlimit-srcmask 24 --hashlimit-dstmask 24 \\ + --hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128 + You can fine tune the src/dstmask according to the prefix lengths you announce internal, add additional IP range matches, or rate limitation if needed. However, the above should be good in most cases. This kernel NFLOG target's nflog-group is configured in global nhrp config -with: -@example -@group -nhrp nflog-group 1 -@end group -@end example +with::: + + nhrp nflog-group 1 To start sending these traffic notices out from hubs, use the nhrp -per-interface directive: -@example -@group -interface gre1 - ip nhrp redirect -@end group -@end example +per-interface directive::: -@node Integration with IKE -@section Integration with IKE + interface gre1 + ip nhrp redirect + +.. _integration-with-ike: + +Integration with IKE +==================== nhrpd needs tight integration with IKE daemon for various reasons. Currently only strongSwan is supported as IKE daemon. @@ -129,17 +117,20 @@ nhrpd connects to strongSwan using VICI protocol based on UNIX socket (hardcoded now as /var/run/charon.vici). strongSwan currently needs few patches applied. Please check out the -@uref{http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release,release} +`http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release,release <http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras-release,release>`_ and -@uref{http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras,working tree} +`http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras,working tree <http://git.alpinelinux.org/cgit/user/tteras/strongswan/log/?h=tteras,working tree>`_ git repositories for the patches. -@node NHRP Events -@section NHRP Events +.. _nhrp-events: + +NHRP Events +=========== FIXME -@node Configuration Example -@section Configuration Example +Configuration Example +===================== FIXME + diff --git a/doc/user/ospf6d.rst b/doc/user/ospf6d.rst new file mode 100644 index 000000000..b0823f21e --- /dev/null +++ b/doc/user/ospf6d.rst @@ -0,0 +1,199 @@ +.. _ospfv3: + +****** +OSPFv3 +****** + +*ospf6d* is a daemon support OSPF version 3 for IPv6 network. OSPF for IPv6 is +described in :rfc:`2740`. + +.. _ospf6-router: + +OSPF6 router +============ + +.. index:: router ospf6 +.. clicmd:: router ospf6 + +.. index:: router-id A.B.C.D +.. clicmd:: router-id A.B.C.D + + Set router's Router-ID. + +.. index:: interface IFNAME area AREA +.. clicmd:: interface IFNAME area AREA + + Bind interface to specified area, and start sending OSPF packets. `area` can + be specified as 0. + +.. index:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME +.. clicmd:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME + +.. index:: no timers throttle spf +.. clicmd:: no timers throttle spf + + This command sets the initial `delay`, the `initial-holdtime` + and the `maximum-holdtime` between when SPF is calculated and the + event which triggered the calculation. The times are specified in + milliseconds and must be in the range of 0 to 600000 milliseconds. + + The `delay` specifies the minimum amount of time to delay SPF + calculation (hence it affects how long SPF calculation is delayed after + an event which occurs outside of the holdtime of any previous SPF + calculation, and also serves as a minimum holdtime). + + Consecutive SPF calculations will always be seperated by at least + 'hold-time' milliseconds. The hold-time is adaptive and initially is + set to the `initial-holdtime` configured with the above command. + Events which occur within the holdtime of the previous SPF calculation + will cause the holdtime to be increased by `initial-holdtime`, bounded + by the `maximum-holdtime` configured with this command. If the adaptive + hold-time elapses without any SPF-triggering event occuring then + the current holdtime is reset to the `initial-holdtime`.:: + + router ospf6 + timers throttle spf 200 400 10000 + + + In this example, the `delay` is set to 200ms, the initial holdtime is set + to 400ms and the `maximum holdtime` to 10s. Hence there will always be at + least 200ms between an event which requires SPF calculation and the actual + SPF calculation. Further consecutive SPF calculations will always be + seperated by between 400ms to 10s, the hold-time increasing by 400ms each + time an SPF-triggering event occurs within the hold-time of the previous + SPF calculation. + +.. index:: auto-cost reference-bandwidth COST +.. clicmd:: auto-cost reference-bandwidth COST + +.. index:: no auto-cost reference-bandwidth +.. clicmd:: no auto-cost reference-bandwidth + + This sets the reference bandwidth for cost calculations, where this + bandwidth is considered equivalent to an OSPF cost of 1, specified in + Mbits/s. The default is 100Mbit/s (i.e. a link of bandwidth 100Mbit/s + or higher will have a cost of 1. Cost of lower bandwidth links will be + scaled with reference to this cost). + + This configuration setting MUST be consistent across all routers + within the OSPF domain. + +.. _ospf6-area: + +OSPF6 area +========== + +Area support for OSPFv3 is not yet implemented. + +.. _ospf6-interface: + +OSPF6 interface +=============== + +.. index:: ipv6 ospf6 cost COST +.. clicmd:: ipv6 ospf6 cost COST + + Sets interface's output cost. Default value depends on the interface + bandwidth and on the auto-cost reference bandwidth. + +.. index:: ipv6 ospf6 hello-interval HELLOINTERVAL +.. clicmd:: ipv6 ospf6 hello-interval HELLOINTERVAL + + Sets interface's Hello Interval. Default 40 + +.. index:: ipv6 ospf6 dead-interval DEADINTERVAL +.. clicmd:: ipv6 ospf6 dead-interval DEADINTERVAL + + Sets interface's Router Dead Interval. Default value is 40. + +.. index:: ipv6 ospf6 retransmit-interval RETRANSMITINTERVAL +.. clicmd:: ipv6 ospf6 retransmit-interval RETRANSMITINTERVAL + + Sets interface's Rxmt Interval. Default value is 5. + +.. index:: ipv6 ospf6 priority PRIORITY +.. clicmd:: ipv6 ospf6 priority PRIORITY + + Sets interface's Router Priority. Default value is 1. + +.. index:: ipv6 ospf6 transmit-delay TRANSMITDELAY +.. clicmd:: ipv6 ospf6 transmit-delay TRANSMITDELAY + + Sets interface's Inf-Trans-Delay. Default value is 1. + +.. index:: ipv6 ospf6 network (broadcast|point-to-point) +.. clicmd:: ipv6 ospf6 network (broadcast|point-to-point) + + Set explicitly network type for specifed interface. + +.. _redistribute-routes-to-ospf6: + +Redistribute routes to OSPF6 +============================ + +.. index:: redistribute static +.. clicmd:: redistribute static + +.. index:: redistribute connected +.. clicmd:: redistribute connected + +.. index:: redistribute ripng +.. clicmd:: redistribute ripng + + +.. _showing-ospf6-information: + +Showing OSPF6 information +========================= + +.. index:: show ipv6 ospf6 [INSTANCE_ID] +.. clicmd:: show ipv6 ospf6 [INSTANCE_ID] + + INSTANCE_ID is an optional OSPF instance ID. To see router ID and OSPF + instance ID, simply type "show ipv6 ospf6 <cr>". + +.. index:: show ipv6 ospf6 database +.. clicmd:: show ipv6 ospf6 database + + This command shows LSA database summary. You can specify the type of LSA. + +.. index:: show ipv6 ospf6 interface +.. clicmd:: show ipv6 ospf6 interface + + To see OSPF interface configuration like costs. + +.. index:: show ipv6 ospf6 neighbor +.. clicmd:: show ipv6 ospf6 neighbor + + Shows state and chosen (Backup) DR of neighbor. + +.. index:: show ipv6 ospf6 request-list A.B.C.D +.. clicmd:: show ipv6 ospf6 request-list A.B.C.D + + Shows requestlist of neighbor. + +.. index:: show ipv6 route ospf6 +.. clicmd:: show ipv6 route ospf6 + + This command shows internal routing table. + +.. index:: show ipv6 ospf6 zebra +.. clicmd:: show ipv6 ospf6 zebra + + Shows state about what is being redistributed between zebra and OSPF6 + +OSPF6 Configuration Examples +============================ + +Example of ospf6d configured on one interface and area: + +:: + + interface eth0 + ipv6 ospf6 instance-id 0 + ! + router ospf6 + router-id 212.17.55.53 + area 0.0.0.0 range 2001:770:105:2::/64 + interface eth0 area 0.0.0.0 + ! diff --git a/doc/user/ospf_fundamentals.rst b/doc/user/ospf_fundamentals.rst new file mode 100644 index 000000000..5a4f7095e --- /dev/null +++ b/doc/user/ospf_fundamentals.rst @@ -0,0 +1,546 @@ +.. _ospf-fundamentals: + +OSPF Fundamentals +================= + +.. index:: Link-state routing protocol +.. index:: Distance-vector routing protocol + +:abbr:`OSPF` is, mostly, a link-state routing protocol. In contrast to +:term:`distance-vector` protocols, such as :abbr:`RIP` or :abbr:`BGP`, where +routers describe available `paths` (i.e. routes) to each other, in +:term:`link-state` protocols routers instead describe the state of their links +to their immediate neighbouring routers. + +.. index:: Link State Announcement +.. index:: Link State Advertisement +.. index:: LSA flooding +.. index:: Link State Database + +Each router describes their link-state information in a message known as an +:abbr:`LSA (Link State Advertisement)`, which is then propogated through to all +other routers in a link-state routing domain, by a process called `flooding`. +Each router thus builds up an :abbr:`LSDB (Link State Database)` of all the +link-state messages. From this collection of LSAs in the LSDB, each router can +then calculate the shortest path to any other router, based on some common +metric, by using an algorithm such as +`Edgar Djikstra's <http://www.cs.utexas.edu/users/EWD/>`_ +:abbr:`SPF (Shortest Path First)` algorithm. + +.. index:: Link-state routing protocol advantages + +By describing connectivity of a network in this way, in terms of +routers and links rather than in terms of the paths through a network, +a link-state protocol can use less bandwidth and converge more quickly +than other protocols. A link-state protocol need distribute only one +link-state message throughout the link-state domain when a link on any +single given router changes state, in order for all routers to +reconverge on the best paths through the network. In contrast, distance +vector protocols can require a progression of different path update +messages from a series of different routers in order to converge. + +.. index:: Link-state routing protocol disadvantages + +The disadvantage to a link-state protocol is that the process of +computing the best paths can be relatively intensive when compared to +distance-vector protocols, in which near to no computation need be done +other than (potentially) select between multiple routes. This overhead +is mostly negligible for modern embedded CPUs, even for networks with +thousands of nodes. The primary scaling overhead lies more in coping +with the ever greater frequency of LSA updates as the size of a +link-state area increases, in managing the :abbr:`LSDB` and required +flooding. + +This section aims to give a distilled, but accurate, description of the +more important workings of :abbr:`OSPF` which an administrator may need +to know to be able best configure and trouble-shoot :abbr:`OSPF`. + +OSPF Mechanisms +--------------- + +:abbr:`OSPF` defines a range of mechanisms, concerned with detecting, +describing and propogating state through a network. These mechanisms +will nearly all be covered in greater detail further on. They may be +broadly classed as: + + +.. index:: OSPF Hello Protocol + +The Hello Protocol +^^^^^^^^^^^^^^^^^^ + +The OSPF Hello protocol allows OSPF to quickly detect changes in two-way +reachability between routers on a link. OSPF can additionally avail of other +sources of reachability information, such as link-state information provided by +hardware, or through dedicated reachability protocols such as +:abbr:`BFD (Bidirectional Forwarding Detection)`. + +OSPF also uses the Hello protocol to propagate certain state between routers +sharing a link, for example: + +- Hello protocol configured state, such as the dead-interval. +- Router priority, for DR/BDR election. +- DR/BDR election results. +- Any optional capabilities supported by each router. + +The Hello protocol is comparatively trivial and will not be explored in greater +detail than here. + +.. index:: OSPF LSA overview +.. _ospf-lsas: + +LSAs +^^^^ + +At the heart of :abbr:`OSPF` are :abbr:`LSA (Link State Advertisement)` +messages. Despite the name, some :abbr:`LSA` s do not, strictly speaking, +describe link-state information. Common :abbr:`LSA` s describe information +such as: + +- Routers, in terms of their links. +- Networks, in terms of attached routers. +- Routes, external to a link-state domain: + + External Routes + Routes entirely external to :abbr:`OSPF`. Routers originating such + routes are known as :abbr:`ASBR (Autonomous-System Border Router)` + routers. + + Summary Routes + Routes which summarise routing information relating to OSPF areas + external to the OSPF link-state area at hand, originated by + :abbr:`ABR (Area Boundary Router)` routers. + +.. _ospf-lsa-flooding: + +LSA Flooding +"""""""""""" + +OSPF defines several related mechanisms, used to manage synchronisation of +:abbr:`LSDB` s between neighbours as neighbours form adjacencies and the +propogation, or `flooding` of new or updated :abbr:`LSA` s. + +.. index:: OSPF Areas overview + +.. _ospf-areas: + +Areas +^^^^^ + +OSPF provides for the protocol to be broken up into multiple smaller and +independent link-state areas. Each area must be connected to a common backbone +area by an :abbr:`ABR (Area Boundary Router)`. These :abbr:`ABR` routers are +responsible for summarising the link-state routing information of an area into +`Summary LSAs`, possibly in a condensed (i.e. aggregated) form, and then +originating these summaries into all other areas the :abbr:`ABR` is connected +to. + +Note that only summaries and external routes are passed between areas. As +these describe *paths*, rather than any router link-states, routing between +areas hence is by :term:`distance-vector`, **not** link-state. + +OSPF LSAs +--------- + +The core objects in OSPF are :abbr:`LSA` s. Everything else in OSPF revolves +around detecting what to describe in LSAs, when to update them, how to flood +them throughout a network and how to calculate routes from them. + +There are a variety of different :abbr:`LSA` s, for purposes such as describing +actual link-state information, describing paths (i.e. routes), describing +bandwidth usage of links for :abbr:`TE (Traffic Engineering)` purposes, and +even arbitrary data by way of *Opaque* :abbr:`LSA` s. + +LSA Header +^^^^^^^^^^ + +All LSAs share a common header with the following information: + +- Type + + Different types of :abbr:`LSA` s describe different things in + :abbr:`OSPF`. Types include: + + - Router LSA + - Network LSA + - Network Summary LSA + - Router Summary LSA + - AS-External LSA + + The specifics of the different types of LSA are examined below. + +- Advertising Router + + The Router ID of the router originating the LSA. + +.. seealso:: + + :clicmd:`ospf router-id A.B.C.D`. + +- LSA ID + + The ID of the LSA, which is typically derived in some way from the + information the LSA describes, e.g. a Router LSA uses the Router ID as + the LSA ID, a Network LSA will have the IP address of the :abbr:`DR` + as its LSA ID. + + The combination of the Type, ID and Advertising Router ID must uniquely + identify the :abbr:`LSA`. There can however be multiple instances of + an LSA with the same Type, LSA ID and Advertising Router ID, see + :ref:`sequence number <ospf-lsa-sequence-number>`. + +- Age + + A number to allow stale :abbr:`LSA` s to, eventually, be purged by routers + from their :abbr:`LSDB` s. + + The value nominally is one of seconds. An age of 3600, i.e. 1 hour, is + called the `MaxAge`. MaxAge LSAs are ignored in routing + calculations. LSAs must be periodically refreshed by their Advertising + Router before reaching MaxAge if they are to remain valid. + + Routers may deliberately flood LSAs with the age artificially set to + 3600 to indicate an LSA is no longer valid. This is called + `flushing` of an LSA. + + It is not abnormal to see stale LSAs in the LSDB, this can occur where + a router has shutdown without flushing its LSA(s), e.g. where it has + become disconnected from the network. Such LSAs do little harm. + +.. _ospf-lsa-sequence-number: + +- Sequence Number + + A number used to distinguish newer instances of an LSA from older instances. + +Link-State LSAs +^^^^^^^^^^^^^^^ + +Of all the various kinds of :abbr:`LSA` s, just two types comprise the +actual link-state part of :abbr:`OSPF`, Router :abbr:`LSA` s and +Network :abbr:`LSA` s. These LSA types are absolutely core to the +protocol. + +Instances of these LSAs are specific to the link-state area in which +they are originated. Routes calculated from these two LSA types are +called `intra-area routes`. + +- Router LSA + + Each OSPF Router must originate a router :abbr:`LSA` to describe + itself. In it, the router lists each of its :abbr:`OSPF` enabled + interfaces, for the given link-state area, in terms of: + + Cost + The output cost of that interface, scaled inversely to some commonly known + reference value, :clicmd:`auto-cost reference-bandwidth (1-4294967`. + + Link Type + Transit Network + + A link to a multi-access network, on which the router has at least one + Full adjacency with another router. + + :abbr:`PtP (Point-to-Point)` + A link to a single remote router, with a Full adjacency. No + :abbr:`DR (Designated Router)` is elected on such links; no network + LSA is originated for such a link. + + Stub + A link with no adjacent neighbours, or a host route. + + - Link ID and Data + + These values depend on the Link Type: + + +----------------+-----------------------------------+------------------------------------------+ + | Link Type | Link ID | Link Data | + +================+===================================+==========================================+ + | Transit | Link IP address of the :abbr:`DR` | Interface IP address | + +----------------+-----------------------------------+------------------------------------------+ + | Point-to-Point | Router ID of the remote router | Local interface IP address, or the | + | | | :abbr:`ifindex (MIB-II interface index)` | + | | | for unnumbered links | + +----------------+-----------------------------------+------------------------------------------+ + | Stub | IP address | Subnet Mask | + +----------------+-----------------------------------+------------------------------------------+ + + Links on a router may be listed multiple times in the Router LSA, e.g. a + :abbr:`PtP` interface on which OSPF is enabled must *always* be described + by a Stub link in the Router :abbr:`LSA`, in addition to being listed as + PtP link in the Router :abbr:`LSA` if the adjacency with the remote router + is Full. + + Stub links may also be used as a way to describe links on which OSPF is + *not* spoken, known as `passive interfaces`, see + :clicmd:`passive-interface INTERFACE`. + +- Network LSA + + On multi-access links (e.g. ethernets, certain kinds of ATM and X.25 + configurations), routers elect a :abbr:`DR`. The :abbr:`DR` is + responsible for originating a Network :abbr:`LSA`, which helps reduce + the information needed to describe multi-access networks with multiple + routers attached. The :abbr:`DR` also acts as a hub for the flooding of + :abbr:`LSA` s on that link, thus reducing flooding overheads. + + The contents of the Network LSA describes the: + + - Subnet Mask + + As the :abbr:`LSA` ID of a Network LSA must be the IP address of the + :abbr:`DR`, the Subnet Mask together with the :abbr:`LSA` ID gives + you the network address. + + - Attached Routers + + Each router fully-adjacent with the :abbr:`DR` is listed in the LSA, + by their Router-ID. This allows the corresponding Router :abbr:`LSA` s to be + easily retrieved from the :abbr:`LSDB`. + +Summary of Link State LSAs: + ++-------------+----------------------------+--------------------------------------------+ +| LSA Type | LSA ID | LSA Data Describes | ++=============+============================+============================================+ +| Router LSA | Router ID | The :abbr:`OSPF` enabled links of the | +| | | router, within a specific link-state area. | ++-------------+----------------------------+--------------------------------------------+ +| Network LSA | The IP address of the | The subet mask of the network and the | +| | :abbr:`DR` for the network | Router IDs of all routers on the network | ++-------------+----------------------------+--------------------------------------------+ + +With an LSDB composed of just these two types of :abbr:`LSA`, it is +possible to construct a directed graph of the connectivity between all +routers and networks in a given OSPF link-state area. So, not +surprisingly, when OSPF routers build updated routing tables, the first +stage of :abbr:`SPF` calculation concerns itself only with these two +LSA types. + +.. _ospf-link-state-lsa-examples: + +Link-State LSA Examples +^^^^^^^^^^^^^^^^^^^^^^^ + +The example below shows two :abbr:`LSA` s, both originated by the same router +(Router ID 192.168.0.49) and with the same :abbr:`LSA` ID (192.168.0.49), but +of different LSA types. + +The first LSA being the router LSA describing 192.168.0.49's links: 2 links +to multi-access networks with fully-adjacent neighbours (i.e. Transit +links) and 1 being a Stub link (no adjacent neighbours). + +The second LSA being a Network LSA, for which 192.168.0.49 is the +:abbr:`DR`, listing the Router IDs of 4 routers on that network which +are fully adjacent with 192.168.0.49. + +:: + + # show ip ospf database router 192.168.0.49 + + OSPF Router with ID (192.168.0.53) + + Router Link States (Area 0.0.0.0) + + LS age: 38 + Options: 0x2 : *|-|-|-|-|-|E|* + LS Flags: 0x6 + Flags: 0x2 : ASBR + LS Type: router-LSA + Link State ID: 192.168.0.49 + Advertising Router: 192.168.0.49 + LS Seq Number: 80000f90 + Checksum: 0x518b + Length: 60 + Number of Links: 3 + + Link connected to: a Transit Network + (Link ID) Designated Router address: 192.168.1.3 + (Link Data) Router Interface address: 192.168.1.3 + Number of TOS metrics: 0 + TOS 0 Metric: 10 + + Link connected to: a Transit Network + (Link ID) Designated Router address: 192.168.0.49 + (Link Data) Router Interface address: 192.168.0.49 + Number of TOS metrics: 0 + TOS 0 Metric: 10 + + Link connected to: Stub Network + (Link ID) Net: 192.168.3.190 + (Link Data) Network Mask: 255.255.255.255 + Number of TOS metrics: 0 + TOS 0 Metric: 39063 + # show ip ospf database network 192.168.0.49 + + OSPF Router with ID (192.168.0.53) + + Net Link States (Area 0.0.0.0) + + LS age: 285 + Options: 0x2 : *|-|-|-|-|-|E|* + LS Flags: 0x6 + LS Type: network-LSA + Link State ID: 192.168.0.49 (address of Designated Router) + Advertising Router: 192.168.0.49 + LS Seq Number: 80000074 + Checksum: 0x0103 + Length: 40 + Network Mask: /29 + Attached Router: 192.168.0.49 + Attached Router: 192.168.0.52 + Attached Router: 192.168.0.53 + Attached Router: 192.168.0.54 + + +Note that from one LSA, you can find the other. E.g. Given the +Network-LSA you have a list of Router IDs on that network, from which +you can then look up, in the local :abbr:`LSDB`, the matching Router +LSA. From that Router-LSA you may (potentially) find links to other +Transit networks and Routers IDs which can be used to lookup the +corresponding Router or Network LSA. And in that fashion, one can find +all the Routers and Networks reachable from that starting :abbr:`LSA`. + +Given the Router LSA instead, you have the IP address of the +:abbr:`DR` of any attached transit links. Network LSAs will have that IP +as their LSA ID, so you can then look up that Network LSA and from that +find all the attached routers on that link, leading potentially to more +links and Network and Router LSAs, etc. etc. + +From just the above two :abbr:`LSA` s, one can already see the +following partial topology: + +:: + + ------------------------ Network: ...... + | Designated Router IP: 192.168.1.3 + | + IP: 192.168.1.3 + (transit link) + (cost: 10) + Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32 + (cost: 10) (cost: 39063) + (transit link) + IP: 192.168.0.49 + | + | + ------------------------------ Network: 192.168.0.48/29 + | | | Designated Router IP: 192.168.0.49 + | | | + | | Router ID: 192.168.0.54 + | | + | Router ID: 192.168.0.53 + | + Router ID: 192.168.0.52 + + +Note the Router IDs, though they look like IP addresses and often are +IP addresses, are not strictly speaking IP addresses, nor need they be +reachable addresses (though, OSPF will calculate routes to Router IDs). + +External LSAs +^^^^^^^^^^^^^ + +External, or "Type 5", :abbr:`LSA` s describe routing information which is +entirely external to :abbr:`OSPF`, and is "injected" into +:abbr:`OSPF`. Such routing information may have come from another +routing protocol, such as RIP or BGP, they may represent static routes +or they may represent a default route. + +An :abbr:`OSPF` router which originates External :abbr:`LSA` s is known as an +:abbr:`ASBR (AS Boundary Router)`. Unlike the link-state :abbr:`LSA` s, and +most other :abbr:`LSA` s, which are flooded only within the area in +which they originate, External :abbr:`LSA` s are flooded through-out +the :abbr:`OSPF` network to all areas capable of carrying External +:abbr:`LSA` s (:ref:`ospf-areas`). + +Routes internal to OSPF (intra-area or inter-area) are always preferred +over external routes. + +The External :abbr:`LSA` describes the following: + +IP Network number + The IP Network number of the route is described by the :abbr:`LSA` ID field. + +IP Network Mask + The body of the External LSA describes the IP Network Mask of the route. + This, together with the :abbr:`LSA` ID, describes the prefix of the IP route + concerned. + +Metric + The cost of the External Route. This cost may be an OSPF cost (also known as + a "Type 1" metric), i.e. equivalent to the normal OSPF costs, or an + externally derived cost ("Type 2" metric) which is not comparable to OSPF + costs and always considered larger than any OSPF cost. Where there are both + Type 1 and 2 External routes for a route, the Type 1 is always preferred. + +Forwarding Address + The address of the router to forward packets to for the route. This may be, + and usually is, left as 0 to specify that the ASBR originating the External + :abbr:`LSA` should be used. There must be an internal OSPF route to the + forwarding address, for the forwarding address to be useable. + +Tag + An arbitrary 4-bytes of data, not interpreted by OSPF, which may carry + whatever information about the route which OSPF speakers desire. + +AS External LSA Example +^^^^^^^^^^^^^^^^^^^^^^^ + +To illustrate, below is an example of an External :abbr:`LSA` in the +:abbr:`LSDB` of an OSPF router. It describes a route to the IP prefix of +192.168.165.0/24, originated by the ASBR with Router-ID 192.168.0.49. The +metric of 20 is external to OSPF. The forwarding address is 0, so the route +should forward to the originating ASBR if selected. + +:: + + # show ip ospf database external 192.168.165.0 + LS age: 995 + Options: 0x2 : *|-|-|-|-|-|E|* + LS Flags: 0x9 + LS Type: AS-external-LSA + Link State ID: 192.168.165.0 (External Network Number) + Advertising Router: 192.168.0.49 + LS Seq Number: 800001d8 + Checksum: 0xea27 + Length: 36 + Network Mask: /24 + Metric Type: 2 (Larger than any link state path) + TOS: 0 + Metric: 20 + Forward Address: 0.0.0.0 + External Route Tag: 0 + + +We can add this to our partial topology from above, which now looks +like::: + + --------------------- Network: ...... + | Designated Router IP: 192.168.1.3 + | + IP: 192.168.1.3 /---- External route: 192.168.165.0/24 + (transit link) / Cost: 20 (External metric) + (cost: 10) / + Router ID: 192.168.0.49(stub)---------- IP: 192.168.3.190/32 + (cost: 10) (cost: 39063) + (transit link) + IP: 192.168.0.49 + | + | + ------------------------------ Network: 192.168.0.48/29 + | | | Designated Router IP: 192.168.0.49 + | | | + | | Router ID: 192.168.0.54 + | | + | Router ID: 192.168.0.53 + | + Router ID: 192.168.0.52 + + +Summary LSAs +^^^^^^^^^^^^ + +Summary LSAs are created by :abbr:`ABR` s to summarise the destinations +available within one area to other areas. These LSAs may describe IP networks, +potentially in aggregated form, or :abbr:`ASBR` routers. diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst new file mode 100644 index 000000000..59917f526 --- /dev/null +++ b/doc/user/ospfd.rst @@ -0,0 +1,1308 @@ +.. _ospfv2: + +****** +OSPFv2 +****** + +:abbr:`OSPF (Open Shortest Path First)` version 2 is a routing protocol which +is described in :rfc:`2328`. OSPF is an :abbr:`IGP (Interior Gateway +Protocol)`. Compared with :abbr:`RIP`, :abbr:`OSPF` can provide scalable +network support and faster convergence times. OSPF is widely used in large +networks such as :abbr:`ISP (Internet Service Provider)` backbone and +enterprise networks. + +.. include:: ospf_fundamentals.rst + +.. _configuring-ospfd: + +Configuring ospfd +================= + +There are no *ospfd* specific options. Common options can be specified +(:ref:`common-invocation-options`) to *ospfd*. *ospfd* needs to acquire +interface information from *zebra* in order to function. Therefore *zebra* must +be running before invoking *ospfd*. Also, if *zebra* is restarted then *ospfd* +must be too. + +Like other daemons, *ospfd* configuration is done in :abbr:`OSPF` specific +configuration file :file:`ospfd.conf`. + +.. _ospf-router: + +OSPF router +=========== + +To start OSPF process you have to specify the OSPF router. As of this +writing, *ospfd* does not support multiple OSPF processes. + +.. index:: router ospf +.. clicmd:: router ospf + +.. index:: no router ospf +.. clicmd:: no router ospf + + Enable or disable the OSPF process. *ospfd* does not yet + support multiple OSPF processes. So you can not specify an OSPF process + number. + +.. index:: ospf router-id A.B.C.D +.. clicmd:: ospf router-id A.B.C.D + +.. index:: no ospf router-id +.. clicmd:: no ospf router-id + + This sets the router-ID of the OSPF process. The + router-ID may be an IP address of the router, but need not be - it can + be any arbitrary 32bit number. However it MUST be unique within the + entire OSPF domain to the OSPF speaker - bad things will happen if + multiple OSPF speakers are configured with the same router-ID! If one + is not specified then *ospfd* will obtain a router-ID + automatically from *zebra*. + +.. index:: ospf abr-type TYPE +.. clicmd:: ospf abr-type TYPE + +.. index:: no ospf abr-type TYPE +.. clicmd:: no ospf abr-type TYPE + + `type` can be cisco|ibm|shortcut|standard. The "Cisco" and "IBM" types + are equivalent. + + The OSPF standard for ABR behaviour does not allow an ABR to consider + routes through non-backbone areas when its links to the backbone are + down, even when there are other ABRs in attached non-backbone areas + which still can reach the backbone - this restriction exists primarily + to ensure routing-loops are avoided. + + With the "Cisco" or "IBM" ABR type, the default in this release of + FRR, this restriction is lifted, allowing an ABR to consider + summaries learnt from other ABRs through non-backbone areas, and hence + route via non-backbone areas as a last resort when, and only when, + backbone links are down. + + Note that areas with fully-adjacent virtual-links are considered to be + "transit capable" and can always be used to route backbone traffic, and + hence are unaffected by this setting (:clicmd:`area A.B.C.D virtual-link A.B.C.D`). + + More information regarding the behaviour controlled by this command can + be found in :rfc:`3509`, and :t:`draft-ietf-ospf-shortcut-abr-02.txt`. + + Quote: "Though the definition of the :abbr:`ABR (Area Border Router)` + in the OSPF specification does not require a router with multiple + attached areas to have a backbone connection, it is actually + necessary to provide successful routing to the inter-area and + external destinations. If this requirement is not met, all traffic + destined for the areas not connected to such an ABR or out of the + OSPF domain, is dropped. This document describes alternative ABR + behaviors implemented in Cisco and IBM routers." + +.. index:: ospf rfc1583compatibility +.. clicmd:: ospf rfc1583compatibility + +.. index:: no ospf rfc1583compatibility +.. clicmd:: no ospf rfc1583compatibility + + :rfc:`2328`, the sucessor to :rfc:`1583`, suggests according + to section G.2 (changes) in section 16.4 a change to the path + preference algorithm that prevents possible routing loops that were + possible in the old version of OSPFv2. More specifically it demands + that inter-area paths and intra-area backbone path are now of equal preference + but still both preferred to external paths. + + This command should NOT be set normally. + +.. index:: log-adjacency-changes [detail] +.. clicmd:: log-adjacency-changes [detail] + +.. index:: no log-adjacency-changes [detail] +.. clicmd:: no log-adjacency-changes [detail] + + Configures ospfd to log changes in adjacency. With the optional + detail argument, all changes in adjacency status are shown. Without detail, + only changes to full or regressions are shown. + +.. index:: passive-interface INTERFACE +.. clicmd:: passive-interface INTERFACE + +.. index:: no passive-interface INTERFACE +.. clicmd:: no passive-interface INTERFACE + + Do not speak OSPF interface on the + given interface, but do advertise the interface as a stub link in the + router-:abbr:`LSA (Link State Advertisement)` for this router. This + allows one to advertise addresses on such connected interfaces without + having to originate AS-External/Type-5 LSAs (which have global flooding + scope) - as would occur if connected addresses were redistributed into + OSPF (:ref:`redistribute-routes-to-ospf`). This is the only way to + advertise non-OSPF links into stub areas. + +.. index:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME +.. clicmd:: timers throttle spf DELAY INITIAL-HOLDTIME MAX-HOLDTIME + +.. index:: no timers throttle spf +.. clicmd:: no timers throttle spf + + This command sets the initial `delay`, the `initial-holdtime` + and the `maximum-holdtime` between when SPF is calculated and the + event which triggered the calculation. The times are specified in + milliseconds and must be in the range of 0 to 600000 milliseconds. + + The `delay` specifies the minimum amount of time to delay SPF + calculation (hence it affects how long SPF calculation is delayed after + an event which occurs outside of the holdtime of any previous SPF + calculation, and also serves as a minimum holdtime). + + Consecutive SPF calculations will always be seperated by at least + 'hold-time' milliseconds. The hold-time is adaptive and initially is + set to the `initial-holdtime` configured with the above command. + Events which occur within the holdtime of the previous SPF calculation + will cause the holdtime to be increased by `initial-holdtime`, bounded + by the `maximum-holdtime` configured with this command. If the adaptive + hold-time elapses without any SPF-triggering event occuring then + the current holdtime is reset to the `initial-holdtime`. The current + holdtime can be viewed with :clicmd:`show ip ospf`, where it is expressed as + a multiplier of the `initial-holdtime`. + + :: + + router ospf + timers throttle spf 200 400 10000 + + + In this example, the `delay` is set to 200ms, the initial holdtime is set to + 400ms and the `maximum holdtime` to 10s. Hence there will always be at least + 200ms between an event which requires SPF calculation and the actual SPF + calculation. Further consecutive SPF calculations will always be seperated + by between 400ms to 10s, the hold-time increasing by 400ms each time an + SPF-triggering event occurs within the hold-time of the previous SPF + calculation. + + This command supercedes the *timers spf* command in previous FRR + releases. + +.. index:: max-metric router-lsa [on-startup|on-shutdown] (5-86400) +.. clicmd:: max-metric router-lsa [on-startup|on-shutdown] (5-86400) + +.. index:: max-metric router-lsa administrative +.. clicmd:: max-metric router-lsa administrative + +.. index:: no max-metric router-lsa [on-startup|on-shutdown|administrative] +.. clicmd:: no max-metric router-lsa [on-startup|on-shutdown|administrative] + + This enables :rfc:`3137` support, where the OSPF process describes its + transit links in its router-LSA as having infinite distance so that other + routers will avoid calculating transit paths through the router while still + being able to reach networks through the router. + + This support may be enabled administratively (and indefinitely) or + conditionally. Conditional enabling of max-metric router-lsas can be for a + period of seconds after startup and/or for a period of seconds prior to + shutdown. + + Enabling this for a period after startup allows OSPF to converge fully first + without affecting any existing routes used by other routers, while still + allowing any connected stub links and/or redistributed routes to be + reachable. Enabling this for a period of time in advance of shutdown allows + the router to gracefully excuse itself from the OSPF domain. + + Enabling this feature administratively allows for administrative + intervention for whatever reason, for an indefinite period of time. Note + that if the configuration is written to file, this administrative form of + the stub-router command will also be written to file. If *ospfd* is + restarted later, the command will then take effect until manually + deconfigured. + + Configured state of this feature as well as current status, such as the + number of second remaining till on-startup or on-shutdown ends, can be + viewed with the :clicmd:`show ip ospf` command. + +.. index:: auto-cost reference-bandwidth (1-4294967) +.. clicmd:: auto-cost reference-bandwidth (1-4294967) + +.. index:: no auto-cost reference-bandwidth +.. clicmd:: no auto-cost reference-bandwidth + + This sets the reference + bandwidth for cost calculations, where this bandwidth is considered + equivalent to an OSPF cost of 1, specified in Mbits/s. The default is + 100Mbit/s (i.e. a link of bandwidth 100Mbit/s or higher will have a + cost of 1. Cost of lower bandwidth links will be scaled with reference + to this cost). + + This configuration setting MUST be consistent across all routers within the + OSPF domain. + +.. index:: network A.B.C.D/M area A.B.C.D +.. clicmd:: network A.B.C.D/M area A.B.C.D + +.. index:: network A.B.C.D/M area (0-4294967295) +.. clicmd:: network A.B.C.D/M area (0-4294967295) + +.. index:: no network A.B.C.D/M area A.B.C.D +.. clicmd:: no network A.B.C.D/M area A.B.C.D + +.. index:: no network A.B.C.D/M area (0-4294967295) +.. clicmd:: no network A.B.C.D/M area (0-4294967295) + + This command specifies the OSPF enabled interface(s). If the interface has + an address from range 192.168.1.0/24 then the command below enables ospf + on this interface so router can provide network information to the other + ospf routers via this interface. + +:: + + router ospf + network 192.168.1.0/24 area 0.0.0.0 + + + Prefix length in interface must be equal or bigger (ie. smaller network) than + prefix length in network statement. For example statement above doesn't enable + ospf on interface with address 192.168.1.1/23, but it does on interface with + address 192.168.1.129/25. + + Note that the behavior when there is a peer address + defined on an interface changed after release 0.99.7. + Currently, if a peer prefix has been configured, + then we test whether the prefix in the network command contains + the destination prefix. Otherwise, we test whether the network command prefix + contains the local address prefix of the interface. + + In some cases it may be more convenient to enable OSPF on a per + interface/subnet basis (:clicmd:`ip ospf area AREA [ADDR]`). + + +.. _ospf-area: + +OSPF area +========= + +.. index:: area A.B.C.D range A.B.C.D/M +.. clicmd:: area A.B.C.D range A.B.C.D/M + +.. index:: area (0-4294967295) range A.B.C.D/M +.. clicmd:: area (0-4294967295) range A.B.C.D/M + +.. index:: no area A.B.C.D range A.B.C.D/M +.. clicmd:: no area A.B.C.D range A.B.C.D/M + +.. index:: no area (0-4294967295) range A.B.C.D/M +.. clicmd:: no area (0-4294967295) range A.B.C.D/M + + Summarize intra area paths from specified area into one Type-3 summary-LSA + announced to other areas. This command can be used only in ABR and ONLY + router-LSAs (Type-1) and network-LSAs (Type-2) (ie. LSAs with scope area) can + be summarized. Type-5 AS-external-LSAs can't be summarized - their scope is AS. + Summarizing Type-7 AS-external-LSAs isn't supported yet by FRR. + +:: + + router ospf + network 192.168.1.0/24 area 0.0.0.0 + network 10.0.0.0/8 area 0.0.0.10 + area 0.0.0.10 range 10.0.0.0/8 + + + With configuration above one Type-3 Summary-LSA with routing info 10.0.0.0/8 is + announced into backbone area if area 0.0.0.10 contains at least one intra-area + network (ie. described with router or network LSA) from this range. + +.. index:: area A.B.C.D range IPV4_PREFIX not-advertise +.. clicmd:: area A.B.C.D range IPV4_PREFIX not-advertise + +.. index:: no area A.B.C.D range IPV4_PREFIX not-advertise +.. clicmd:: no area A.B.C.D range IPV4_PREFIX not-advertise + + Instead of summarizing intra area paths filter them - ie. intra area paths from this + range are not advertised into other areas. + This command makes sense in ABR only. + +.. index:: area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX +.. clicmd:: area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX + +.. index:: no area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX +.. clicmd:: no area A.B.C.D range IPV4_PREFIX substitute IPV4_PREFIX + + Substitute summarized prefix with another prefix. + +:: + + router ospf + network 192.168.1.0/24 area 0.0.0.0 + network 10.0.0.0/8 area 0.0.0.10 + area 0.0.0.10 range 10.0.0.0/8 substitute 11.0.0.0/8 + + + One Type-3 summary-LSA with routing info 11.0.0.0/8 is announced into backbone area if + area 0.0.0.10 contains at least one intra-area network (ie. described with router-LSA or + network-LSA) from range 10.0.0.0/8. + This command makes sense in ABR only. + +.. index:: area A.B.C.D virtual-link A.B.C.D +.. clicmd:: area A.B.C.D virtual-link A.B.C.D + +.. index:: area (0-4294967295) virtual-link A.B.C.D +.. clicmd:: area (0-4294967295) virtual-link A.B.C.D + +.. index:: no area A.B.C.D virtual-link A.B.C.D +.. clicmd:: no area A.B.C.D virtual-link A.B.C.D + +.. index:: no area (0-4294967295) virtual-link A.B.C.D +.. clicmd:: no area (0-4294967295) virtual-link A.B.C.D + +.. index:: area A.B.C.D shortcut +.. clicmd:: area A.B.C.D shortcut + +.. index:: area (0-4294967295) shortcut +.. clicmd:: area (0-4294967295) shortcut + +.. index:: no area A.B.C.D shortcut +.. clicmd:: no area A.B.C.D shortcut + +.. index:: no area (0-4294967295) shortcut +.. clicmd:: no area (0-4294967295) shortcut + + Configure the area as Shortcut capable. See :rfc:`3509`. This requires + that the 'abr-type' be set to 'shortcut'. + +.. index:: area A.B.C.D stub +.. clicmd:: area A.B.C.D stub + +.. index:: area (0-4294967295) stub +.. clicmd:: area (0-4294967295) stub + +.. index:: no area A.B.C.D stub +.. clicmd:: no area A.B.C.D stub + +.. index:: no area (0-4294967295) stub +.. clicmd:: no area (0-4294967295) stub + + Configure the area to be a stub area. That is, an area where no router + originates routes external to OSPF and hence an area where all external + routes are via the ABR(s). Hence, ABRs for such an area do not need + to pass AS-External LSAs (type-5s) or ASBR-Summary LSAs (type-4) into the + area. They need only pass Network-Summary (type-3) LSAs into such an area, + along with a default-route summary. + +.. index:: area A.B.C.D stub no-summary +.. clicmd:: area A.B.C.D stub no-summary + +.. index:: area (0-4294967295) stub no-summary +.. clicmd:: area (0-4294967295) stub no-summary + +.. index:: no area A.B.C.D stub no-summary +.. clicmd:: no area A.B.C.D stub no-summary + +.. index:: no area (0-4294967295) stub no-summary +.. clicmd:: no area (0-4294967295) stub no-summary + + Prevents an *ospfd* ABR from injecting inter-area + summaries into the specified stub area. + +.. index:: area A.B.C.D default-cost (0-16777215) +.. clicmd:: area A.B.C.D default-cost (0-16777215) + +.. index:: no area A.B.C.D default-cost (0-16777215) +.. clicmd:: no area A.B.C.D default-cost (0-16777215) + + Set the cost of default-summary LSAs announced to stubby areas. + +.. index:: area A.B.C.D export-list NAME +.. clicmd:: area A.B.C.D export-list NAME + +.. index:: area (0-4294967295) export-list NAME +.. clicmd:: area (0-4294967295) export-list NAME + +.. index:: no area A.B.C.D export-list NAME +.. clicmd:: no area A.B.C.D export-list NAME + +.. index:: no area (0-4294967295) export-list NAME +.. clicmd:: no area (0-4294967295) export-list NAME + + Filter Type-3 summary-LSAs announced to other areas originated from intra- + area paths from specified area. + +:: + + router ospf + network 192.168.1.0/24 area 0.0.0.0 + network 10.0.0.0/8 area 0.0.0.10 + area 0.0.0.10 export-list foo + ! + access-list foo permit 10.10.0.0/16 + access-list foo deny any + + + With example above any intra-area paths from area 0.0.0.10 and from range + 10.10.0.0/16 (for example 10.10.1.0/24 and 10.10.2.128/30) are announced into + other areas as Type-3 summary-LSA's, but any others (for example 10.11.0.0/16 + or 10.128.30.16/30) aren't. + + This command is only relevant if the router is an ABR for the specified + area. + +.. index:: area A.B.C.D import-list NAME +.. clicmd:: area A.B.C.D import-list NAME + +.. index:: area (0-4294967295) import-list NAME +.. clicmd:: area (0-4294967295) import-list NAME + +.. index:: no area A.B.C.D import-list NAME +.. clicmd:: no area A.B.C.D import-list NAME + +.. index:: no area (0-4294967295) import-list NAME +.. clicmd:: no area (0-4294967295) import-list NAME + + Same as export-list, but it applies to paths announced into specified area as + Type-3 summary-LSAs. + +.. index:: area A.B.C.D filter-list prefix NAME in +.. clicmd:: area A.B.C.D filter-list prefix NAME in + +.. index:: area A.B.C.D filter-list prefix NAME out +.. clicmd:: area A.B.C.D filter-list prefix NAME out + +.. index:: area (0-4294967295) filter-list prefix NAME in +.. clicmd:: area (0-4294967295) filter-list prefix NAME in + +.. index:: area (0-4294967295) filter-list prefix NAME out +.. clicmd:: area (0-4294967295) filter-list prefix NAME out + +.. index:: no area A.B.C.D filter-list prefix NAME in +.. clicmd:: no area A.B.C.D filter-list prefix NAME in + +.. index:: no area A.B.C.D filter-list prefix NAME out +.. clicmd:: no area A.B.C.D filter-list prefix NAME out + +.. index:: no area (0-4294967295) filter-list prefix NAME in +.. clicmd:: no area (0-4294967295) filter-list prefix NAME in + +.. index:: no area (0-4294967295) filter-list prefix NAME out +.. clicmd:: no area (0-4294967295) filter-list prefix NAME out + + Filtering Type-3 summary-LSAs to/from area using prefix lists. This command + makes sense in ABR only. + +.. index:: area A.B.C.D authentication +.. clicmd:: area A.B.C.D authentication + +.. index:: area (0-4294967295) authentication +.. clicmd:: area (0-4294967295) authentication + +.. index:: no area A.B.C.D authentication +.. clicmd:: no area A.B.C.D authentication + +.. index:: no area (0-4294967295) authentication +.. clicmd:: no area (0-4294967295) authentication + + Specify that simple password authentication should be used for the given + area. + +.. index:: area A.B.C.D authentication message-digest +.. clicmd:: area A.B.C.D authentication message-digest + +.. index:: area (0-4294967295) authentication message-digest +.. clicmd:: area (0-4294967295) authentication message-digest + + Specify that OSPF packets must be authenticated with MD5 HMACs within the + given area. Keying material must also be configured on a per-interface basis + (:clicmd:`ip ospf message-digest-key`). + + MD5 authentication may also be configured on a per-interface basis + (:clicmd:`ip ospf authentication message-digest`). Such per-interface + settings will override any per-area authentication setting. + +.. _ospf-interface: + +OSPF interface +============== + +.. index:: ip ospf area AREA [ADDR] +.. clicmd:: ip ospf area AREA [ADDR] + +.. index:: no ip ospf area [ADDR] +.. clicmd:: no ip ospf area [ADDR] + + Enable OSPF on the interface, optionally restricted to just the IP address + given by `ADDR`, putting it in the `AREA` area. Per interface area settings + take precedence to network commands + (:clicmd:`network A.B.C.D/M area A.B.C.D`). + + If you have a lot of interfaces, and/or a lot of subnets, then enabling OSPF + via this command may result in a slight performance improvement. + +.. index:: ip ospf authentication-key AUTH_KEY +.. clicmd:: ip ospf authentication-key AUTH_KEY + +.. index:: no ip ospf authentication-key +.. clicmd:: no ip ospf authentication-key + + Set OSPF authentication key to a simple password. After setting `AUTH_KEY`, + all OSPF packets are authenticated. `AUTH_KEY` has length up to 8 chars. + + Simple text password authentication is insecure and deprecated in favour of + MD5 HMAC authentication. + +.. index:: ip ospf authentication message-digest +.. clicmd:: ip ospf authentication message-digest + + Specify that MD5 HMAC authentication must be used on this interface. MD5 + keying material must also be configured. Overrides any authentication + enabled on a per-area basis + (:clicmd:`area A.B.C.D authentication message-digest`) + + Note that OSPF MD5 authentication requires that time never go backwards + (correct time is NOT important, only that it never goes backwards), even + across resets, if ospfd is to be able to promptly reestabish adjacencies + with its neighbours after restarts/reboots. The host should have system time + be set at boot from an external or non-volatile source (eg battery backed + clock, NTP, etc.) or else the system clock should be periodically saved to + non-volative storage and restored at boot if MD5 authentication is to be + expected to work reliably. + +.. index:: ip ospf message-digest-key KEYID md5 KEY +.. clicmd:: ip ospf message-digest-key KEYID md5 KEY + +.. index:: no ip ospf message-digest-key +.. clicmd:: no ip ospf message-digest-key + + Set OSPF authentication key to a cryptographic password. The cryptographic + algorithm is MD5. + + KEYID identifies secret key used to create the message digest. This ID + is part of the protocol and must be consistent across routers on a + link. + + KEY is the actual message digest key, of up to 16 chars (larger strings + will be truncated), and is associated with the given KEYID. + +.. index:: ip ospf cost (1-65535) +.. clicmd:: ip ospf cost (1-65535) + +.. index:: no ip ospf cost +.. clicmd:: no ip ospf cost + + Set link cost for the specified interface. The cost value is set to router-LSA's + metric field and used for SPF calculation. + +.. index:: ip ospf dead-interval (1-65535) +.. clicmd:: ip ospf dead-interval (1-65535) + +.. index:: ip ospf dead-interval minimal hello-multiplier (2-20) +.. clicmd:: ip ospf dead-interval minimal hello-multiplier (2-20) + +.. index:: no ip ospf dead-interval +.. clicmd:: no ip ospf dead-interval + + Set number of seconds for RouterDeadInterval timer value used for Wait Timer + and Inactivity Timer. This value must be the same for all routers attached + to a common network. The default value is 40 seconds. + + If 'minimal' is specified instead, then the dead-interval is set to 1 second + and one must specify a hello-multiplier. The hello-multiplier specifies how + many Hellos to send per second, from 2 (every 500ms) to 20 (every 50ms). + Thus one can have 1s convergence time for OSPF. If this form is specified, + then the hello-interval advertised in Hello packets is set to 0 and the + hello-interval on received Hello packets is not checked, thus the + hello-multiplier need NOT be the same across multiple routers on a common + link. + +.. index:: ip ospf hello-interval (1-65535) +.. clicmd:: ip ospf hello-interval (1-65535) + +.. index:: no ip ospf hello-interval +.. clicmd:: no ip ospf hello-interval + + Set number of seconds for HelloInterval timer value. Setting this value, + Hello packet will be sent every timer value seconds on the specified interface. + This value must be the same for all routers attached to a common network. + The default value is 10 seconds. + + This command has no effect if + :clicmd:`ip ospf dead-interval minimal hello-multiplier (2-20)` is also + specified for the interface. + +.. index:: ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) +.. clicmd:: ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point) + +.. index:: no ip ospf network +.. clicmd:: no ip ospf network + + Set explicitly network type for specifed interface. + +.. index:: ip ospf priority (0-255) +.. clicmd:: ip ospf priority (0-255) + +.. index:: no ip ospf priority +.. clicmd:: no ip ospf priority + + Set RouterPriority integer value. The router with the highest priority + will be more eligible to become Designated Router. Setting the value + to 0, makes the router ineligible to become Designated Router. The + default value is 1. + +.. index:: ip ospf retransmit-interval (1-65535) +.. clicmd:: ip ospf retransmit-interval (1-65535) + +.. index:: no ip ospf retransmit interval +.. clicmd:: no ip ospf retransmit interval + + Set number of seconds for RxmtInterval timer value. This value is used + when retransmitting Database Description and Link State Request packets. + The default value is 5 seconds. + +.. index:: ip ospf transmit-delay +.. clicmd:: ip ospf transmit-delay + +.. index:: no ip ospf transmit-delay +.. clicmd:: no ip ospf transmit-delay + + Set number of seconds for InfTransDelay value. LSAs' age should be + incremented by this value when transmitting. + The default value is 1 seconds. + +.. index:: ip ospf area (A.B.C.D|(0-4294967295)) +.. clicmd:: ip ospf area (A.B.C.D|(0-4294967295)) + +.. index:: no ip ospf area +.. clicmd:: no ip ospf area + + Enable ospf on an interface and set associated area. + +.. _redistribute-routes-to-ospf: + +Redistribute routes to OSPF +=========================== + +.. index:: redistribute (kernel|connected|static|rip|bgp) +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) + +.. index:: redistribute (kernel|connected|static|rip|bgp) ROUTE-MAP +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) ROUTE-MAP + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric (0-16777214) +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric (0-16777214) + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric (0-16777214) route-map WORD +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric (0-16777214) route-map WORD + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) + +.. index:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) route-map WORD +.. clicmd:: redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric (0-16777214) route-map WORD + +.. index:: no redistribute (kernel|connected|static|rip|bgp) +.. clicmd:: no redistribute (kernel|connected|static|rip|bgp) + +.. _ospf-redistribute: + + Redistribute routes of the specified protocol + or kind into OSPF, with the metric type and metric set if specified, + filtering the routes using the given route-map if specified. + Redistributed routes may also be filtered with distribute-lists, see + :ref:`ospf distribute-list configuration <ospf-distribute-list>`. + + Redistributed routes are distributed as into OSPF as Type-5 External + LSAs into links to areas that accept external routes, Type-7 External LSAs + for NSSA areas and are not redistributed at all into Stub areas, where + external routes are not permitted. + + Note that for connected routes, one may instead use the `passive-interface` + configuration. + +.. seealso:: + + clicmd:`passive-interface INTERFACE`. + +.. index:: default-information originate +.. clicmd:: default-information originate + +.. index:: default-information originate metric (0-16777214) +.. clicmd:: default-information originate metric (0-16777214) + +.. index:: default-information originate metric (0-16777214) metric-type (1|2) +.. clicmd:: default-information originate metric (0-16777214) metric-type (1|2) + +.. index:: default-information originate metric (0-16777214) metric-type (1|2) route-map WORD +.. clicmd:: default-information originate metric (0-16777214) metric-type (1|2) route-map WORD + +.. index:: default-information originate always +.. clicmd:: default-information originate always + +.. index:: default-information originate always metric (0-16777214) +.. clicmd:: default-information originate always metric (0-16777214) + +.. index:: default-information originate always metric (0-16777214) metric-type (1|2) +.. clicmd:: default-information originate always metric (0-16777214) metric-type (1|2) + +.. index:: default-information originate always metric (0-16777214) metric-type (1|2) route-map WORD +.. clicmd:: default-information originate always metric (0-16777214) metric-type (1|2) route-map WORD + +.. index:: no default-information originate +.. clicmd:: no default-information originate + + Originate an AS-External (type-5) LSA describing a default route into + all external-routing capable areas, of the specified metric and metric + type. If the 'always' keyword is given then the default is always + advertised, even when there is no default present in the routing table. + +.. index:: distribute-list NAME out (kernel|connected|static|rip|ospf +.. clicmd:: distribute-list NAME out (kernel|connected|static|rip|ospf + +.. index:: no distribute-list NAME out (kernel|connected|static|rip|ospf +.. clicmd:: no distribute-list NAME out (kernel|connected|static|rip|ospf + +.. _ospf-distribute-list: + + Apply the access-list filter, NAME, to + redistributed routes of the given type before allowing the routes to + redistributed into OSPF (:ref:`ospf redistribution <ospf-redistribute>`). + +.. index:: default-metric (0-16777214) +.. clicmd:: default-metric (0-16777214) + +.. index:: no default-metric +.. clicmd:: no default-metric + +.. index:: distance (1-255) +.. clicmd:: distance (1-255) + +.. index:: no distance (1-255) +.. clicmd:: no distance (1-255) + +.. index:: distance ospf (intra-area|inter-area|external) (1-255) +.. clicmd:: distance ospf (intra-area|inter-area|external) (1-255) + +.. index:: no distance ospf +.. clicmd:: no distance ospf + +.. index:: router zebra +.. clicmd:: router zebra + +.. index:: no router zebra +.. clicmd:: no router zebra + + +.. _showing-ospf-information: + +Showing OSPF information +======================== + +.. _show-ip-ospf: + +.. index:: show ip ospf +.. clicmd:: show ip ospf + + Show information on a variety of general OSPF and area state and + configuration information. + +.. index:: show ip ospf interface [INTERFACE] +.. clicmd:: show ip ospf interface [INTERFACE] + + Show state and configuration of OSPF the specified interface, or all + interfaces if no interface is given. + +.. index:: show ip ospf neighbor +.. clicmd:: show ip ospf neighbor + +.. index:: show ip ospf neighbor INTERFACE +.. clicmd:: show ip ospf neighbor INTERFACE + +.. index:: show ip ospf neighbor detail +.. clicmd:: show ip ospf neighbor detail + +.. index:: show ip ospf neighbor INTERFACE detail +.. clicmd:: show ip ospf neighbor INTERFACE detail + +.. index:: show ip ospf database +.. clicmd:: show ip ospf database + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID adv-router ADV-ROUTER + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) adv-router ADV-ROUTER + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) LINK-STATE-ID self-originate + +.. index:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate +.. clicmd:: show ip ospf database (asbr-summary|external|network|router|summary) self-originate + +.. index:: show ip ospf database max-age +.. clicmd:: show ip ospf database max-age + +.. index:: show ip ospf database self-originate +.. clicmd:: show ip ospf database self-originate + +.. index:: show ip ospf route +.. clicmd:: show ip ospf route + + Show the OSPF routing table, as determined by the most recent SPF calculation. + +.. _opaque-lsa: + +Opaque LSA +========== + +.. index:: ospf opaque-lsa +.. clicmd:: ospf opaque-lsa + +.. index:: capability opaque +.. clicmd:: capability opaque + +.. index:: no ospf opaque-lsa +.. clicmd:: no ospf opaque-lsa + +.. index:: no capability opaque +.. clicmd:: no capability opaque + + *ospfd* support Opaque LSA (RFC2370) as fondment for MPLS Traffic Engineering + LSA. Prior to used MPLS TE, opaque-lsa must be enable in the configuration + file. Alternate command could be "mpls-te on" + (:ref:`ospf-traffic-engineering`). + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID adv-router ADV-ROUTER +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID adv-router ADV-ROUTER + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) adv-router ADV-ROUTER +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) adv-router ADV-ROUTER + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID self-originate +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) LINK-STATE-ID self-originate + +.. index:: show ip ospf database (opaque-link|opaque-area|opaque-external) self-originate +.. clicmd:: show ip ospf database (opaque-link|opaque-area|opaque-external) self-originate + + Show Opaque LSA from the database. + +.. _ospf-traffic-engineering: + +Traffic Engineering +=================== + +.. index:: mpls-te on +.. clicmd:: mpls-te on + +.. index:: no mpls-te +.. clicmd:: no mpls-te + + Enable Traffic Engineering LSA flooding. + +.. index:: mpls-te router-address <A.B.C.D> +.. clicmd:: mpls-te router-address <A.B.C.D> + + Configure stable IP address for MPLS-TE. This IP address is then advertise + in Opaque LSA Type-10 TLV=1 (TE) option 1 (Router-Address). + +.. index:: mpls-te inter-as area <area-id>|as +.. clicmd:: mpls-te inter-as area <area-id>|as + +.. index:: no mpls-te inter-as +.. clicmd:: no mpls-te inter-as + + Enable :rfc:`5392` support - Inter-AS TE v2 - to flood Traffic Engineering + parameters of Inter-AS link. 2 modes are supported: AREA and AS; LSA are + flood in AREA <area-id> with Opaque Type-10, respectively in AS with Opaque + Type-11. In all case, Opaque-LSA TLV=6. + +.. index:: show ip ospf mpls-te interface +.. clicmd:: show ip ospf mpls-te interface + +.. index:: show ip ospf mpls-te interface INTERFACE +.. clicmd:: show ip ospf mpls-te interface INTERFACE + + Show MPLS Traffic Engineering parameters for all or specified interface. + +.. index:: show ip ospf mpls-te router +.. clicmd:: show ip ospf mpls-te router + + Show Traffic Engineering router parameters. + +.. _router-information: + +Router Information +================== + +.. index:: router-info [as | area <A.B.C.D>] +.. clicmd:: router-info [as | area <A.B.C.D>] + +.. index:: no router-info +.. clicmd:: no router-info + + Enable Router Information (:rfc:`4970`) LSA advertisement with AS scope + (default) or Area scope flooding when area is specified. + +.. index:: pce address <A.B.C.D> +.. clicmd:: pce address <A.B.C.D> + +.. index:: no pce address +.. clicmd:: no pce address + +.. index:: pce domain as (0-65535) +.. clicmd:: pce domain as (0-65535) + +.. index:: no pce domain as (0-65535) +.. clicmd:: no pce domain as (0-65535) + +.. index:: pce neighbor as (0-65535) +.. clicmd:: pce neighbor as (0-65535) + +.. index:: no pce neighbor as (0-65535) +.. clicmd:: no pce neighbor as (0-65535) + +.. index:: pce flag BITPATTERN +.. clicmd:: pce flag BITPATTERN + +.. index:: no pce flag +.. clicmd:: no pce flag + +.. index:: pce scope BITPATTERN +.. clicmd:: pce scope BITPATTERN + +.. index:: no pce scope +.. clicmd:: no pce scope + + The commands are conform to :rfc:`5088` and allow OSPF router announce Path + Compuatation Elemenent (PCE) capabilities through the Router Information (RI) + LSA. Router Information must be enable prior to this. The command set/unset + respectively the PCE IP adress, Autonomous System (AS) numbers of controlled + domains, neighbor ASs, flag and scope. For flag and scope, please refer to + :rfc`5088` for the BITPATTERN recognition. Multiple 'pce neighbor' command + could be specified in order to specify all PCE neighbours. + +.. index:: show ip ospf router-info +.. clicmd:: show ip ospf router-info + + Show Router Capabilities flag. +.. index:: show ip ospf router-info pce +.. clicmd:: show ip ospf router-info pce + + Show Router Capabilities PCE parameters. + +.. _debugging-ospf: + +Segment Routing +=============== + +This is an EXPERIMENTAL support of Segment Routing as per draft +`draft-ietf-ospf-segment-routing-extensions-24.txt` for MPLS dataplane. + +.. index:: [no] segment-routing on +.. clicmd:: [no] segment-routing on + + Enable Segment Routing. Even if this also activate routing information + support, it is preferable to also activate routing information, and set + accordingly the Area or AS flooding. + +.. index:: [no] segment-routing global-block (0-1048575) (0-1048575) +.. clicmd:: [no] segment-routing global-block (0-1048575) (0-1048575) + + Fix the Segment Routing Global Block i.e. the label range used by MPLS to + store label in the MPLS FIB. + +.. index:: [no] segment-routing node-msd (1-16) +.. clicmd:: [no] segment-routing node-msd (1-16) + + Fix the Maximum Stack Depth supported by the router. The value depend of the + MPLS dataplane. E.g. for Linux kernel, since version 4.13 it is 32. + +.. index:: [no] segment-routing prefix A.B.C.D/M index (0-65535) [no-php-flag] +.. clicmd:: [no] segment-routing prefix A.B.C.D/M index (0-65535) [no-php-flag] + + Set the Segment Rounting index for the specifyed prefix. Note + that, only prefix with /32 corresponding to a loopback interface are + currently supported. The 'no-php-flag' means NO Penultimate Hop Popping that + allows SR node to request to its neighbor to not pop the label. + +.. index:: show ip ospf database segment-routing <adv-router ADVROUTER|self-originate> [json] +.. clicmd:: show ip ospf database segment-routing <adv-router ADVROUTER|self-originate> [json] + + Show Segment Routing Data Base, all SR nodes, specific advertized router or + self router. Optional JSON output can be obtained by appending 'json' to the + end of the command. + +Debugging OSPF +============== + +.. index:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] +.. clicmd:: debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] + +.. index:: no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] +.. clicmd:: no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) [detail] + + Dump Packet for debugging + +.. index:: debug ospf ism +.. clicmd:: debug ospf ism + +.. index:: debug ospf ism (status|events|timers) +.. clicmd:: debug ospf ism (status|events|timers) + +.. index:: no debug ospf ism +.. clicmd:: no debug ospf ism + +.. index:: no debug ospf ism (status|events|timers) +.. clicmd:: no debug ospf ism (status|events|timers) + + Show debug information of Interface State Machine + +.. index:: debug ospf nsm +.. clicmd:: debug ospf nsm + +.. index:: debug ospf nsm (status|events|timers) +.. clicmd:: debug ospf nsm (status|events|timers) + +.. index:: no debug ospf nsm +.. clicmd:: no debug ospf nsm + +.. index:: no debug ospf nsm (status|events|timers) +.. clicmd:: no debug ospf nsm (status|events|timers) + + Show debug information of Network State Machine + +.. index:: debug ospf event +.. clicmd:: debug ospf event + +.. index:: no debug ospf event +.. clicmd:: no debug ospf event + + Show debug information of OSPF event + +.. index:: debug ospf nssa +.. clicmd:: debug ospf nssa + +.. index:: no debug ospf nssa +.. clicmd:: no debug ospf nssa + + Show debug information about Not So Stub Area + +.. index:: debug ospf lsa +.. clicmd:: debug ospf lsa + +.. index:: debug ospf lsa (generate|flooding|refresh) +.. clicmd:: debug ospf lsa (generate|flooding|refresh) + +.. index:: no debug ospf lsa +.. clicmd:: no debug ospf lsa + +.. index:: no debug ospf lsa (generate|flooding|refresh) +.. clicmd:: no debug ospf lsa (generate|flooding|refresh) + + Show debug detail of Link State messages + +.. index:: debug ospf te +.. clicmd:: debug ospf te + +.. index:: no debug ospf te +.. clicmd:: no debug ospf te + + Show debug information about Traffic Engineering LSA + +.. index:: debug ospf zebra +.. clicmd:: debug ospf zebra + +.. index:: debug ospf zebra (interface|redistribute) +.. clicmd:: debug ospf zebra (interface|redistribute) + +.. index:: no debug ospf zebra +.. clicmd:: no debug ospf zebra + +.. index:: no debug ospf zebra (interface|redistribute) +.. clicmd:: no debug ospf zebra (interface|redistribute) + + Show debug information of ZEBRA API + +.. index:: show debugging ospf +.. clicmd:: show debugging ospf + + +OSPF Configuration Examples +=========================== + +A simple example, with MD5 authentication enabled: + +:: + + ! + interface bge0 + ip ospf authentication message-digest + ip ospf message-digest-key 1 md5 ABCDEFGHIJK + ! + router ospf + network 192.168.0.0/16 area 0.0.0.1 + area 0.0.0.1 authentication message-digest + + +An :abbr:`ABR` router, with MD5 authentication and performing summarisation +of networks between the areas: + +:: + + ! + password ABCDEF + log file /var/log/frr/ospfd.log + service advanced-vty + ! + interface eth0 + ip ospf authentication message-digest + ip ospf message-digest-key 1 md5 ABCDEFGHIJK + ! + interface ppp0 + ! + interface br0 + ip ospf authentication message-digest + ip ospf message-digest-key 2 md5 XYZ12345 + ! + router ospf + ospf router-id 192.168.0.1 + redistribute connected + passive interface ppp0 + network 192.168.0.0/24 area 0.0.0.0 + network 10.0.0.0/16 area 0.0.0.0 + network 192.168.1.0/24 area 0.0.0.1 + area 0.0.0.0 authentication message-digest + area 0.0.0.0 range 10.0.0.0/16 + area 0.0.0.0 range 192.168.0.0/24 + area 0.0.0.1 authentication message-digest + area 0.0.0.1 range 10.2.0.0/16 + ! + + +A Traffic Engineering configuration, with Inter-ASv2 support. + +First, the 'zebra.conf' part::: + + interface eth0 + ip address 198.168.1.1/24 + link-params + enable + admin-grp 0xa1 + metric 100 + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + ! + interface eth1 + ip address 192.168.2.1/24 + link-params + enable + metric 10 + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + neighbor 192.168.2.2 as 65000 + hostname HOSTNAME + password PASSWORD + log file /var/log/zebra.log + ! + interface eth0 + ip address 198.168.1.1/24 + link-params + enable + admin-grp 0xa1 + metric 100 + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + ! + interface eth1 + ip address 192.168.2.1/24 + link-params + enable + metric 10 + max-bw 1.25e+07 + max-rsv-bw 1.25e+06 + unrsv-bw 0 1.25e+06 + unrsv-bw 1 1.25e+06 + unrsv-bw 2 1.25e+06 + unrsv-bw 3 1.25e+06 + unrsv-bw 4 1.25e+06 + unrsv-bw 5 1.25e+06 + unrsv-bw 6 1.25e+06 + unrsv-bw 7 1.25e+06 + neighbor 192.168.2.2 as 65000 + +Then the 'ospfd.conf' itself::: + + hostname HOSTNAME + password PASSWORD + log file /var/log/ospfd.log + ! + ! + interface eth0 + ip ospf hello-interval 60 + ip ospf dead-interval 240 + ! + interface eth1 + ip ospf hello-interval 60 + ip ospf dead-interval 240 + ! + ! + router ospf + ospf router-id 192.168.1.1 + network 192.168.0.0/16 area 1 + ospf opaque-lsa + mpls-te + mpls-te router-address 192.168.1.1 + mpls-te inter-as area 1 + ! + line vty + + +A router information example with PCE advsertisement::: + + ! + router ospf + ospf router-id 192.168.1.1 + network 192.168.0.0/16 area 1 + capability opaque + mpls-te + mpls-te router-address 192.168.1.1 + router-info area 0.0.0.1 + pce address 192.168.1.1 + pce flag 0x80 + pce domain as 65400 + pce neighbor as 65500 + pce neighbor as 65200 + pce scope 0x80 + ! diff --git a/doc/user/overview.rst b/doc/user/overview.rst new file mode 100644 index 000000000..064dc436e --- /dev/null +++ b/doc/user/overview.rst @@ -0,0 +1,302 @@ +.. _overview: + +******** +Overview +******** + +`FRR`_ is a routing software package that provides TCP/IP based +routing services with routing protocols support such as RIPv1, RIPv2, RIPng, +OSPFv2, OSPFv3, IS-IS, BGP-4, and BGP-4+ (:ref:`supported-rfcs`). FRR also +supports special BGP Route Reflector and Route Server behavior. In addition to +traditional IPv4 routing protocols, FRR also supports IPv6 routing protocols. +With SNMP daemon which supports SMUX and AgentX protocol, FRR provides routing +protocol MIBs (:ref:`snmp-support`). + +FRR uses an advanced software architecture to provide you with a high +quality, multi server routing engine. FRR has an interactive user +interface for each routing protocol and supports common client commands. +Due to this design, you can add new protocol daemons to FRR easily. You +can use FRR library as your program's client user interface. + +FRR is distributed under the GNU General Public License. + +.. _about-frr: + +About FRR +========= + +Today, TCP/IP networks are covering all of the world. The Internet has +been deployed in many countries, companies, and to the home. When you +connect to the Internet your packet will pass many routers which have TCP/IP +routing functionality. + +A system with FRR installed acts as a dedicated router. With FRR, +your machine exchanges routing information with other routers using routing +protocols. FRR uses this information to update the kernel routing table +so that the right data goes to the right place. You can dynamically change +the configuration and you may view routing table information from the FRR +terminal interface. + +Adding to routing protocol support, FRR can setup interface's flags, +interface's address, static routes and so on. If you have a small network, +or a stub network, or xDSL connection, configuring the FRR routing +software is very easy. The only thing you have to do is to set up the +interfaces and put a few commands about static routes and/or default routes. +If the network is rather large, or if the network structure changes +frequently, you will want to take advantage of FRR's dynamic routing +protocol support for protocols such as RIP, OSPF, IS-IS or BGP. + +Traditionally, UNIX based router configuration is done by +*ifconfig* and *route* commands. Status of routing +table is displayed by *netstat* utility. Almost of these commands +work only if the user has root privileges. FRR has a different system +administration method. There are two user modes in FRR. One is normal +mode, the other is enable mode. Normal mode user can only view system +status, enable mode user can change system configuration. This UNIX account +independent feature will be great help to the router administrator. + +Currently, FRR supports common unicast routing protocols, that is BGP, +OSPF, RIP and IS-IS. Upcoming for MPLS support, an implementation of LDP is +currently being prepared for merging. Implementations of BFD and PIM-SSM +(IPv4) also exist, but are not actively being worked on. + +The ultimate goal of the FRR project is making a productive, quality, free +TCP/IP routing software package. + + +System Architecture +=================== + +.. index:: System architecture + +.. index:: Software architecture + +.. index:: Software internals + +Traditional routing software is made as a one process program which +provides all of the routing protocol functionalities. FRR takes a +different approach. It is made from a collection of several daemons that +work together to build the routing table. There may be several +protocol-specific routing daemons and zebra the kernel routing manager. + +The *ripd* daemon handles the RIP protocol, while +*ospfd* is a daemon which supports OSPF version 2. +*bgpd* supports the BGP-4 protocol. For changing the kernel +routing table and for redistribution of routes between different routing +protocols, there is a kernel routing table manager *zebra* daemon. +It is easy to add a new routing protocol daemons to the entire routing +system without affecting any other software. You need to run only the +protocol daemon associated with routing protocols in use. Thus, user may +run a specific daemon and send routing reports to a central routing console. + +There is no need for these daemons to be running on the same machine. You +can even run several same protocol daemons on the same machine. This +architecture creates new possibilities for the routing system. + +:: + + +----+ +----+ +-----+ +-----+ + |bgpd| |ripd| |ospfd| |zebra| + +----+ +----+ +-----+ +-----+ + | + +---------------------------|--+ + | v | + | UNIX Kernel routing table | + | | + +------------------------------+ + + FRR System Architecture + + +Multi-process architecture brings extensibility, modularity and +maintainability. At the same time it also brings many configuration files +and terminal interfaces. Each daemon has it's own configuration file and +terminal interface. When you configure a static route, it must be done in +*zebra* configuration file. When you configure BGP network it must +be done in *bgpd* configuration file. This can be a very annoying +thing. To resolve the problem, FRR provides integrated user interface +shell called *vtysh*. *vtysh* connects to each daemon with +UNIX domain socket and then works as a proxy for user input. + +FRR was planned to use multi-threaded mechanism when it runs with a +kernel that supports multi-threads. But at the moment, the thread library +which comes with GNU/Linux or FreeBSD has some problems with running +reliable services such as routing software, so we don't use threads at all. +Instead we use the *select(2)* system call for multiplexing the +events. + + +Supported Platforms +=================== + +.. index:: Supported platforms + +.. index:: FRR on other systems + +.. index:: Compatibility with other systems + +.. index:: Operating systems that support FRR + +Currently FRR supports GNU/Linux and BSD. Porting FRR +to other platforms is not too difficult as platform dependent code should +most be limited to the *zebra* daemon. Protocol daemons are mostly +platform independent. Please let us know when you find out FRR runs on a +platform which is not listed below. + +The list of officially supported platforms are listed below. Note that +FRR may run correctly on other platforms, and may run with partial +functionality on further platforms. + +- GNU/Linux +- FreeBSD +- NetBSD +- OpenBSD + +Versions of these platforms that are older than around 2 years from the point +of their original release (in case of GNU/Linux, this is since the kernel's +release on https://kernel.org/) may need some work. Similarly, the following platforms +may work with some effort: + +- Solaris +- MacOS + +Also note that, in particular regarding proprietary platforms, compiler +and C library choice will affect FRR. Only recent versions of the +following C compilers are well-tested: + +- GNU's GCC +- LLVM's clang +- Intel's ICC + + +.. _supported-rfcs: + +Supported RFCs +============== + +FRR implements the following RFCs: + +- :rfc:`1058` + :t:`Routing Information Protocol. C.L. Hedrick. Jun-01-1988.` +- :rfc:`2082` + :t:`RIP-2 MD5 Authentication. F. Baker, R. Atkinson. January 1997.` +- :rfc:`2453` + :t:`RIP Version 2. G. Malkin. November 1998.` +- :rfc:`2080` + :t:`RIPng for IPv6. G. Malkin, R. Minnear. January 1997.` +- :rfc:`2328` + :t:`OSPF Version 2. J. Moy. April 1998.` +- :rfc:`2370` + :t:`The OSPF Opaque LSA Option R. Coltun. July 1998.` +- :rfc:`3101` + :t:`The OSPF Not-So-Stubby Area (NSSA) Option P. Murphy. January 2003.` +- :rfc:`2740` + :t:`OSPF for IPv6. R. Coltun, D. Ferguson, J. Moy. December 1999.` +- :rfc:`1771` + :t:`A Border Gateway Protocol 4 (BGP-4). Y. Rekhter & T. Li. March 1995.` +- :rfc:`1965` + :t:`Autonomous System Confederations for BGP. P. Traina. June 1996.` +- :rfc:`1997` + :t:`BGP Communities Attribute. R. Chandra, P. Traina & T. Li. August 1996.` +- :rfc:`2545` + :t:`Use of BGP-4 Multiprotocol Extensions for IPv6 Inter-Domain Routing. P. + Marques, F. Dupont. March 1999.` +- :rfc:`2796` + :t:`BGP Route Reflection An alternative to full mesh IBGP. T. Bates & R. + Chandrasekeran. June 1996.` +- :rfc:`2858` + :t:`Multiprotocol Extensions for BGP-4. T. Bates, Y. Rekhter, R. Chandra, D. + Katz. June 2000.` +- :rfc:`2842` + :t:`Capabilities Advertisement with BGP-4. R. Chandra, J. Scudder. May 2000.` +- :rfc:`3137` + :t:`OSPF Stub Router Advertisement, A. Retana, L. Nguyen, R. White, A. Zinin, + D. McPherson. June 2001` + +**When SNMP support is enabled, the following RFCs are also supported:** + +- :rfc:`1227` + :t:`SNMP MUX protocol and MIB. M.T. Rose. May-01-1991.` +- :rfc:`1657` + :t:`Definitions of Managed Objects for the Fourth Version of the Border + Gateway Protocol (BGP-4) using SMIv2. S. Willis, J. Burruss, J. Chu, Editor. + July 1994.` +- :rfc:`1724` + :t:`RIP Version 2 MIB Extension. G. Malkin & F. Baker. November 1994.` +- :rfc:`1850` + :t:`OSPF Version 2 Management Information Base. F. Baker, R. Coltun. + November 1995.` +- :rfc:`2741` + :t:`Agent Extensibility (AgentX) Protocol. M. Daniele, B. Wijnen. January 2000.` + +How to get FRR +============== + +The official FRR website is located at |PACKAGE_URL| and contains further +information, as well as links to additional resources. + +FRR is a fork of `Quagga <http://www.quagga.net/>`_. + +Mailing Lists +============= + +.. index:: How to get in touch with FRR +.. index:: Contact information +.. index:: Mailing lists + + +Italicized lists are private. + ++--------------------------------+------------------------------+ +| Topic | List | ++================================+==============================+ +| Development | dev@lists.frrouting.org | ++--------------------------------+------------------------------+ +| Users & Operators | frog@lists.frrouting.org | ++--------------------------------+------------------------------+ +| Announcements | announce@lists.frrouting.org | ++--------------------------------+------------------------------+ +| *Security* | security@lists.frrouting.org | ++--------------------------------+------------------------------+ +| *Technical Steering Committee* | tsc@lists.frrouting.org | ++--------------------------------+------------------------------+ + +The Development list is used to discuss and document general issues related to +project development and governance. The public `Slack`_ instance and weekly +technical meetings provide a higher bandwidth channel for discussions. The +results of such discussions are reflected in updates, as appropriate, to code +(i.e., merges), `GitHub issues`_ tracked issues, and for governance or process +changes, updates to the Development list and either this file or information +posted at `FRR`_. + +.. index:: Bug Reports +.. index:: Bug hunting +.. index:: Found a bug? +.. index:: Reporting bugs +.. index:: Reporting software errors +.. index:: Errors in the software + +.. _bug-reports: + +Bug Reports +=========== + +If you think you have found a bug, please file a bug report on our +`GitHub issues`_ page. + +When you send a bug report, please be careful about the points below. + +- Please note what kind of OS you are using. If you use the IPv6 stack + please note that as well. +- Please show us the results of `netstat -rn` and `ifconfig -a`. + Information from zebra's VTY command `show ip route` will also be + helpful. +- Please send your configuration file with the report. If you specify + arguments to the configure script please note that too. + +Bug reports help us improve FRR and are very much appreciated. + +.. _frr: |package-url| +.. _github: https://github.com/frrouting/frr/ +.. _github issues: https://github.com/frrouting/frr/issues +.. _slack: https://frrouting.slack.com/ diff --git a/doc/user/pim.rst b/doc/user/pim.rst new file mode 100644 index 000000000..b9945680c --- /dev/null +++ b/doc/user/pim.rst @@ -0,0 +1,409 @@ +.. _pim: + +*** +PIM +*** + +PIM -- Protocol Independent Multicast + +*pimd* supports pim-sm as well as igmp v2 and v3. pim is +vrf aware and can work within the context of vrf's in order to +do S,G mrouting. + +.. _starting-and-stopping-pimd: + +Starting and Stopping pimd +========================== + +The default configuration file name of *pimd*'s is :file:`pimd.conf`. When +invoked *pimd* searches directory |INSTALL_PREFIX_ETC|. If +:file:`pimd.conf` is not there then next search current directory. + +*pimd* requires zebra for proper operation. Additionally *pimd* depends on +routing properly setup and working in the network that it is working on. + +:: + + # zebra -d + # pimd -d + + +Please note that *zebra* must be invoked before *pimd*. + +To stop *pimd* please use:: + + kill `cat /var/run/pimd.pid` + +Certain signals have special meanings to *pimd*. + ++---------+---------------------------------------------------------------------+ +| Signal | Meaning | ++=========+=====================================================================+ +| SIGUSR1 | Rotate the *pimd* logfile | ++---------+---------------------------------------------------------------------+ +| SIGINT | *pimd* sweeps all installed PIM mroutes then terminates gracefully. | +| SIGTERM | | ++---------+---------------------------------------------------------------------+ + +*pimd* invocation options. Common options that can be specified +(:ref:`common-invocation-options`). + +.. index:: ip pim rp A.B.C.D A.B.C.D/M +.. clicmd:: ip pim rp A.B.C.D A.B.C.D/M + + In order to use pim, it is necessary to configure a RP for join messages to + be sent to. Currently the only methodology to do this is via static rp + commands. All routers in the pim network must agree on these values. The + first ip address is the RP's address and the second value is the matching + prefix of group ranges covered. This command is vrf aware, to configure for + a vrf, enter the vrf submode. + +.. index:: ip pim spt-switchover infinity-and-beyond +.. clicmd:: ip pim spt-switchover infinity-and-beyond + + On the last hop router if it is desired to not switch over to the SPT tree. + Configure this command. This command is vrf aware, to configure for a vrf, + enter the vrf submode. + +.. index:: ip pim ecmp +.. clicmd:: ip pim ecmp + + If pim has the a choice of ECMP nexthops for a particular RPF, pim will + cause S,G flows to be spread out amongst the nexthops. If this command is + not specified then the first nexthop found will be used. This command is vrf + aware, to configure for a vrf, enter the vrf submode. + +.. index:: ip pim ecmp rebalance +.. clicmd:: ip pim ecmp rebalance + + If pim is using ECMP and an interface goes down, cause pim to rebalance all + S,G flows aross the remaining nexthops. If this command is not configured + pim only modifies those S,G flows that were using the interface that went + down. This command is vrf aware, to configure for a vrf, enter the vrf + submode. + +.. index:: ip pim join-prune-interval (60-600) +.. clicmd:: ip pim join-prune-interval (60-600) + + Modify the join/prune interval that pim uses to the new value. Time is + specified in seconds. This command is vrf aware, to configure for a vrf, + enter the vrf submode. + +.. index:: ip pim keep-alive-timer (31-60000) +.. clicmd:: ip pim keep-alive-timer (31-60000) + + Modify the time out value for a S,G flow from 31-60000 seconds. 31 seconds + is choosen for a lower bound because some hardware platforms cannot see data + flowing in better than 30 second chunks. This comand is vrf aware, to + configure for a vrf, enter the vrf submode. + +.. index:: ip pim packets (1-100) +.. clicmd:: ip pim packets (1-100) + + When processing packets from a neighbor process the number of packets + incoming at one time before moving on to the next task. The default value is + 3 packets. This command is only useful at scale when you can possibly have + a large number of pim control packets flowing. This command is vrf aware, to + configure for a vrf, enter the vrf submode. + +.. index:: ip pim register-suppress-time (5-60000) +.. clicmd:: ip pim register-suppress-time (5-60000) + + Modify the time that pim will register suppress a FHR will send register + notifications to the kernel. This command is vrf aware, to configure for a + vrf, enter the vrf submode. + +.. index:: ip pim send-v6-secondary +.. clicmd:: ip pim send-v6-secondary + + When sending pim hello packets tell pim to send any v6 secondary addresses + on the interface. This information is used to allow pim to use v6 nexthops + in it's decision for RPF lookup. This command is vrf aware, to configure for + a vrf, enter the vrf submode. + +.. index:: ip pim ssm prefix-list WORD +.. clicmd:: ip pim ssm prefix-list WORD + + Specify a range of group addresses via a prefix-list that forces pim to + never do SM over. This command is vrf aware, to configure for a vrf, enter + the vrf submode. + +.. index:: ip multicast rpf-lookup-mode WORD +.. clicmd:: ip multicast rpf-lookup-mode WORD + + Modify how PIM does RPF lookups in the zebra routing table. You can use + these choices: + + longer-prefix + Lookup the RPF in both tables using the longer prefix as a match + + lower-distance + Lookup the RPF in both tables using the lower distance as a match + + mrib-only + Lookup in the Multicast RIB only + + mrib-then-urib + Lookup in the Multicast RIB then the Unicast Rib, returning first found. + This is the default value for lookup if this command is not entered + + urib-only + Lookup in the Unicast Rib only. + + +.. _pim-interface-configuration: + +PIM Interface Configuration +=========================== + +PIM interface commands allow you to configure an interface as either a Receiver +or a interface that you would like to form pim neighbors on. If the interface +is in a vrf, enter the interface command with the vrf keyword at the end. + +.. index:: ip pim bfd +.. clicmd:: ip pim bfd + + Turns on BFD support for PIM for this interface. + +.. index:: ip pim drpriority (1-4294967295) +.. clicmd:: ip pim drpriority (1-4294967295) + + Set the DR Priority for the interface. This command is useful to allow the + user to influence what node becomes the DR for a lan segment. + +.. index:: ip pim hello (1-180) (1-180) +.. clicmd:: ip pim hello (1-180) (1-180) + + Set the pim hello and hold interval for a interface. + +.. index:: ip pim sm +.. clicmd:: ip pim sm + + Tell pim that we would like to use this interface to form pim neighbors + over. Please note we will *not* accept igmp reports over this interface with + this command. + +.. index:: ip igmp +.. clicmd:: ip igmp + + Tell pim to receive IGMP reports and Query on this interface. The default + version is v3. This command is useful on the LHR. + +.. index:: ip igmp query-interval (1-1800) +.. clicmd:: ip igmp query-interval (1-1800) + + Set the IGMP query interval that PIM will use. + +.. index:: ip igmp query-max-response-time (10-250) +.. clicmd:: ip igmp query-max-response-time (10-250) + + Set the IGMP query response timeout value. If an report is not returned in + the specified time we will assume the S,G or \*,G has timed out. + +.. index:: ip igmp version (2-3) +.. clicmd:: ip igmp version (2-3) + + Set the IGMP version used on this interface. The default value is 3. + +.. index:: ip multicat boundary oil WORD +.. clicmd:: ip multicat boundary oil WORD + + Set a pim multicast boundary, based upon the WORD prefix-list. If a pim join + or IGMP report is received on this interface and the Group is denyed by the + prefix-list, PIM will ignore the join or report. + +.. _pim-multicast-rib-insertion: + +PIM Multicast RIB insertion:: +============================= + +In order to influence Multicast RPF lookup, it is possible to insert +into zebra routes for the Multicast RIB. These routes are only +used for RPF lookup and will not be used by zebra for insertion +into the kernel *or* for normal rib processing. As such it is +possible to create weird states with these commands. Use with +caution. Most of the time this will not be necessary. + +.. index:: ip mroute A.B.C.D/M A.B.C.D (1-255) +.. clicmd:: ip mroute A.B.C.D/M A.B.C.D (1-255) + + Insert into the Multicast Rib Route A.B.C.D/M with specified nexthop. The + distance can be specified as well if desired. + +.. index:: ip mroute A.B.C.D/M INTERFACE (1-255) +.. clicmd:: ip mroute A.B.C.D/M INTERFACE (1-255) + + Insert into the Multicast Rib Route A.B.C.D/M using the specified INTERFACE. + The distance can be specified as well if desired. + +.. _show-pim-information: + +Show PIM Information +==================== + +All PIM show commands are vrf aware and typically allow you to insert a +specified vrf command if information is desired about a specific vrf. If no +vrf is specified then the default vrf is assumed. Finally the special keyword +'all' allows you to look at all vrfs for the command. Naming a vrf 'all' will +cause great confusion. + +.. index:: show ip multicast +.. clicmd:: show ip multicast + + Display various information about the interfaces used in this pim instance. + +.. index:: show ip mroute +.. clicmd:: show ip mroute + + Display information about installed into the kernel S,G mroutes. + +.. index:: show ip mroute count +.. clicmd:: show ip mroute count + + Display information about installed into the kernel S,G mroutes and in + addition display data about packet flow for the mroutes. + +.. index:: show ip pim assert +.. clicmd:: show ip pim assert + + Display information about asserts in the PIM system for S,G mroutes. + +.. index:: show ip pim assert-internal +.. clicmd:: show ip pim assert-internal + + Display internal assert state for S,G mroutes + +.. index:: show ip pim assert-metric +.. clicmd:: show ip pim assert-metric + + Display metric information about assert state for S,G mroutes + +.. index:: show ip pim assert-winner-metric +.. clicmd:: show ip pim assert-winner-metric + + Display winner metric for assert state for S,G mroutes + +.. index:: show ip pim group-type +.. clicmd:: show ip pim group-type + + Display SSM group ranges. + +.. index:: show ip pim interface +.. clicmd:: show ip pim interface + + Display information about interfaces PIM is using. + +.. index:: show ip pim join +.. clicmd:: show ip pim join + + Display information about PIM joins received. + +.. index:: show ip pim local-membership +.. clicmd:: show ip pim local-membership + + Display information about PIM interface local-membership. + +.. index:: show ip pim neighbor +.. clicmd:: show ip pim neighbor + + Display information about PIM neighbors. + +.. index:: show ip pim nexthop +.. clicmd:: show ip pim nexthop + + Display information about pim nexthops that are being used. + +.. index:: show ip pim nexthop-lookup +.. clicmd:: show ip pim nexthop-lookup + + Display information about a S,G pair and how the RPF would be choosen. This + is especially useful if there are ECMP's available from the RPF lookup. + +.. index:: show ip pim rp-info +.. clicmd:: show ip pim rp-info + + Display information about RP's that are configured on this router. + +.. index:: show ip pim rpf +.. clicmd:: show ip pim rpf + + Display information about currently being used S,G's and their RPF lookup + information. Additionally display some statistics about what has been + happening on the router. + +.. index:: show ip pim secondary +.. clicmd:: show ip pim secondary + + Display information about an interface and all the secondary addresses + associated with it. + +.. index:: show ip pim state +.. clicmd:: show ip pim state + + Display information about known S,G's and incoming interface as well as the + OIL and how they were choosen. + +.. index:: show ip pim upstream +.. clicmd:: show ip pim upstream + + Display upstream information about a S,G mroute. + +.. index:: show ip pim upstream-join-desired +.. clicmd:: show ip pim upstream-join-desired + +{show PIM Information} {show ip pim upstream-join-desired} {} + Display upstream information for S,G's and if we desire to + join the mcast tree + +.. index:: show ip pim upstream-rpf +.. clicmd:: show ip pim upstream-rpf + + Display upstream information for S,G's and the RPF data associated with them. + +.. index:: show ip rpf +.. clicmd:: show ip rpf + + Display the multicast RIB created in zebra. + +PIM Debug Commands +================== + +The debugging subsystem for PIM behaves in accordance with how FRR handles +debugging. You can specify debugging at the enable cli mode as well as the +configure cli mode. If you specify debug commands in the configuration cli +mode, the debug commands can be persistent across restarts of the FRR pimd if +the config was written out. + +.. index:: debug pim events +.. clicmd:: debug pim events + + This turns on debugging for PIM system events. Especially timers. + +.. index:: debug pim nht +.. clicmd:: debug pim nht + + This turns on debugging for PIM nexthop tracking. It will display + information about RPF lookups and information about when a nexthop changes. + +.. index:: debug pim packet-dump +.. clicmd:: debug pim packet-dump + + This turns on an extraordinary amount of data. Each pim packet sent and + received is dumped for debugging purposes. This should be considered a + developer only command. + +.. index:: debug pim packets +.. clicmd:: debug pim packets + + This turns on information about packet generation for sending and about + packet handling from a received packet. + +.. index:: debug pim trace +.. clicmd:: debug pim trace + + This traces pim code and how it is running. + +.. index:: debug pim zebra +.. clicmd:: debug pim zebra + + This gathers data about events from zebra that come up through the zapi. diff --git a/doc/user/protocol.rst b/doc/user/protocol.rst new file mode 100644 index 000000000..b474c126b --- /dev/null +++ b/doc/user/protocol.rst @@ -0,0 +1,122 @@ +.. _zebra-protocol: + +************** +Zebra Protocol +************** + +Overview of the Zebra Protocol +============================== + +Zebra Protocol is used by protocol daemons to communicate with the zebra +daemon. + +Each protocol daemon may request and send information to and from the zebra +daemon such as interface states, routing state, nexthop-validation, and so on. +Protocol daemons may also install routes with zebra. The zebra daemon manages +which route is installed into the forwarding table with the kernel. + +Zebra Protocol is a streaming protocol, with a common header. Two versions of +the header are in use. Version 0 is implicitely versioned. Version 1 has an +explicit version field. Version 0 can be distinguished from all other versions +by examining the 3rd byte of the header, which contains a marker value for all +versions bar version 0. The marker byte corresponds to the command field in +version 0, and the marker value is a reserved command in version 0. + +We do not anticipate there will be further versions of the header for the +foreseeable future, as the command field in version 1 is wide enough to allow +for future extensions to done compatibly through seperate commands. + +Version 0 is used by all versions of GNU Zebra as of this writing, and versions +of Quagga up to and including Quagga 0.98. Version 2 was created for 0.99.21 of +Quagga. Version 3 designates VRF compatibility and was released in 1.0. +Version 4 will be used as of FRR 2.0 to indicate that we are a different +Routing Suite now and to hopefully prevent accidental Quagga <-> FRR issues. + +Zebra Protocol Definition +========================= + +Zebra Protocol Header (version 0) +---------------------------------- + +:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-------------------------------+---------------+ + | Length (2) | Command (1) | + +-------------------------------+---------------+ + + +Zebra Protocol Common Header (version 1) +---------------------------------------- + +:: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + +-------------------------------+---------------+-------------+ + | Length (2) | Marker (1) | Version (1) | + +-------------------------------+---------------+-------------+ + | Command (2) | + +-------------------------------+ + + +Zebra Protocol Header Field Definitions +--------------------------------------- + +Length + Total packet length including this header. The minimum length is 3 bytes for + version 0 messages and 6 bytes for version 1 messages. + +Marker + Static marker with a value of 255 always. This is to allow version 0 Zserv + headers (which do not include version explicitly) to be distinguished from + versioned headers. Not present in version 0 messages. + +Version + Version number of the Zserv message. Clients should not continue processing + messages past the version field for versions they do not recognise. Not + present in version 0 messages. + +Command + The Zebra Protocol command. + + +Zebra Protocol Commands +----------------------- + ++-----------------------------------+-------+ +| Command | Value | ++===================================+=======+ +| ZEBRA_INTERFACE_ADD | 1 | ++-----------------------------------+-------+ +| ZEBRA_INTERFACE_DELETE | 2 | ++-----------------------------------+-------+ +| ZEBRA_INTERFACE_ADDRESS_ADD | 3 | ++-----------------------------------+-------+ +| ZEBRA_INTERFACE_ADDRESS_DELETE | 4 | ++-----------------------------------+-------+ +| ZEBRA_INTERFACE_UP | 5 | ++-----------------------------------+-------+ +| ZEBRA_INTERFACE_DOWN | 6 | ++-----------------------------------+-------+ +| ZEBRA_IPV4_ROUTE_ADD | 7 | ++-----------------------------------+-------+ +| ZEBRA_IPV4_ROUTE_DELETE | 8 | ++-----------------------------------+-------+ +| ZEBRA_IPV6_ROUTE_ADD | 9 | ++-----------------------------------+-------+ +| ZEBRA_IPV6_ROUTE_DELETE | 10 | ++-----------------------------------+-------+ +| ZEBRA_REDISTRIBUTE_ADD | 11 | ++-----------------------------------+-------+ +| ZEBRA_REDISTRIBUTE_DELETE | 12 | ++-----------------------------------+-------+ +| ZEBRA_REDISTRIBUTE_DEFAULT_ADD | 13 | ++-----------------------------------+-------+ +| ZEBRA_REDISTRIBUTE_DEFAULT_DELETE | 14 | ++-----------------------------------+-------+ +| ZEBRA_IPV4_NEXTHOP_LOOKUP | 15 | ++-----------------------------------+-------+ +| ZEBRA_IPV6_NEXTHOP_LOOKUP | 16 | ++-----------------------------------+-------+ diff --git a/doc/user/ripd.rst b/doc/user/ripd.rst new file mode 100644 index 000000000..b8cbd161c --- /dev/null +++ b/doc/user/ripd.rst @@ -0,0 +1,695 @@ +.. _rip: + +*** +RIP +*** + +RIP -- Routing Information Protocol is widely deployed interior gateway +protocol. RIP was developed in the 1970s at Xerox Labs as part of the +XNS routing protocol. RIP is a :term:`distance-vector` protocol and is +based on the :term:`Bellman-Ford` algorithms. As a distance-vector +protocol, RIP router send updates to its neighbors periodically, thus +allowing the convergence to a known topology. In each update, the +distance to any given network will be broadcasted to its neighboring +router. + +*ripd* supports RIP version 2 as described in RFC2453 and RIP +version 1 as described in RFC1058. + +.. _starting-and-stopping-ripd: + +Starting and Stopping ripd +========================== + +The default configuration file name of *ripd*'s is :file:`ripd.conf`. When +invocation *ripd* searches directory |INSTALL_PREFIX_ETC|. If :file:`ripd.conf` +is not there next search current directory. + +RIP uses UDP port 520 to send and receive RIP packets. So the user must have +the capability to bind the port, generally this means that the user must have +superuser privileges. RIP protocol requires interface information maintained by +*zebra* daemon. So running *zebra* is mandatory to run *ripd*. Thus minimum +sequence for running RIP is like below: + +:: + + # zebra -d + # ripd -d + + +Please note that *zebra* must be invoked before *ripd*. + +To stop *ripd*. Please use:: + kill `cat /var/run/ripd.pid` + +Certain signals have special meaningss to *ripd*. + + +-------------+------------------------------------------------------+ + | Signal | Action | + +=============+======================================================+ + | ``SIGHUP`` | Reload configuration file :file:`ripd.conf`. | + | | All configurations are reset. All routes learned | + | | so far are cleared and removed from routing table. | + +-------------+------------------------------------------------------+ + | ``SIGUSR1`` | Rotate the *ripd* logfile. | + +-------------+------------------------------------------------------+ + | ``SIGINT`` | | + | ``SIGTERM`` | Sweep all installed routes and gracefully terminate. | + +-------------+------------------------------------------------------+ + +*ripd* invocation options. Common options that can be specified +(:ref:`common-invocation-options`). + +.. option:: -r +.. option:: --retain + + When the program terminates, retain routes added by *ripd*. + +.. _rip-netmask: + +RIP netmask +----------- + +The netmask features of *ripd* support both version 1 and version 2 of RIP. +Version 1 of RIP originally contained no netmask information. In RIP version 1, +network classes were originally used to determine the size of the netmask. +Class A networks use 8 bits of mask, Class B networks use 16 bits of masks, +while Class C networks use 24 bits of mask. Today, the most widely used method +of a network mask is assigned to the packet on the basis of the interface that +received the packet. Version 2 of RIP supports a variable length subnet mask +(VLSM). By extending the subnet mask, the mask can be divided and reused. Each +subnet can be used for different purposes such as large to middle size LANs and +WAN links. FRR *ripd* does not support the non-sequential netmasks that are +included in RIP Version 2. + +In a case of similar information with the same prefix and metric, the old +information will be suppressed. Ripd does not currently support equal cost +multipath routing. + +.. _rip-configuration: + +RIP Configuration +================= + +.. index:: router rip +.. clicmd:: router rip + + The `router rip` command is necessary to enable RIP. To disable RIP, use the + `no router rip` command. RIP must be enabled before carrying out any of the + RIP commands. + +.. index:: no router rip +.. clicmd:: no router rip + + Disable RIP. + +.. index:: network NETWORK +.. clicmd:: network NETWORK + +.. index:: no network NETWORK +.. clicmd:: no network NETWORK + + Set the RIP enable interface by NETWORK. The interfaces which have addresses + matching with NETWORK are enabled. + + This group of commands either enables or disables RIP interfaces between + certain numbers of a specified network address. For example, if the network + for 10.0.0.0/24 is RIP enabled, this would result in all the addresses from + 10.0.0.0 to 10.0.0.255 being enabled for RIP. The `no network` command will + disable RIP for the specified network. + +.. index:: network IFNAME +.. clicmd:: network IFNAME + +.. index:: no network IFNAME +.. clicmd:: no network IFNAME + + Set a RIP enabled interface by IFNAME. Both the sending and + receiving of RIP packets will be enabled on the port specified in the + `network ifname` command. The `no network ifname` command will disable + RIP on the specified interface. + +.. index:: neighbor A.B.C.D +.. clicmd:: neighbor A.B.C.D + +.. index:: no neighbor A.B.C.D +.. clicmd:: no neighbor A.B.C.D + + Specify RIP neighbor. When a neighbor doesn't understand multicast, this + command is used to specify neighbors. In some cases, not all routers will be + able to understand multicasting, where packets are sent to a network or a + group of addresses. In a situation where a neighbor cannot process multicast + packets, it is necessary to establish a direct link between routers. The + neighbor command allows the network administrator to specify a router as a + RIP neighbor. The `no neighbor a.b.c.d` command will disable the RIP + neighbor. + + Below is very simple RIP configuration. Interface `eth0` and interface which + address match to `10.0.0.0/8` are RIP enabled. + + :: + + ! + router rip + network 10.0.0.0/8 + network eth0 + ! + + +.. index:: passive-interface (IFNAME|default) +.. clicmd:: passive-interface (IFNAME|default) + +.. index:: no passive-interface IFNAME +.. clicmd:: no passive-interface IFNAME + + This command sets the specified interface to passive mode. On passive mode + interface, all receiving packets are processed as normal and ripd does not + send either multicast or unicast RIP packets except to RIP neighbors + specified with `neighbor` command. The interface may be specified as + `default` to make ripd default to passive on all interfaces. + + The default is to be passive on all interfaces. + +.. index:: ip split-horizon +.. clicmd:: ip split-horizon + +.. index:: no ip split-horizon +.. clicmd:: no ip split-horizon + + Control split-horizon on the interface. Default is `ip split-horizon`. If + you don't perform split-horizon on the interface, please specify `no ip + split-horizon`. + +.. _rip-version-control: + +RIP Version Control +=================== + +RIP can be configured to send either Version 1 or Version 2 packets. The +default is to send RIPv2 while accepting both RIPv1 and RIPv2 (and replying +with packets of the appropriate version for REQUESTS / triggered updates). The +version to receive and send can be specified globally, and further overriden on +a per-interface basis if needs be for send and receive seperately (see below). + +It is important to note that RIPv1 cannot be authenticated. Further, if RIPv1 +is enabled then RIP will reply to REQUEST packets, sending the state of its RIP +routing table to any remote routers that ask on demand. For a more detailed +discussion on the security implications of RIPv1 see :ref:`rip-authentication`. + +.. index:: version VERSION +.. clicmd:: version VERSION + + Set RIP version to accept for reads and send. ``VERSION`` can be either 1 or + 1. + + Disabling RIPv1 by specifying version 2 is STRONGLY encouraged, + :ref:`rip-authentication`. This may become the default in a future release. + + Default: Send Version 2, and accept either version. + +.. index:: no version +.. clicmd:: no version + + Reset the global version setting back to the default. + +.. index:: ip rip send version VERSION +.. clicmd:: ip rip send version VERSION + + VERSION can be ``1``, ``2``, or ``1 2``. + + This interface command overrides the global rip version setting, and selects + which version of RIP to send packets with, for this interface specifically. + Choice of RIP Version 1, RIP Version 2, or both versions. In the latter + case, where ``1 2`` is specified, packets will be both broadcast and + multicast. + + Default: Send packets according to the global version (version 2) + +.. index:: ip rip receive version VERSION +.. clicmd:: ip rip receive version VERSION + + VERSION can be ``1``, ``2``, or ``1 2``. + + This interface command overrides the global rip version setting, and selects + which versions of RIP packets will be accepted on this interface. Choice of + RIP Version 1, RIP Version 2, or both. + + Default: Accept packets according to the global setting (both 1 and 2). + +.. _how-to-announce-rip-route: + +How to Announce RIP route +========================= + +.. index:: redistribute kernel +.. clicmd:: redistribute kernel + +.. index:: redistribute kernel metric (0-16) +.. clicmd:: redistribute kernel metric (0-16) + +.. index:: redistribute kernel route-map ROUTE-MAP +.. clicmd:: redistribute kernel route-map ROUTE-MAP + +.. index:: no redistribute kernel +.. clicmd:: no redistribute kernel + + `redistribute kernel` redistributes routing information from kernel route + entries into the RIP tables. `no redistribute kernel` disables the routes. + +.. index:: redistribute static +.. clicmd:: redistribute static + +.. index:: redistribute static metric (0-16) +.. clicmd:: redistribute static metric (0-16) + +.. index:: redistribute static route-map ROUTE-MAP +.. clicmd:: redistribute static route-map ROUTE-MAP + +.. index:: no redistribute static +.. clicmd:: no redistribute static + + `redistribute static` redistributes routing information from static route + entries into the RIP tables. `no redistribute static` disables the routes. + +.. index:: redistribute connected +.. clicmd:: redistribute connected + +.. index:: redistribute connected metric (0-16) +.. clicmd:: redistribute connected metric (0-16) + +.. index:: redistribute connected route-map ROUTE-MAP +.. clicmd:: redistribute connected route-map ROUTE-MAP + +.. index:: no redistribute connected +.. clicmd:: no redistribute connected + + Redistribute connected routes into the RIP tables. `no redistribute + connected` disables the connected routes in the RIP tables. This command + redistribute connected of the interface which RIP disabled. The connected + route on RIP enabled interface is announced by default. + +.. index:: redistribute ospf +.. clicmd:: redistribute ospf + +.. index:: redistribute ospf metric (0-16) +.. clicmd:: redistribute ospf metric (0-16) + +.. index:: redistribute ospf route-map ROUTE-MAP +.. clicmd:: redistribute ospf route-map ROUTE-MAP + +.. index:: no redistribute ospf +.. clicmd:: no redistribute ospf + + `redistribute ospf` redistributes routing information from ospf route + entries into the RIP tables. `no redistribute ospf` disables the routes. + +.. index:: redistribute bgp +.. clicmd:: redistribute bgp + +.. index:: redistribute bgp metric (0-16) +.. clicmd:: redistribute bgp metric (0-16) + +.. index:: redistribute bgp route-map ROUTE-MAP +.. clicmd:: redistribute bgp route-map ROUTE-MAP + +.. index:: no redistribute bgp +.. clicmd:: no redistribute bgp + + `redistribute bgp` redistributes routing information from bgp route entries + into the RIP tables. `no redistribute bgp` disables the routes. + + If you want to specify RIP only static routes: + +.. index:: default-information originate +.. clicmd:: default-information originate + +.. index:: route A.B.C.D/M +.. clicmd:: route A.B.C.D/M + +.. index:: no route A.B.C.D/M +.. clicmd:: no route A.B.C.D/M + + This command is specific to FRR. The `route` command makes a static route + only inside RIP. This command should be used only by advanced users who are + particularly knowledgeable about the RIP protocol. In most cases, we + recommend creating a static route in FRR and redistributing it in RIP using + `redistribute static`. + +.. _filtering-rip-routes: + +Filtering RIP Routes +==================== + +RIP routes can be filtered by a distribute-list. + +.. index:: distribute-list ACCESS_LIST DIRECT IFNAME +.. clicmd:: distribute-list ACCESS_LIST DIRECT IFNAME + + You can apply access lists to the interface with a `distribute-list` command. + ACCESS_LIST is the access list name. DIRECT is ``in`` or ``out``. If DIRECT + is ``in`` the access list is applied to input packets. + + The `distribute-list` command can be used to filter the RIP path. + `distribute-list` can apply access-lists to a chosen interface. First, one + should specify the access-list. Next, the name of the access-list is used in + the distribute-list command. For example, in the following configuration + ``eth0`` will permit only the paths that match the route 10.0.0.0/8 + + :: + + ! + router rip + distribute-list private in eth0 + ! + access-list private permit 10 10.0.0.0/8 + access-list private deny any + ! + + + `distribute-list` can be applied to both incoming and outgoing data. + +.. index:: distribute-list prefix PREFIX_LIST (in|out) IFNAME +.. clicmd:: distribute-list prefix PREFIX_LIST (in|out) IFNAME + + You can apply prefix lists to the interface with a `distribute-list` + command. PREFIX_LIST is the prefix list name. Next is the direction of + ``in`` or ``out``. If DIRECT is ``in`` the access list is applied to input + packets. + +.. _rip-metric-manipulation: + +RIP Metric Manipulation +======================= + +RIP metric is a value for distance for the network. Usually +*ripd* increment the metric when the network information is +received. Redistributed routes' metric is set to 1. + +.. index:: default-metric (1-16) +.. clicmd:: default-metric (1-16) + +.. index:: no default-metric (1-16) +.. clicmd:: no default-metric (1-16) + + This command modifies the default metric value for redistributed routes. + The default value is 1. This command does not affect connected route even if + it is redistributed by *redistribute connected*. To modify connected route's + metric value, please use ``redistribute connected metric`` or *route-map*. + *offset-list* also affects connected routes. + +.. index:: offset-list ACCESS-LIST (in|out) +.. clicmd:: offset-list ACCESS-LIST (in|out) + +.. index:: offset-list ACCESS-LIST (in|out) IFNAME +.. clicmd:: offset-list ACCESS-LIST (in|out) IFNAME + + +.. _rip-distance: + +RIP distance +============ + +Distance value is used in zebra daemon. Default RIP distance is 120. + +.. index:: distance (1-255) +.. clicmd:: distance (1-255) + +.. index:: no distance (1-255) +.. clicmd:: no distance (1-255) + + Set default RIP distance to specified value. + +.. index:: distance (1-255) A.B.C.D/M +.. clicmd:: distance (1-255) A.B.C.D/M + +.. index:: no distance (1-255) A.B.C.D/M +.. clicmd:: no distance (1-255) A.B.C.D/M + + Set default RIP distance to specified value when the route's source IP + address matches the specified prefix. + +.. index:: distance (1-255) A.B.C.D/M ACCESS-LIST +.. clicmd:: distance (1-255) A.B.C.D/M ACCESS-LIST + +.. index:: no distance (1-255) A.B.C.D/M ACCESS-LIST +.. clicmd:: no distance (1-255) A.B.C.D/M ACCESS-LIST + + Set default RIP distance to specified value when the route's source IP + address matches the specified prefix and the specified access-list. + +.. _rip-route-map: + +RIP route-map +============= + +Usage of *ripd*'s route-map support. + +Optional argument route-map MAP_NAME can be added to each `redistribute` +statement. + +:: + + redistribute static [route-map MAP_NAME] + redistribute connected [route-map MAP_NAME] + ..... + + +Cisco applies route-map _before_ routes will exported to rip route table. In +current FRR's test implementation, *ripd* applies route-map after routes are +listed in the route table and before routes will be announced to an interface +(something like output filter). I think it is not so clear, but it is draft and +it may be changed at future. + +Route-map statement (:ref:`route-map`) is needed to use route-map +functionality. + +.. index:: match interface WORD +.. clicmd:: match interface WORD + + This command match to incoming interface. Notation of this match is + different from Cisco. Cisco uses a list of interfaces - NAME1 NAME2 ... + NAMEN. Ripd allows only one name (maybe will change in the future). Next - + Cisco means interface which includes next-hop of routes (it is somewhat + similar to "ip next-hop" statement). Ripd means interface where this route + will be sent. This difference is because "next-hop" of same routes which + sends to different interfaces must be different. Maybe it'd be better to + made new matches - say "match interface-out NAME" or something like that. + +.. index:: match ip address WORD +.. clicmd:: match ip address WORD + +.. index:: match ip address prefix-list WORD +.. clicmd:: match ip address prefix-list WORD + + Match if route destination is permitted by access-list. + +.. index:: match ip next-hop WORD +.. clicmd:: match ip next-hop WORD + +.. index:: match ip next-hop prefix-list WORD +.. clicmd:: match ip next-hop prefix-list WORD + + Match if route next-hop (meaning next-hop listed in the rip route-table as + displayed by "show ip rip") is permitted by access-list. + +.. index:: match metric (0-4294967295) +.. clicmd:: match metric (0-4294967295) + + This command match to the metric value of RIP updates. For other protocol + compatibility metric range is shown as (0-4294967295). But for RIP protocol + only the value range (0-16) make sense. + +.. index:: set ip next-hop A.B.C.D +.. clicmd:: set ip next-hop A.B.C.D + + This command set next hop value in RIPv2 protocol. This command does not + affect RIPv1 because there is no next hop field in the packet. + +.. index:: set metric (0-4294967295) +.. clicmd:: set metric (0-4294967295) + + Set a metric for matched route when sending announcement. The metric value + range is very large for compatibility with other protocols. For RIP, valid + metric values are from 1 to 16. + +.. _rip-authentication: + +RIP Authentication +================== + +RIPv2 allows packets to be authenticated via either an insecure plain +text password, included with the packet, or via a more secure MD5 based +:abbr:`HMAC (keyed-Hashing for Message AuthentiCation)`, +RIPv1 can not be authenticated at all, thus when authentication is +configured `ripd` will discard routing updates received via RIPv1 +packets. + +However, unless RIPv1 reception is disabled entirely, +:ref:`rip-version-control`, RIPv1 REQUEST packets which are received, +which query the router for routing information, will still be honoured +by `ripd`, and `ripd` WILL reply to such packets. This allows +`ripd` to honour such REQUESTs (which sometimes is used by old +equipment and very simple devices to bootstrap their default route), +while still providing security for route updates which are received. + +In short: Enabling authentication prevents routes being updated by +unauthenticated remote routers, but still can allow routes (I.e. the +entire RIP routing table) to be queried remotely, potentially by anyone +on the internet, via RIPv1. + +To prevent such unauthenticated querying of routes disable RIPv1, +:ref:`rip-version-control`. + +.. index:: ip rip authentication mode md5 +.. clicmd:: ip rip authentication mode md5 + +.. index:: no ip rip authentication mode md5 +.. clicmd:: no ip rip authentication mode md5 + + Set the interface with RIPv2 MD5 authentication. + +.. index:: ip rip authentication mode text +.. clicmd:: ip rip authentication mode text + +.. index:: no ip rip authentication mode text +.. clicmd:: no ip rip authentication mode text + + Set the interface with RIPv2 simple password authentication. + +.. index:: ip rip authentication string STRING +.. clicmd:: ip rip authentication string STRING + +.. index:: no ip rip authentication string STRING +.. clicmd:: no ip rip authentication string STRING + + RIP version 2 has simple text authentication. This command sets + authentication string. The string must be shorter than 16 characters. + +.. index:: ip rip authentication key-chain KEY-CHAIN +.. clicmd:: ip rip authentication key-chain KEY-CHAIN + +.. index:: no ip rip authentication key-chain KEY-CHAIN +.. clicmd:: no ip rip authentication key-chain KEY-CHAIN + + Specifiy Keyed MD5 chain. + +:: + + ! + key chain test + key 1 + key-string test + ! + interface eth1 + ip rip authentication mode md5 + ip rip authentication key-chain test + ! + + +.. _rip-timers: + +RIP Timers +========== + +.. index:: timers basic UPDATE TIMEOUT GARBAGE +.. clicmd:: timers basic UPDATE TIMEOUT GARBAGE + + + RIP protocol has several timers. User can configure those timers' values + by `timers basic` command. + + The default settings for the timers are as follows: + + - The update timer is 30 seconds. Every update timer seconds, the RIP + process is awakened to send an unsolicited Response message containing + the complete routing table to all neighboring RIP routers. + - The timeout timer is 180 seconds. Upon expiration of the timeout, the + route is no longer valid; however, it is retained in the routing table + for a short time so that neighbors can be notified that the route has + been dropped. + - The garbage collect timer is 120 seconds. Upon expiration of the + garbage-collection timer, the route is finally removed from the routing + table. + + The ``timers basic`` command allows the the default values of the timers + listed above to be changed. + +.. index:: no timers basic +.. clicmd:: no timers basic + + The `no timers basic` command will reset the timers to the default settings + listed above. + +.. _show-rip-information: + +Show RIP Information +==================== + +To display RIP routes. + +.. index:: show ip rip +.. clicmd:: show ip rip + + Show RIP routes. + +The command displays all RIP routes. For routes that are received +through RIP, this command will display the time the packet was sent and +the tag information. This command will also display this information +for routes redistributed into RIP. + +.. index:: show ip rip status +.. clicmd:: show ip rip status + + The command displays current RIP status. It includes RIP timer, + filtering, version, RIP enabled interface and RIP peer inforation. + +:: + + ripd> **show ip rip status** + Routing Protocol is "rip" + Sending updates every 30 seconds with +/-50%, next due in 35 seconds + Timeout after 180 seconds, garbage collect after 120 seconds + Outgoing update filter list for all interface is not set + Incoming update filter list for all interface is not set + Default redistribution metric is 1 + Redistributing: kernel connected + Default version control: send version 2, receive version 2 + Interface Send Recv + Routing for Networks: + eth0 + eth1 + 1.1.1.1 + 203.181.89.241 + Routing Information Sources: + Gateway BadPackets BadRoutes Distance Last Update + + +RIP Debug Commands +================== + +Debug for RIP protocol. + +.. index:: debug rip events +.. clicmd:: debug rip events + + Shows RIP events. Sending and receiving packets, timers, and changes in + interfaces are events shown with *ripd*. + +.. index:: debug rip packet +.. clicmd:: debug rip packet + + Shows display detailed information about the RIP packets. The origin and + port number of the packet as well as a packet dump is shown. + +.. index:: debug rip zebra +.. clicmd:: debug rip zebra + + This command will show the communication between *ripd* and *zebra*. The + main information will include addition and deletion of paths to the kernel + and the sending and receiving of interface information. + +.. index:: show debugging rip +.. clicmd:: show debugging rip + + Shows all information currently set for ripd debug. + diff --git a/doc/user/ripngd.rst b/doc/user/ripngd.rst new file mode 100644 index 000000000..ae2400f0b --- /dev/null +++ b/doc/user/ripngd.rst @@ -0,0 +1,89 @@ +.. _ripng: + +***** +RIPng +***** + +*ripngd* supports the RIPng protocol as described in :rfc:`2080`. It's an IPv6 +reincarnation of the RIP protocol. + +.. _invoking-ripngd: + +Invoking ripngd +=============== + +There are no `ripngd` specific invocation options. Common options can be +specified (:ref:`common-invocation-options`). + +.. _ripngd-configuration: + +ripngd Configuration +==================== + +Currently ripngd supports the following commands: + +.. index:: router ripng +.. clicmd:: router ripng + + Enable RIPng. + +.. index:: flush_timer TIME +.. clicmd:: flush_timer TIME + + Set flush timer. + +.. index:: network NETWORK +.. clicmd:: network NETWORK + + Set RIPng enabled interface by NETWORK. + +.. index:: network IFNAME +.. clicmd:: network IFNAME + + Set RIPng enabled interface by IFNAME. + +.. index:: route NETWORK +.. clicmd:: route NETWORK + + Set RIPng static routing announcement of NETWORK. + +.. index:: router zebra +.. clicmd:: router zebra + + This command is the default and does not appear in the configuration. With + this statement, RIPng routes go to the *zebra* daemon. + +.. _ripngd-terminal-mode-commands: + +ripngd Terminal Mode Commands +============================= + +.. index:: show ip ripng +.. clicmd:: show ip ripng + +.. index:: show debugging ripng +.. clicmd:: show debugging ripng + +.. index:: debug ripng events +.. clicmd:: debug ripng events + +.. index:: debug ripng packet +.. clicmd:: debug ripng packet + +.. index:: debug ripng zebra +.. clicmd:: debug ripng zebra + + +ripngd Filtering Commands +========================= + +.. index:: distribute-list ACCESS_LIST (in|out) IFNAME +.. clicmd:: distribute-list ACCESS_LIST (in|out) IFNAME + + You can apply an access-list to the interface using the `distribute-list` + command. ACCESS_LIST is an access-list name. `direct` is ``in`` or + ``out``. If `direct` is ``in``, the access-list is applied only to incoming + packets.:: + + distribute-list local-only out sit1 + diff --git a/doc/user/routemap.rst b/doc/user/routemap.rst new file mode 100644 index 000000000..acf63a612 --- /dev/null +++ b/doc/user/routemap.rst @@ -0,0 +1,287 @@ +.. _route-map: + +********** +Route Maps +********** + +Route maps provide a means to both filter and/or apply actions to route, hence +allowing policy to be applied to routes. + +Route maps are an ordered list of route map entries. Each entry may specify up +to four distincts sets of clauses: + +.. glossary:: + + Matching Conditions + A route-map entry may, optionally, specify one or more conditions which + must be matched if the entry is to be considered further, as governed by + the Match Policy. If a route-map entry does not explicitely specify any + matching conditions, then it always matches. + + Set Actions + A route-map entry may, optionally, specify one or more Set Actions to set + or modify attributes of the route. + + Matching Policy + This specifies the policy implied if the :term:`Matching Conditions` are + met or not met, and which actions of the route-map are to be taken, if + any. The two possibilities are: + + - :dfn:`permit`: If the entry matches, then carry out the + :term:`Set Actions`. Then finish processing the route-map, permitting + the route, unless an :term:`Exit Policy` action indicates otherwise. + + - :dfn:`deny`: If the entry matches, then finish processing the route-map and + deny the route (return `deny`). + + The `Matching Policy` is specified as part of the command which defines + the ordered entry in the route-map. See below. + + Call Action + Call to another route-map, after any :term:`Set Actions` have been carried out. + If the route-map called returns `deny` then processing of the route-map + finishes and the route is denied, regardless of the :term:Matching Policy` or + the :term:`Exit Policy`. If the called route-map returns `permit`, then + :term:`Matching Policy` and :term:`Exit Policy` govern further behaviour, as normal. + + Exit Policy + An entry may, optionally, specify an alternative :dfn:`Exit Policy` to + take if the entry matched, rather than the normal policy of exiting the + route-map and permitting the route. The two possibilities are: + + - :dfn:`next`: Continue on with processing of the route-map entries. + + - :dfn:`goto N`: Jump ahead to the first route-map entry whose order in + the route-map is >= N. Jumping to a previous entry is not permitted. + +The default action of a route-map, if no entries match, is to deny. I.e. a +route-map essentially has as its last entry an empty *deny* entry, which +matches all routes. To change this behaviour, one must specify an empty +*permit* entry as the last entry in the route-map. + +To summarise the above: + ++--------+--------+----------+ +| | Match | No Match | ++========+========+==========+ +| Permit | action | cont | ++--------+--------+----------+ +| Deny | deny | cont | ++--------+--------+----------+ + +action + - Apply *set* statements + - If *call* is present, call given route-map. If that returns a ``deny``, + finish processing and return ``deny``. + - If *Exit Policy* is *next*, goto next route-map entry + - If *Exit Policy* is *goto*, goto first entry whose order in the + list is >= the given order. + - Finish processing the route-map and permit the route. + +deny + The route is denied by the route-map (return ``deny``). + +cont + goto next route-map entry + +.. _route-map-command: + +Route Map Command +================= + +.. index:: route-map ROUTE-MAP-NAME (permit|deny) ORDER +.. clicmd:: route-map ROUTE-MAP-NAME (permit|deny) ORDER + + Configure the `order`'th entry in `route-map-name` with ``Match Policy`` of + either *permit* or *deny*. + +.. _route-map-match-command: + +Route Map Match Command +======================= + +.. index:: match ip address ACCESS_LIST +.. clicmd:: match ip address ACCESS_LIST + + Matches the specified `access_list` + +.. index:: match ip address PREFIX-LIST +.. clicmd:: match ip address PREFIX-LIST + + Matches the specified `prefix-list` + +.. index:: match ip address prefix-len 0-32 +.. clicmd:: match ip address prefix-len 0-32 + + Matches the specified `prefix-len`. This is a Zebra specific command. + +.. index:: match ipv6 address ACCESS_LIST +.. clicmd:: match ipv6 address ACCESS_LIST + + Matches the specified `access_list` + +.. index:: match ipv6 address PREFIX-LIST +.. clicmd:: match ipv6 address PREFIX-LIST + + Matches the specified `prefix-list` + +.. index:: match ipv6 address prefix-len 0-128 +.. clicmd:: match ipv6 address prefix-len 0-128 + + Matches the specified `prefix-len`. This is a Zebra specific command. + +.. index:: match ip next-hop IPV4_ADDR +.. clicmd:: match ip next-hop IPV4_ADDR + + Matches the specified `ipv4_addr`. + +.. index:: match aspath AS_PATH +.. clicmd:: match aspath AS_PATH + + Matches the specified `as_path`. + +.. index:: match metric METRIC +.. clicmd:: match metric METRIC + + Matches the specified `metric`. + +.. index:: match tag TAG +.. clicmd:: match tag TAG + + Matches the specified tag value associated with the route. This tag value + can be in the range of (1-4294967295). + +.. index:: match local-preference METRIC +.. clicmd:: match local-preference METRIC + + Matches the specified `local-preference`. + +.. index:: match community COMMUNITY_LIST +.. clicmd:: match community COMMUNITY_LIST + + Matches the specified `community_list` + +.. index:: match peer IPV4_ADDR +.. clicmd:: match peer IPV4_ADDR + + This is a BGP specific match command. Matches the peer ip address + if the neighbor was specified in this manner. + +.. index:: match peer IPV6_ADDR +.. clicmd:: match peer IPV6_ADDR + + This is a BGP specific match command. Matches the peer ipv6 + address if the neighbor was specified in this manner. + +.. index:: match peer INTERFACE_NAME +.. clicmd:: match peer INTERFACE_NAME + + This is a BGP specific match command. Matches the peer + interface name specified if the neighbor was specified + in this manner. + +.. _route-map-set-command: + +Route Map Set Command +===================== + +.. program:: configure + +.. index:: set tag TAG +.. clicmd:: set tag TAG + + Set a tag on the matched route. This tag value can be from (1-4294967295). + Additionally if you have compiled with the :option:`--enable-realms` + configure option. Tag values from (1-255) are sent to the Linux kernel as a + realm value. Then route policy can be applied. See the tc man page. + +.. index:: set ip next-hop IPV4_ADDRESS +.. clicmd:: set ip next-hop IPV4_ADDRESS + + Set the BGP nexthop address. + +.. index:: set local-preference LOCAL_PREF +.. clicmd:: set local-preference LOCAL_PREF + + Set the BGP local preference to `local_pref`. + +.. index:: set weight WEIGHT +.. clicmd:: set weight WEIGHT + + Set the route's weight. + +.. index:: set metric METRIC +.. clicmd:: set metric METRIC + + Set the BGP attribute MED. + +.. index:: set as-path prepend AS_PATH +.. clicmd:: set as-path prepend AS_PATH + + Set the BGP AS path to prepend. + +.. index:: set community COMMUNITY +.. clicmd:: set community COMMUNITY + + Set the BGP community attribute. + +.. index:: set ipv6 next-hop global IPV6_ADDRESS +.. clicmd:: set ipv6 next-hop global IPV6_ADDRESS + + Set the BGP-4+ global IPv6 nexthop address. + +.. index:: set ipv6 next-hop local IPV6_ADDRESS +.. clicmd:: set ipv6 next-hop local IPV6_ADDRESS + + Set the BGP-4+ link local IPv6 nexthop address. + +.. _route-map-call-command: + +Route Map Call Command +====================== + +.. index:: call NAME +.. clicmd:: call NAME + + Call route-map `name`. If it returns deny, deny the route and + finish processing the route-map. + +.. _route-map-exit-action-command: + +Route Map Exit Action Command +============================= + +.. index:: on-match next +.. clicmd:: on-match next + +.. index:: continue +.. clicmd:: continue + + Proceed on to the next entry in the route-map. + +.. index:: on-match goto N +.. clicmd:: on-match goto N + +.. index:: continue N +.. clicmd:: continue N + + Proceed processing the route-map at the first entry whose order is >= N + +Route Map Examples +================== + +A simple example of a route-map: + +:: + + route-map test permit 10 + match ip address 10 + set local-preference 200 + + +This means that if a route matches ip access-list number 10 it's +local-preference value is set to 200. + +See :ref:`bgp-configuration-examples` for examples of more sophisticated +useage of route-maps, including of the ``call`` action. + diff --git a/doc/user/routeserver.rst b/doc/user/routeserver.rst new file mode 100644 index 000000000..890897bb6 --- /dev/null +++ b/doc/user/routeserver.rst @@ -0,0 +1,550 @@ +.. _configuring-frr-as-a-route-server: + +Configuring FRR as a Route Server +================================= + +The purpose of a Route Server is to centralize the peerings between BGP +speakers. For example if we have an exchange point scenario with four BGP +speakers, each of which maintaining a BGP peering with the other three +(:ref:`fig-topologies-full`), we can convert it into a centralized scenario where +each of the four establishes a single BGP peering against the Route Server +(:ref:`fig-topologies-rs`). + +We will first describe briefly the Route Server model implemented by FRR. +We will explain the commands that have been added for configuring that +model. And finally we will show a full example of FRR configured as Route +Server. + +.. _description-of-the-route-server-model: + +Description of the Route Server model +------------------------------------- + +First we are going to describe the normal processing that BGP announcements +suffer inside a standard BGP speaker, as shown in :ref:`fig-normal-processing`, +it consists of three steps: + +- When an announcement is received from some peer, the `In` filters configured + for that peer are applied to the announcement. These filters can reject the + announcement, accept it unmodified, or accept it with some of its attributes + modified. + +- The announcements that pass the `In` filters go into the Best Path Selection + process, where they are compared to other announcements referred to the same + destination that have been received from different peers (in case such other + announcements exist). For each different destination, the announcement which + is selected as the best is inserted into the BGP speaker's Loc-RIB. + +- The routes which are inserted in the Loc-RIB are considered for announcement + to all the peers (except the one from which the route came). This is done by + passing the routes in the Loc-RIB through the `Out` filters corresponding to + each peer. These filters can reject the route, accept it unmodified, or + accept it with some of its attributes modified. Those routes which are + accepted by the `Out` filters of a peer are announced to that peer. + +.. _fig-normal-processing: + +.. figure:: ../figures/fig-normal-processing.png + :alt: Normal announcement processing + :align: center + + Announcement processing inside a 'normal' BGP speaker + +.. _fig-topologies-full: + +.. figure:: ../figures/fig_topologies_full.png + :alt: Full Mesh BGP Topology + :align: center + + Full Mesh + +.. _fig-topologies-rs: + +.. figure:: ../figures/fig_topologies_rs.png + :alt: Route Server BGP Topology + :align: center + + Route server and clients + +Of course we want that the routing tables obtained in each of the routers are +the same when using the route server than when not. But as a consequence of +having a single BGP peering (against the route server), the BGP speakers can no +longer distinguish from/to which peer each announce comes/goes. + +.. _filter-delegation: + +This means that the routers connected to the route server are not able to apply +by themselves the same input/output filters as in the full mesh scenario, so +they have to delegate those functions to the route server. + +Even more, the 'best path' selection must be also performed inside the route +server on behalf of its clients. The reason is that if, after applying the +filters of the announcer and the (potential) receiver, the route server decides +to send to some client two or more different announcements referred to the same +destination, the client will only retain the last one, considering it as an +implicit withdrawal of the previous announcements for the same destination. +This is the expected behavior of a BGP speaker as defined in :rfc:`1771`, +and even though there are some proposals of mechanisms that permit multiple +paths for the same destination to be sent through a single BGP peering, none +are currently supported by most existing BGP implementations. + +As a consequence a route server must maintain additional information and +perform additional tasks for a RS-client that those necessary for common BGP +peerings. Essentially a route server must: + +.. _route-server-tasks: + +- Maintain a separated Routing Information Base (Loc-RIB) + for each peer configured as RS-client, containing the routes + selected as a result of the 'Best Path Selection' process + that is performed on behalf of that RS-client. + +- Whenever it receives an announcement from a RS-client, + it must consider it for the Loc-RIBs of the other RS-clients. + + - This means that for each of them the route server must pass the + announcement through the appropriate `Out` filter of the + announcer. + + - Then through the appropriate `In` filter of the potential receiver. + + - Only if the announcement is accepted by both filters it will be passed + to the 'Best Path Selection' process. + + - Finally, it might go into the Loc-RIB of the receiver. + +When we talk about the 'appropriate' filter, both the announcer and the +receiver of the route must be taken into account. Suppose that the route server +receives an announcement from client A, and the route server is considering it +for the Loc-RIB of client B. The filters that should be applied are the same +that would be used in the full mesh scenario, i.e., first the `Out` filter of +router A for announcements going to router B, and then the `In` filter of +router B for announcements coming from router A. + +We call 'Export Policy' of a RS-client to the set of `Out` filters that the +client would use if there was no route server. The same applies for the 'Import +Policy' of a RS-client and the set of `In` filters of the client if there was +no route server. + +It is also common to demand from a route server that it does not modify some +BGP attributes (next-hop, as-path and MED) that are usually modified by +standard BGP speakers before announcing a route. + +The announcement processing model implemented by Frr is shown in +:ref:`fig-rs-processing`. The figure shows a mixture of RS-clients (B, C and D) +with normal BGP peers (A). There are some details that worth additional +comments: + +- Announcements coming from a normal BGP peer are also considered for the + Loc-RIBs of all the RS-clients. But logically they do not pass through any + export policy. + +- Those peers that are configured as RS-clients do not receive any announce + from the `Main` Loc-RIB. + +- Apart from import and export policies, `In` and `Out` filters can also be set + for RS-clients. `In` filters might be useful when the route server has also + normal BGP peers. On the other hand, `Out` filters for RS-clients are + probably unnecessary, but we decided not to remove them as they do not hurt + anybody (they can always be left empty). + +.. _fig-rs-processing: +.. figure:: ../figures/fig-rs-processing.png + :align: center + :alt: Route Server Processing Model + + Announcement processing model implemented by the Route Server + +.. _commands-for-configuring-a-route-server: + +Commands for configuring a Route Server +--------------------------------------- + +Now we will describe the commands that have been added to frr +in order to support the route server features. + +.. index:: neighbor PEER-GROUP route-server-client +.. clicmd:: neighbor PEER-GROUP route-server-client + +.. index:: neighbor A.B.C.D route-server-client +.. clicmd:: neighbor A.B.C.D route-server-client + +.. index:: neighbor X:X::X:X route-server-client +.. clicmd:: neighbor X:X::X:X route-server-client + + This command configures the peer given by `peer`, `A.B.C.D` or `X:X::X:X` as + an RS-client. + + Actually this command is not new, it already existed in standard Frr. It + enables the transparent mode for the specified peer. This means that some + BGP attributes (as-path, next-hop and MED) of the routes announced to that + peer are not modified. + + With the route server patch, this command, apart from setting the + transparent mode, creates a new Loc-RIB dedicated to the specified peer + (those named `Loc-RIB for X` in :ref:`fig-rs-processing`.). Starting from + that moment, every announcement received by the route server will be also + considered for the new Loc-RIB. + +.. index:: neigbor A.B.C.D|X.X::X.X|peer-group route-map WORD import|export +.. clicmd:: neigbor A.B.C.D|X.X::X.X|peer-group route-map WORD import|export + + This set of commands can be used to specify the route-map that represents + the Import or Export policy of a peer which is configured as a RS-client + (with the previous command). + +.. index:: match peer A.B.C.D|X:X::X:X +.. clicmd:: match peer A.B.C.D|X:X::X:X + + This is a new *match* statement for use in route-maps, enabling them to + describe import/export policies. As we said before, an import/export policy + represents a set of input/output filters of the RS-client. This statement + makes possible that a single route-map represents the full set of filters + that a BGP speaker would use for its different peers in a non-RS scenario. + + The *match peer* statement has different semantics whether it is used inside + an import or an export route-map. In the first case the statement matches if + the address of the peer who sends the announce is the same that the address + specified by {A.B.C.D|X:X::X:X}. For export route-maps it matches when + {A.B.C.D|X:X::X:X} is the address of the RS-Client into whose Loc-RIB the + announce is going to be inserted (how the same export policy is applied + before different Loc-RIBs is shown in :ref:`fig-rs-processing`.). + +.. index:: call WORD +.. clicmd:: call WORD + + This command (also used inside a route-map) jumps into a different + route-map, whose name is specified by `WORD`. When the called + route-map finishes, depending on its result the original route-map + continues or not. Apart from being useful for making import/export + route-maps easier to write, this command can also be used inside + any normal (in or out) route-map. + +.. _example-of-route-server-configuration: + +Example of Route Server Configuration +------------------------------------- + +Finally we are going to show how to configure a Frr daemon to act as a +Route Server. For this purpose we are going to present a scenario without +route server, and then we will show how to use the configurations of the BGP +routers to generate the configuration of the route server. + +All the configuration files shown in this section have been taken +from scenarios which were tested using the VNUML tool +`http://www.dit.upm.es/vnuml,VNUML <http://www.dit.upm.es/vnuml,VNUML>`_. + +.. _configuration-of-the-bgp-routers-without-route-server: + +Configuration of the BGP routers without Route Server +----------------------------------------------------- + +We will suppose that our initial scenario is an exchange point with three +BGP capable routers, named RA, RB and RC. Each of the BGP speakers generates +some routes (with the `network` command), and establishes BGP peerings +against the other two routers. These peerings have In and Out route-maps +configured, named like 'PEER-X-IN' or 'PEER-X-OUT'. For example the +configuration file for router RA could be the following: + +:: + + #Configuration for router 'RA' + ! + hostname RA + password **** + ! + router bgp 65001 + no bgp default ipv4-unicast + neighbor 2001:0DB8::B remote-as 65002 + neighbor 2001:0DB8::C remote-as 65003 + ! + address-family ipv6 + network 2001:0DB8:AAAA:1::/64 + network 2001:0DB8:AAAA:2::/64 + network 2001:0DB8:0000:1::/64 + network 2001:0DB8:0000:2::/64 + neighbor 2001:0DB8::B activate + neighbor 2001:0DB8::B soft-reconfiguration inbound + neighbor 2001:0DB8::B route-map PEER-B-IN in + neighbor 2001:0DB8::B route-map PEER-B-OUT out + neighbor 2001:0DB8::C activate + neighbor 2001:0DB8::C soft-reconfiguration inbound + neighbor 2001:0DB8::C route-map PEER-C-IN in + neighbor 2001:0DB8::C route-map PEER-C-OUT out + exit-address-family + ! + ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64 + ipv6 prefix-list COMMON-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64 + ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64 + ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64 + ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any + ! + route-map PEER-B-IN permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set metric 100 + route-map PEER-B-IN permit 20 + match ipv6 address prefix-list PEER-B-PREFIXES + set community 65001:11111 + ! + route-map PEER-C-IN permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set metric 200 + route-map PEER-C-IN permit 20 + match ipv6 address prefix-list PEER-C-PREFIXES + set community 65001:22222 + ! + route-map PEER-B-OUT permit 10 + match ipv6 address prefix-list PEER-A-PREFIXES + ! + route-map PEER-C-OUT permit 10 + match ipv6 address prefix-list PEER-A-PREFIXES + ! + line vty + ! + + +.. _configuration-of-the-bgp-routers-with-route-server: + +Configuration of the BGP routers with Route Server +-------------------------------------------------- + +To convert the initial scenario into one with route server, first we must +modify the configuration of routers RA, RB and RC. Now they must not peer +between them, but only with the route server. For example, RA's +configuration would turn into: + +:: + + # Configuration for router 'RA' + ! + hostname RA + password **** + ! + router bgp 65001 + no bgp default ipv4-unicast + neighbor 2001:0DB8::FFFF remote-as 65000 + ! + address-family ipv6 + network 2001:0DB8:AAAA:1::/64 + network 2001:0DB8:AAAA:2::/64 + network 2001:0DB8:0000:1::/64 + network 2001:0DB8:0000:2::/64 + + neighbor 2001:0DB8::FFFF activate + neighbor 2001:0DB8::FFFF soft-reconfiguration inbound + exit-address-family + ! + line vty + ! + + +Which is logically much simpler than its initial configuration, as it now +maintains only one BGP peering and all the filters (route-maps) have +disappeared. + +.. _configuration-of-the-route-server-itself: + +Configuration of the Route Server itself +---------------------------------------- + +As we said when we described the functions of a route server +(:ref:`description-of-the-route-server-model`), it is in charge of all the +route filtering. To achieve that, the In and Out filters from the RA, RB and RC +configurations must be converted into Import and Export policies in the route +server. + +This is a fragment of the route server configuration (we only show +the policies for client RA): + +:: + + # Configuration for Route Server ('RS') + ! + hostname RS + password ix + ! + bgp multiple-instance + ! + router bgp 65000 view RS + no bgp default ipv4-unicast + neighbor 2001:0DB8::A remote-as 65001 + neighbor 2001:0DB8::B remote-as 65002 + neighbor 2001:0DB8::C remote-as 65003 + ! + address-family ipv6 + neighbor 2001:0DB8::A activate + neighbor 2001:0DB8::A route-server-client + neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import + neighbor 2001:0DB8::A route-map RSCLIENT-A-EXPORT export + neighbor 2001:0DB8::A soft-reconfiguration inbound + + neighbor 2001:0DB8::B activate + neighbor 2001:0DB8::B route-server-client + neighbor 2001:0DB8::B route-map RSCLIENT-B-IMPORT import + neighbor 2001:0DB8::B route-map RSCLIENT-B-EXPORT export + neighbor 2001:0DB8::B soft-reconfiguration inbound + + neighbor 2001:0DB8::C activate + neighbor 2001:0DB8::C route-server-client + neighbor 2001:0DB8::C route-map RSCLIENT-C-IMPORT import + neighbor 2001:0DB8::C route-map RSCLIENT-C-EXPORT export + neighbor 2001:0DB8::C soft-reconfiguration inbound + exit-address-family + ! + ipv6 prefix-list COMMON-PREFIXES seq 5 permit 2001:0DB8:0000::/48 ge 64 le 64 + ipv6 prefix-list COMMON-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-A-PREFIXES seq 5 permit 2001:0DB8:AAAA::/48 ge 64 le 64 + ipv6 prefix-list PEER-A-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-B-PREFIXES seq 5 permit 2001:0DB8:BBBB::/48 ge 64 le 64 + ipv6 prefix-list PEER-B-PREFIXES seq 10 deny any + ! + ipv6 prefix-list PEER-C-PREFIXES seq 5 permit 2001:0DB8:CCCC::/48 ge 64 le 64 + ipv6 prefix-list PEER-C-PREFIXES seq 10 deny any + ! + route-map RSCLIENT-A-IMPORT permit 10 + match peer 2001:0DB8::B + call A-IMPORT-FROM-B + route-map RSCLIENT-A-IMPORT permit 20 + match peer 2001:0DB8::C + call A-IMPORT-FROM-C + ! + route-map A-IMPORT-FROM-B permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set metric 100 + route-map A-IMPORT-FROM-B permit 20 + match ipv6 address prefix-list PEER-B-PREFIXES + set community 65001:11111 + ! + route-map A-IMPORT-FROM-C permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set metric 200 + route-map A-IMPORT-FROM-C permit 20 + match ipv6 address prefix-list PEER-C-PREFIXES + set community 65001:22222 + ! + route-map RSCLIENT-A-EXPORT permit 10 + match peer 2001:0DB8::B + match ipv6 address prefix-list PEER-A-PREFIXES + route-map RSCLIENT-A-EXPORT permit 20 + match peer 2001:0DB8::C + match ipv6 address prefix-list PEER-A-PREFIXES + ! + ... + ... + ... + + +If you compare the initial configuration of RA with the route server +configuration above, you can see how easy it is to generate the Import and +Export policies for RA from the In and Out route-maps of RA's original +configuration. + +When there was no route server, RA maintained two peerings, one with RB and +another with RC. Each of this peerings had an In route-map configured. To +build the Import route-map for client RA in the route server, simply add +route-map entries following this scheme: + +:: + + route-map <NAME> permit 10 + match peer <Peer Address> + call <In Route-Map for this Peer> + route-map <NAME> permit 20 + match peer <Another Peer Address> + call <In Route-Map for this Peer> + + +This is exactly the process that has been followed to generate the route-map +RSCLIENT-A-IMPORT. The route-maps that are called inside it (A-IMPORT-FROM-B +and A-IMPORT-FROM-C) are exactly the same than the In route-maps from the +original configuration of RA (PEER-B-IN and PEER-C-IN), only the name is +different. + +The same could have been done to create the Export policy for RA (route-map +RSCLIENT-A-EXPORT), but in this case the original Out route-maps where so +simple that we decided not to use the `call WORD` commands, and we +integrated all in a single route-map (RSCLIENT-A-EXPORT). + +The Import and Export policies for RB and RC are not shown, but +the process would be identical. + +Further considerations about Import and Export route-maps +--------------------------------------------------------- + +The current version of the route server patch only allows to specify a +route-map for import and export policies, while in a standard BGP speaker +apart from route-maps there are other tools for performing input and output +filtering (access-lists, community-lists, ...). But this does not represent +any limitation, as all kinds of filters can be included in import/export +route-maps. For example suppose that in the non-route-server scenario peer +RA had the following filters configured for input from peer B: + +:: + + neighbor 2001:0DB8::B prefix-list LIST-1 in + neighbor 2001:0DB8::B filter-list LIST-2 in + neighbor 2001:0DB8::B route-map PEER-B-IN in + ... + ... + route-map PEER-B-IN permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set local-preference 100 + route-map PEER-B-IN permit 20 + match ipv6 address prefix-list PEER-B-PREFIXES + set community 65001:11111 + + +It is posible to write a single route-map which is equivalent to +the three filters (the community-list, the prefix-list and the +route-map). That route-map can then be used inside the Import +policy in the route server. Lets see how to do it: + +:: + + neighbor 2001:0DB8::A route-map RSCLIENT-A-IMPORT import + ... + ! + ... + route-map RSCLIENT-A-IMPORT permit 10 + match peer 2001:0DB8::B + call A-IMPORT-FROM-B + ... + ... + ! + route-map A-IMPORT-FROM-B permit 1 + match ipv6 address prefix-list LIST-1 + match as-path LIST-2 + on-match goto 10 + route-map A-IMPORT-FROM-B deny 2 + route-map A-IMPORT-FROM-B permit 10 + match ipv6 address prefix-list COMMON-PREFIXES + set local-preference 100 + route-map A-IMPORT-FROM-B permit 20 + match ipv6 address prefix-list PEER-B-PREFIXES + set community 65001:11111 + ! + ... + ... + + +The route-map A-IMPORT-FROM-B is equivalent to the three filters (LIST-1, +LIST-2 and PEER-B-IN). The first entry of route-map A-IMPORT-FROM-B (sequence +number 1) matches if and only if both the prefix-list LIST-1 and the +filter-list LIST-2 match. If that happens, due to the 'on-match goto 10' +statement the next route-map entry to be processed will be number 10, and as of +that point route-map A-IMPORT-FROM-B is identical to PEER-B-IN. If the first +entry does not match, `on-match goto 10`' will be ignored and the next +processed entry will be number 2, which will deny the route. + +Thus, the result is the same that with the three original filters, i.e., if +either LIST-1 or LIST-2 rejects the route, it does not reach the route-map +PEER-B-IN. In case both LIST-1 and LIST-2 accept the route, it passes to +PEER-B-IN, which can reject, accept or modify the route. diff --git a/doc/user/rpki.rst b/doc/user/rpki.rst new file mode 100644 index 000000000..86d88dcf9 --- /dev/null +++ b/doc/user/rpki.rst @@ -0,0 +1,261 @@ +.. _prefix-origin-validation-using-rpki: + +Prefix Origin Validation Using RPKI +=================================== + +Prefix Origin Validation allows BGP routers to verify if the origin AS of an IP +prefix is legitimate to announce this IP prefix. The required attestation +objects are stored in the Resource Public Key Infrastructure (:abbr:`RPKI`). +However, RPKI-enabled routers do not store cryptographic data itself but only +validation information. The validation of the cryptographic data (so called +Route Origin Authorization, or short :abbr:`ROA`, objects) will be performed by +trusted cache servers. The RPKI/RTR protocol defines a standard mechanism to +maintain the exchange of the prefix/origin AS mapping between the cache server +and routers. In combination with a BGP Prefix Origin Validation scheme a +router is able to verify received BGP updates without suffering from +cryptographic complexity. + +The RPKI/RTR protocol is defined in :rfc:`6810` and the validation scheme in +:rfc:`6811`. The current version of Prefix Origin Validation in FRR implements +both RFCs. + +For a more detailed but still easy-to-read background, we suggest: + +- [Securing-BGP]_ +- [Resource-Certification]_ + +.. _features-of-the-current-implementation: + +Features of the Current Implementation +-------------------------------------- + +In a nutshell, the current implementation provides the following features + +- The BGP router can connect to one or more RPKI cache servers to receive + validated prefix to origin AS mappings. Advanced failover can be implemented + by server sockets with different preference values. +- If no connection to an RPKI cache server can be established after a + pre-defined timeout, the router will process routes without prefix origin + validation. It still will try to establish a connection to an RPKI cache + server in the background. +- By default, enabling RPKI does not change best path selection. In particular, + invalid prefixes will still be considered during best path selection. + However, the router can be configured to ignore all invalid prefixes. +- Route maps can be configured to match a specific RPKI validation state. This + allows the creation of local policies, which handle BGP routes based on the + outcome of the Prefix Origin Validation. + + +.. _enabling-rpki: + +Enabling RPKI +------------- + +.. index:: rpki +.. clicmd:: rpki + + This command enables the RPKI configuration mode. Most commands that start + with *rpki* can only be used in this mode. + + When it is used in a telnet session, leaving of this mode cause rpki to be initialized. + + Executing this command alone does not activate prefix validation. You need + to configure at least one reachable cache server. See section + :ref:`configuring-rpki-rtr-cache-servers` for configuring a cache server. + +.. _configuring-rpki-rtr-cache-servers: + +Configuring RPKI/RTR Cache Servers +---------------------------------- + +The following commands are independent of a specific cache server. + +.. index:: rpki polling_period (1-3600) +.. clicmd:: rpki polling_period (1-3600) + +.. index:: no rpki polling_period +.. clicmd:: no rpki polling_period + + Set the number of seconds the router waits until the router asks the cache + again for updated data. + + The default value is 300 seconds. + +.. index:: rpki timeout <1-4,294,967,296> +.. clicmd:: rpki timeout <1-4,294,967,296> + +.. index:: no rpki timeout +.. clicmd:: no rpki timeout + + Set the number of seconds the router waits for the cache reply. If the cache + server is not replying within this time period, the router deletes all + received prefix records from the prefix table. + + The default value is 600 seconds. + +.. index:: rpki initial-synchronisation-timeout <1-4,294,967,296> +.. clicmd:: rpki initial-synchronisation-timeout <1-4,294,967,296> + +.. index:: no rpki initial-synchronisation-timeout +.. clicmd:: no rpki initial-synchronisation-timeout + + Set the number of seconds until the first synchronization with the cache + server needs to be completed. If the timeout expires, BGP routing is started + without RPKI. The router will try to establish the cache server connection in + the background. + + The default value is 30 seconds. + + The following commands configure one or multiple cache servers. + +.. index:: rpki cache (A.B.C.D|WORD) PORT [SSH_USERNAME] [SSH_PRIVKEY_PATH] [SSH_PUBKEY_PATH] [KNOWN_HOSTS_PATH] PREFERENCE +.. clicmd:: rpki cache (A.B.C.D|WORD) PORT [SSH_USERNAME] [SSH_PRIVKEY_PATH] [SSH_PUBKEY_PATH] [KNOWN_HOSTS_PATH] PREFERENCE + +.. index:: no rpki cache (A.B.C.D|WORD) [PORT] PREFERENCE +.. clicmd:: no rpki cache (A.B.C.D|WORD) [PORT] PREFERENCE + + Add a cache server to the socket. By default, the connection between router + and cache server is based on plain TCP. Protecting the connection between + router and cache server by SSH is optional. Deleting a socket removes the + associated cache server and terminates the existing connection. + + A.B.C.D|WORD + Address of the cache server. + + PORT + Port number to connect to the cache server + + SSH_USERNAME + SSH username to establish an SSH connection to the cache server. + + + SSH_PRIVKEY_PATH + Local path that includes the private key file of the router. + + + SSH_PUBKEY_PATH + Local path that includes the public key file of the router. + + + KNOWN_HOSTS_PATH + Local path that includes the known hosts file. The default value depends + on the configuration of the operating system environment, usually + :file:`~/.ssh/known_hosts`. + + +.. _validating-bgp-updates: + +Validating BGP Updates +---------------------- + +.. index:: match rpki notfound|invalid|valid +.. clicmd:: match rpki notfound|invalid|valid + +.. index:: no match rpki notfound|invalid|valid +.. clicmd:: no match rpki notfound|invalid|valid + + Create a clause for a route map to match prefixes with the specified RPKI + state. + + **Note** that the matching of invalid prefixes requires that invalid + prefixes are considered for best path selection, i.e., + ``bgp bestpath prefix-validate disallow-invalid`` is not enabled. + + In the following example, the router prefers valid routes over invalid + prefixes because invalid routes have a lower local preference. + + :: + + ! Allow for invalid routes in route selection process + route bgp 60001 + ! + ! Set local preference of invalid prefixes to 10 + route-map rpki permit 10 + match rpki invalid + set local-preference 10 + ! + ! Set local preference of valid prefixes to 500 + route-map rpki permit 500 + match rpki valid + set local-preference 500 + + +.. _debugging: + +Debugging +--------- + +.. index:: debug rpki +.. clicmd:: debug rpki + +.. index:: no debug rpki +.. clicmd:: no debug rpki + + Enable or disable debugging output for RPKI. + +.. _displaying-rpki: + +Displaying RPKI +--------------- + +.. index:: show rpki prefix-table +.. clicmd:: show rpki prefix-table + + Display all validated prefix to origin AS mappings/records which have been + received from the cache servers and stored in the router. Based on this data, + the router validates BGP Updates. + +.. index:: show rpki cache-connection +.. clicmd:: show rpki cache-connection + + Display all configured cache servers, whether active or not. + +RPKI Configuration Example +-------------------------- + +:: + + hostname bgpd1 + password zebra + ! log stdout + debug bgp updates + debug bgp keepalives + debug rpki + ! + rpki + rpki polling_period 1000 + rpki timeout 10 + ! SSH Example: + rpki cache example.com 22 rtr-ssh ./ssh_key/id_rsa ./ssh_key/id_rsa.pub preference 1 + ! TCP Example: + rpki cache rpki-validator.realmv6.org 8282 preference 2 + exit + ! + router bgp 60001 + bgp router-id 141.22.28.223 + network 192.168.0.0/16 + neighbor 123.123.123.0 remote-as 60002 + neighbor 123.123.123.0 route-map rpki in + ! + address-family ipv6 + neighbor 123.123.123.0 activate + neighbor 123.123.123.0 route-map rpki in + exit-address-family + ! + route-map rpki permit 10 + match rpki invalid + set local-preference 10 + ! + route-map rpki permit 20 + match rpki notfound + set local-preference 20 + ! + route-map rpki permit 30 + match rpki valid + set local-preference 30 + ! + route-map rpki permit 40 + ! + +.. [Securing-BGP] Geoff Huston, Randy Bush: Securing BGP, In: The Internet Protocol Journal, Volume 14, No. 2, 2011. <http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_14-2/142_bgp.html> +.. [Resource-Certification] Geoff Huston: Resource Certification, In: The Internet Protocol Journal, Volume 12, No.1, 2009. <http://www.cisco.com/web/about/ac123/ac147/archived_issues/ipj_12-1/121_resource.html> diff --git a/doc/user/snmp.rst b/doc/user/snmp.rst new file mode 100644 index 000000000..114f1f7df --- /dev/null +++ b/doc/user/snmp.rst @@ -0,0 +1,200 @@ +.. _snmp-support: + +************ +SNMP Support +************ + +:abbr:`SNMP (Simple Network Managing Protocol)` is a widely implemented feature +for collecting network information from router and/or host. FRR itself does +not support SNMP agent (server daemon) functionality but is able to connect to +a SNMP agent using the SMUX protocol (:rfc:`1227`) or the AgentX protocol +(:rfc:`2741`) and make the routing protocol MIBs available through it. + +Note that SNMP Support needs to be enabled at compile-time and loaded as module +on daemon startup. Refer to :ref:`loadable-module-support` on the latter. + +.. _getting-and-installing-an-snmp-agent: + +Getting and installing an SNMP agent +==================================== + +There are several SNMP agent which support SMUX or AgentX. We recommend to use +the latest version of `net-snmp` which was formerly known as `ucd-snmp`. It is +free and open software and available at `http://www.net-snmp.org/ <http://www.net-snmp.org/>`_ +and as binary package for most Linux distributions. `net-snmp` has to be +compiled with `--with-mib-modules=agentx` to be able to accept connections from +FRR using AgentX protocol or with `--with-mib-modules=smux` to use SMUX +protocol. + +Nowadays, SMUX is a legacy protocol. The AgentX protocol should be preferred +for any new deployment. Both protocols have the same coverage. + +.. _agentx-configuration: + +AgentX configuration +==================== + +.. program:: configure + +To enable AgentX protocol support, FRR must have been build with the +:option:`--enable-snmp` or `--enable-snmp=agentx` option. Both the +master SNMP agent (snmpd) and each of the FRR daemons must be configured. In +:file:`/etc/snmp/snmpd.conf`, the ``master agentx`` directive should be added. +In each of the FRR daemons, ``agentx`` command will enable AgentX support. + +:: + + /etc/snmp/snmpd.conf: + # + # example access restrictions setup + # + com2sec readonly default public + group MyROGroup v1 readonly + view all included .1 80 + access MyROGroup "" any noauth exact all none none + # + # enable master agent for AgentX subagents + # + master agentx + + /etc/frr/ospfd.conf: + ! ... the rest of ospfd.conf has been omitted for clarity ... + ! + agentx + ! + + +Upon successful connection, you should get something like this in the log of +each FRR daemons: + +:: + + 2012/05/25 11:39:08 ZEBRA: snmp[info]: NET-SNMP version 5.4.3 AgentX subagent connected + + +Then, you can use the following command to check everything works as expected: + +:: + + # snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1 + OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109 + [...] + + +The AgentX protocol can be transported over a Unix socket or using TCP or UDP. +It usually defaults to a Unix socket and depends on how NetSNMP was built. If +need to configure FRR to use another transport, you can configure it through +:file:`/etc/snmp/frr.conf`: + +:: + + /etc/snmp/frr.conf: + [snmpd] + # Use a remote master agent + agentXSocket tcp:192.168.15.12:705 + + +.. _smux-configuration: + +SMUX configuration +================== + +To enable SMUX protocol support, FRR must have been build with the +:option:`--enable-snmp` option. + +A separate connection has then to be established between the SNMP agent (snmpd) +and each of the FRR daemons. This connections each use different OID numbers +and passwords. Be aware that this OID number is not the one that is used in +queries by clients, it is solely used for the intercommunication of the +daemons. + +In the following example the ospfd daemon will be connected to the snmpd daemon +using the password "frr_ospfd". For testing it is recommending to take exactly +the below snmpd.conf as wrong access restrictions can be hard to debug. + +:: + + /etc/snmp/snmpd.conf: + # + # example access restrictions setup + # + com2sec readonly default public + group MyROGroup v1 readonly + view all included .1 80 + access MyROGroup "" any noauth exact all none none + # + # the following line is relevant for FRR + # + smuxpeer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd + + /etc/frr/ospf: + ! ... the rest of ospfd.conf has been omitted for clarity ... + ! + smux peer .1.3.6.1.4.1.3317.1.2.5 frr_ospfd + ! + + +After restarting snmpd and frr, a successful connection can be verified in the +syslog and by querying the SNMP daemon: + +:: + + snmpd[12300]: [smux_accept] accepted fd 12 from 127.0.0.1:36255 + snmpd[12300]: accepted smux peer: \\ + oid GNOME-PRODUCT-ZEBRA-MIB::ospfd, frr-0.96.5 + + # snmpwalk -c public -v1 localhost .1.3.6.1.2.1.14.1.1 + OSPF-MIB::ospfRouterId.0 = IpAddress: 192.168.42.109 + + +Be warned that the current version (5.1.1) of the Net-SNMP daemon writes a line +for every SNMP connect to the syslog which can lead to enormous log file sizes. +If that is a problem you should consider to patch snmpd and comment out the +troublesome `snmp_log()` line in the function `netsnmp_agent_check_packet()` in +`agent/snmp_agent.c`. + +MIB and command reference +========================= + +The following OID numbers are used for the interprocess communication of snmpd and +the FRR daemons with SMUX only.:: + + . (OIDs below .iso.org.dod.internet.private.enterprises) + zebra .1.3.6.1.4.1.3317.1.2.1 .gnome.gnomeProducts.zebra.zserv + bgpd .1.3.6.1.4.1.3317.1.2.2 .gnome.gnomeProducts.zebra.bgpd + ripd .1.3.6.1.4.1.3317.1.2.3 .gnome.gnomeProducts.zebra.ripd + ospfd .1.3.6.1.4.1.3317.1.2.5 .gnome.gnomeProducts.zebra.ospfd + ospf6d .1.3.6.1.4.1.3317.1.2.6 .gnome.gnomeProducts.zebra.ospf6d + + +Sadly, SNMP has not been implemented in all daemons yet. The following +OID numbers are used for querying the SNMP daemon by a client::: + + zebra .1.3.6.1.2.1.4.24 .iso.org.dot.internet.mgmt.mib-2.ip.ipForward + ospfd .1.3.6.1.2.1.14 .iso.org.dot.internet.mgmt.mib-2.ospf + bgpd .1.3.6.1.2.1.15 .iso.org.dot.internet.mgmt.mib-2.bgp + ripd .1.3.6.1.2.1.23 .iso.org.dot.internet.mgmt.mib-2.rip2 + ospf6d .1.3.6.1.3.102 .iso.org.dod.internet.experimental.ospfv3 + + +The following syntax is understood by the FRR daemons for configuring SNMP +using SMUX: + +.. index:: smux peer OID +.. clicmd:: smux peer OID +.. index:: no smux peer OID +.. clicmd:: no smux peer OID +.. index:: smux peer OID PASSWORD +.. clicmd:: smux peer OID PASSWORD +.. index:: no smux peer OID PASSWORD +.. clicmd:: no smux peer OID PASSWORD + +Here is the syntax for using AgentX: + +.. index:: agentx +.. clicmd:: agentx +.. index:: no agentx +.. clicmd:: no agentx + + +.. include:: snmptrap.rst diff --git a/doc/user/snmptrap.rst b/doc/user/snmptrap.rst new file mode 100644 index 000000000..9e642a5d4 --- /dev/null +++ b/doc/user/snmptrap.rst @@ -0,0 +1,201 @@ +Handling SNMP Traps +=================== + +To handle snmp traps make sure your snmp setup of frr works correctly as +described in the frr documentation in :ref:`snmp-support`. + +The BGP4 mib will send traps on peer up/down events. These should be visible in +your snmp logs with a message similar to: + +:: + + snmpd[13733]: Got trap from peer on fd 14 + +To react on these traps they should be handled by a trapsink. Configure your +trapsink by adding the following lines to :file:`/etc/snmpd/snmpd.conf`: + +:: + + # send traps to the snmptrapd on localhost + trapsink localhost + + +This will send all traps to an snmptrapd running on localhost. You can of +course also use a dedicated management station to catch traps. Configure the +snmptrapd daemon by adding the following line to +:file:`/etc/snmpd/snmptrapd.conf`: + +:: + + traphandle .1.3.6.1.4.1.3317.1.2.2 /etc/snmp/snmptrap_handle.sh + + +This will use the bash script :file:`/etc/snmp/snmptrap_handle.sh` to handle +the BGP4 traps. To add traps for other protocol daemons, lookup their +appropriate OID from their mib. (For additional information about which traps +are supported by your mib, lookup the mib on +`http://www.oidview.com/mibs/detail.html <http://www.oidview.com/mibs/detail.html>`_). + +Make sure *snmptrapd* is started. + +The snmptrap_handle.sh script I personally use for handling BGP4 traps is +below. You can of course do all sorts of things when handling traps, like sound +a siren, have your display flash, etc., be creative ;). + +:: + + #!/bin/bash + + # routers name + ROUTER=`hostname -s` + + #email address use to sent out notification + EMAILADDR="john@doe.com" + #email address used (allongside above) where warnings should be sent + EMAILADDR_WARN="sms-john@doe.com" + + # type of notification + TYPE="Notice" + + # local snmp community for getting AS belonging to peer + COMMUNITY="<community>" + + # if a peer address is in $WARN_PEERS a warning should be sent + WARN_PEERS="192.0.2.1" + + # get stdin + INPUT=`cat -` + + # get some vars from stdin + uptime=`echo $INPUT | cut -d' ' -f5` + peer=`echo $INPUT | cut -d' ' -f8 | sed -e 's/SNMPv2-SMI::mib-2.15.3.1.14.//g'` + peerstate=`echo $INPUT | cut -d' ' -f13` + errorcode=`echo $INPUT | cut -d' ' -f9 | sed -e 's/\\"//g'` + suberrorcode=`echo $INPUT | cut -d' ' -f10 | sed -e 's/\\"//g'` + remoteas=`snmpget -v2c -c $COMMUNITY localhost SNMPv2-SMI::mib-2.15.3.1.9.$peer | cut -d' ' -f4` + + WHOISINFO=`whois -h whois.ripe.net " -r AS$remoteas" | egrep '(as-name|descr)'` + asname=`echo "$WHOISINFO" | grep "^as-name:" | sed -e 's/^as-name://g' -e 's/ //g' -e 's/^ //g' | uniq` + asdescr=`echo "$WHOISINFO" | grep "^descr:" | sed -e 's/^descr://g' -e 's/ //g' -e 's/^ //g' | uniq` + + # if peer address is in $WARN_PEER, the email should also + # be sent to $EMAILADDR_WARN + for ip in $WARN_PEERS; do + if [ "x$ip" == "x$peer" ]; then + EMAILADDR="$EMAILADDR,$EMAILADDR_WARN" + TYPE="WARNING" + break + fi + done + + # convert peer state + case "$peerstate" in + 1) peerstate="Idle" ;; + 2) peerstate="Connect" ;; + 3) peerstate="Active" ;; + 4) peerstate="Opensent" ;; + 5) peerstate="Openconfirm" ;; + 6) peerstate="Established" ;; + *) peerstate="Unknown" ;; + esac + + # get textual messages for errors + case "$errorcode" in + 00) + error="No error" + suberror="" + ;; + 01) + error="Message Header Error" + case "$suberrorcode" in + 01) suberror="Connection Not Synchronized" ;; + 02) suberror="Bad Message Length" ;; + 03) suberror="Bad Message Type" ;; + *) suberror="Unknown" ;; + esac + ;; + 02) + error="OPEN Message Error" + case "$suberrorcode" in + 01) suberror="Unsupported Version Number" ;; + 02) suberror="Bad Peer AS" ;; + 03) suberror="Bad BGP Identifier" ;; + 04) suberror="Unsupported Optional Parameter" ;; + 05) suberror="Authentication Failure" ;; + 06) suberror="Unacceptable Hold Time" ;; + *) suberror="Unknown" ;; + esac + ;; + 03) + error="UPDATE Message Error" + case "$suberrorcode" in + 01) suberror="Malformed Attribute List" ;; + 02) suberror="Unrecognized Well-known Attribute" ;; + 03) suberror="Missing Well-known Attribute" ;; + 04) suberror="Attribute Flags Error" ;; + 05) suberror="Attribute Length Error" ;; + 06) suberror="Invalid ORIGIN Attribute" ;; + 07) suberror="AS Routing Loop" ;; + 08) suberror="Invalid NEXT_HOP Attribute" ;; + 09) suberror="Optional Attribute Error" ;; + 10) suberror="Invalid Network Field" ;; + 11) suberror="Malformed AS_PATH" ;; + *) suberror="Unknown" ;; + esac + ;; + 04) + error="Hold Timer Expired" + suberror="" + ;; + 05) + error="Finite State Machine Error" + suberror="" + ;; + 06) + error="Cease" + case "$suberrorcode" in + 01) suberror="Maximum Number of Prefixes Reached" ;; + 02) suberror="Administratively Shutdown" ;; + 03) suberror="Peer Unconfigured" ;; + 04) suberror="Administratively Reset" ;; + 05) suberror="Connection Rejected" ;; + 06) suberror="Other Configuration Change" ;; + 07) suberror="Connection collision resolution" ;; + 08) suberror="Out of Resource" ;; + 09) suberror="MAX" ;; + *) suberror="Unknown" ;; + esac + ;; + *) + error="Unknown" + suberror="" + ;; + esac + + # create textual message from errorcodes + if [ "x$suberror" == "x" ]; then + NOTIFY="$errorcode ($error)" + else + NOTIFY="$errorcode/$suberrorcode ($error/$suberror)" + fi + + # form a decent subject + SUBJECT="$TYPE: $ROUTER [bgp] $peer is $peerstate: $NOTIFY" + # create the email body + MAIL=`cat << EOF + BGP notification on router $ROUTER. + + Peer: $peer + AS: $remoteas + New state: $peerstate + Notification: $NOTIFY + + Info: + $asname + $asdescr + + Snmpd uptime: $uptime + EOF` + + # mail the notification + echo "$MAIL" | mail -s "$SUBJECT" $EMAILADDR diff --git a/doc/user/vnc.rst b/doc/user/vnc.rst new file mode 100644 index 000000000..8be4ff62d --- /dev/null +++ b/doc/user/vnc.rst @@ -0,0 +1,1425 @@ +.. _vnc-and-vnc-gw: + +************** +VNC and VNC-GW +************** + +This chapter describes how to use :abbr:`VNC (Virtual Network Control)` +services, including :abbr:`NVA (Network Virtualization Authority)` and +:abbr:`VNC-GW (VNC Gateway)` functions. Background information on NVAs, +:abbr:`NVE (Network Virtualization Edge)` s, :abbr:`UN (Underlay Network)` s, +and :abbr:`VN (Virtual Network)` is available from the +`IETF <https://datatracker.ietf.org/wg/nvo3>`_. :abbr:`VNC-GW (VNC Gateway)` s +support the import/export of routing information between VNC and :abbr:`CE +(customer edge)` routers operating within a VN. Both IP/Layer 3 (L3) VNs, and +IP with Ethernet/Layer 2 (L2) VNs are supported. + +BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VN +information between NVAs. BGP based IP VPN support is defined in :rfc:`4364`, +and :rfc:`4659`. Encapsulation information is provided via the Tunnel +Encapsulation Attribute, :rfc:`5512`. + +The protocol that is used to communicate routing and Ethernet / Layer 2 (L2) +forwarding information between NVAs and NVEs is referred to as the Remote +Forwarder Protocol (RFP). `OpenFlow` is an example RFP. Specific RFP +implementations may choose to implement either a `hard-state` or `soft-state` +prefix and address registration model. To support a `soft-state` refresh model, +a `lifetime` in seconds is associated with all registrations and responses. + +The chapter also provides sample configurations for basic example scenarios. + +.. _configuring-vnc: + +Configuring VNC +=============== + +Virtual Network Control (:abbr:`VNC`) service configuration commands appear in +the `router bgp` section of the BGPD configuration file +(:ref:`bgp-configuration-examples`). The commands are broken down into the +following areas: + +- :dfn:`General VNC` configuration applies to general VNC operation and is + primarily used to control the method used to advertise tunnel information. + +- :dfn:`Remote Forwarder Protocol (RFP)` configuration relates to the protocol + used between NVAs and NVEs. + +- :dfn:`VNC Defaults` provides default parameters for registered NVEs. + +- :dfn:`VNC NVE Group` provides for configuration of a specific set of + registered NVEs and overrides default parameters. + +- :dfn:`Redistribution` and :dfn:`Export` control VNC-GW operation, i.e., the + import/export of routing information between VNC and customer edge routers + (:abbr:`CE` s) operating within a VN. + + +.. _general-vnc-configuration: + +General VNC Configuration +------------------------- + +.. _rfp-related-configuration: + +RFP Related Configuration +------------------------- + +The protocol that is used to communicate routing and Ethernet / L2 forwarding +information between NVAs and NVEs is referred to as the Remote Forwarder +Protocol (RFP). Currently, only a simple example RFP is included in FRR. +Developers may use this example as a starting point to integrate FRR with an +RFP of their choosing, e.g., `OpenFlow`. The example code includes the +following sample configuration: + +.. clicmd:: rfp example-config-value VALUE + +This is a simple example configuration parameter included as part of the RFP +example code. VALUE must be in the range of 0 to 4294967295. + +.. _vnc-defaults-configuration: + +VNC Defaults Configuration +-------------------------- + +The VNC Defaults section allows the user to specify default values for +configuration parameters for all registered NVEs. +Default values are overridden by :ref:`vnc-nve-group-configuration`. + +.. clicmd:: vnc defaults + +Enter VNC configuration mode for specifying VNC default behaviors. Use +`exit-vnc` to leave VNC configuration mode. `vnc defaults` is optional. + +:: + + vnc defaults + ... various VNC defaults + exit-vnc + + +These are the statements that can appear between ``vnc defaults`` and +``exit-vnc``. Documentation for these statements is given in +:ref:`vnc-nve-group-configuration`. + +- :clicmd:`rt import RT-LIST` +- :clicmd:`rt export RT-LIST` +- :clicmd:`rt both RT-LIST` +- :clicmd:`rd ROUTE-DISTINGUISHER` +- :clicmd:`l2rd NVE-ID-VALUE` +- :clicmd:`response-lifetime LIFETIME|infinite` +- :clicmd:`export bgp|zebra route-map MAP-NAME` +- :clicmd:`export bgp|zebra no route-map` + +.. index:: exit-vnc +.. clicmd:: exit-vnc + + Exit VNC configuration mode. + +.. _vnc-nve-group-configuration: + +VNC NVE Group Configuration +--------------------------- + +A NVE Group corresponds to a specific set of NVEs. A Client NVE is +assigned to an NVE Group based on whether there is a match for either +its virtual or underlay network address against the VN and/or UN address +prefixes specified in the NVE Group definition. When an NVE Group +definition specifies both VN and UN address prefixes, then an NVE must +match both prefixes in order to be assigned to the NVE Group. In the +event that multiple NVE Groups match based on VN and/or UN addresses, +the NVE is assigned to the first NVE Group listed in the configuration. +If an NVE is not assigned to an NVE Group, its messages will be ignored. + +Configuration values specified for an NVE group apply to all +member NVEs and override configuration values specified in the VNC +Defaults section. + +**At least one `nve-group` is mandatory for useful VNC operation.** + +.. index:: vnc nve-group NAME +.. clicmd:: vnc nve-group NAME + + Enter VNC configuration mode for defining the NVE group `name`. + Use `exit` or `exit-vnc` to exit group configuration mode. + + :: + + vnc nve-group group1 + ... configuration commands + exit-vnc + + +.. index:: no vnc nve-group NAME +.. clicmd:: no vnc nve-group NAME + + Delete the NVE group named `name`. + + The following statements are valid in an NVE group definition: + +.. index:: l2rd NVE-ID-VALUE +.. clicmd:: l2rd NVE-ID-VALUE + + Set the value used to distinguish NVEs connected to the same physical + Ethernet segment (i.e., at the same location) [#]_. + + The nve-id subfield may be specified as either a literal value in the range + 1-255, or it may be specified as `auto:vn`, which means to use the + least-significant octet of the originating NVE's VN address. + +.. index:: prefix vn|un A.B.C.D/M|X:X::X:X/M +.. clicmd:: prefix vn|un A.B.C.D/M|X:X::X:X/M + + Specify the matching prefix for this NVE group by either virtual-network + address (`vn`) or underlay-network address (`un`). Either or both + virtual-network and underlay-network prefixes may be specified. Subsequent + virtual-network or underlay-network values within a `vnc nve-group` + `exit-vnc` block override their respective previous values. + + These prefixes are used only for determining assignments of NVEs to NVE + Groups. + +.. index:: rd ROUTE-DISTINGUISHER +.. clicmd:: rd ROUTE-DISTINGUISHER + + Specify the route distinguisher for routes advertised via BGP + VPNs. The route distinguisher must be in one of these forms: + + - ``IPv4-address:two-byte-integer`` + - ``four-byte-autonomous-system-number:two-byte-integer`` + - ``two-byte-autonomous-system-number:four-byte-integer`` + - ``auto:vn:two-byte-integer`` + + Routes originated by NVEs in the NVE group will use the group's specified + `route-distinguisher` when they are advertised via BGP. If the `auto` form + is specified, it means that a matching NVE has its RD set to + ``rd_type=IP=1:IPv4-address=VN-address:two-byte-integer``, for IPv4 VN + addresses and + ``rd_type=IP=1:IPv4-address=Last-four-bytes-of-VN-address:two-byte-integer``, + for IPv6 VN addresses. + + If the NVE group definition does not specify a `route-distinguisher`, then + the default `route-distinguisher` is used. If neither a group nor a default + `route-distinguisher` is configured, then the advertised RD is set to + ``two-byte-autonomous-system-number=0:four-byte-integer=0``. + +.. index:: response-lifetime LIFETIME|infinite +.. clicmd:: response-lifetime LIFETIME|infinite + + Specify the response lifetime, in seconds, to be included in RFP response + messages sent to NVEs. If the value 'infinite' is given, an infinite + lifetime will be used. + + Note that this parameter is not the same as the lifetime supplied by NVEs in + RFP registration messages. This parameter does not affect the lifetime value + attached to routes sent by this server via BGP. + + If the NVE group definition does not specify a `response-lifetime`, the + default `response-lifetime` will be used. If neither a group nor a default + `response-lifetime` is configured, the value 3600 will be used. The maximum + response lifetime is 2147483647. + +.. index:: rt export RT-LIST +.. clicmd:: rt export RT-LIST + +.. index:: rt import RT-LIST +.. clicmd:: rt import RT-LIST + +.. index:: rt both RT-LIST +.. clicmd:: rt both RT-LIST + + Specify route target import and export lists. `rt-list` is a + space-separated list of route targets, each element of which is + in one of the following forms: + + - ``IPv4-address:two-byte-integer`` + - ``four-byte-autonomous-system-number:two-byte-integer`` + - ``two-byte-autonomous-system-number:four-byte-integer`` + + The first form, `rt export`, specifies an `export rt-list`. The `export + rt-list` will be attached to routes originated by NVEs in the NVE group + when they are advertised via BGP. If the NVE group definition does not + specify an `export rt-list`, then the default `export rt-list` is used. + If neither a group nor a default `export rt-list` is configured, then no + RT list will be sent; in turn, these routes will probably not be + processed by receiving NVAs. + + The second form, `rt import` specifies an `import rt-list`, which is a + filter for incoming routes. In order to be made available to NVEs in the + group, incoming BGP VPN routes must have RT lists that have at least one + route target in common with the group's `import rt-list`. + + If the NVE group definition does not specify an import filter, then the + default `import rt-list` is used. If neither a group nor a default + `import rt-list` is configured, there can be no RT intersections when + receiving BGP routes and therefore no incoming BGP routes will be + processed for the group. + + The third, `rt both`, is a shorthand way of specifying both lists + simultaneously, and is equivalent to `rt export `rt-list`` followed by + `rt import `rt-list``. + +.. index:: export bgp|zebra route-map MAP-NAME +.. clicmd:: export bgp|zebra route-map MAP-NAME + + Specify that the named route-map should be applied to routes being exported + to bgp or zebra. This paramter is used in conjunction with + :ref:`configuring-export-of-routes-to-other-routing-protocols`. This item + is optional. + +.. index:: export bgp|zebra no route-map +.. clicmd:: export bgp|zebra no route-map + + Specify that no route-map should be applied to routes being exported to bgp + or zebra. This paramter is used in conjunction with + :ref:`configuring-export-of-routes-to-other-routing-protocols`. This item + is optional. + +.. index:: export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME +.. clicmd:: export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME + + Specify that the named prefix-list filter should be applied to routes being + exported to bgp or zebra. Prefix-lists for ipv4 and ipv6 are independent of + each other. This paramter is used in conjunction with + :ref:`configuring-export-of-routes-to-other-routing-protocols`. This item + is optional. + +.. index:: export bgp|zebra no ipv4|ipv6 prefix-list +.. clicmd:: export bgp|zebra no ipv4|ipv6 prefix-list + + Specify that no prefix-list filter should be applied to routes being + exported to bgp or zebra. This parameter is used in conjunction with + :ref:`configuring-export-of-routes-to-other-routing-protocols`. This item + is optional. + +.. _vnc-l2-group-configuration: + +VNC L2 Group Configuration +-------------------------- + +The route targets advertised with prefixes and addresses registered by an NVE +are determined based on the NVE's associated VNC NVE Group Configuration, +:ref:`vnc-nve-group-configuration`. Layer 2 (L2) Groups are used to override +the route targets for an NVE's Ethernet registrations based on the Logical +Network Identifier and label value. A Logical Network Identifier is used to +uniquely identify a logical Ethernet segment and is conceptually similar to the +Ethernet Segment Identifier defined in :rfc:`7432`. Both the Logical Network +Identifier and Label are passed to VNC via RFP prefix and address registration. + +Note that a corresponding NVE group configuration must be present, and that +other NVE associated configuration information, notably RD, is not impacted by +L2 Group Configuration. + +.. index:: vnc l2-group NAME +.. clicmd:: vnc l2-group NAME + + Enter VNC configuration mode for defining the L2 group `name`. + Use `exit` or `exit-vnc` to exit group configuration mode. + + :: + + vnc l2-group group1 + ... configuration commands + exit-vnc + + +.. index:: no vnc l2-group NAME +.. clicmd:: no vnc l2-group NAME + + Delete the L2 group named `name`. + +The following statements are valid in a L2 group definition: + +.. index:: logical-network-id VALUE +.. clicmd:: logical-network-id VALUE + + Define the Logical Network Identifier with a value in the range of + 0-4294967295 that identifies the logical Ethernet segment. + +.. index:: labels LABEL-LIST +.. clicmd:: labels LABEL-LIST + +.. index:: no labels LABEL-LIST +.. clicmd:: no labels LABEL-LIST + + Add or remove labels associated with the group. `label-list` is a + space separated list of label values in the range of 0-1048575. + +.. index:: rt import RT-TARGET +.. clicmd:: rt import RT-TARGET + +.. index:: rt export RT-TARGET +.. clicmd:: rt export RT-TARGET + +.. index:: rt both RT-TARGET +.. clicmd:: rt both RT-TARGET + + Specify the route target import and export value associated with the group. + A complete definition of these parameters is given above, + :ref:`vnc-nve-group-configuration`. + +.. _configuring-redistribution-of-routes-from-other-routing-protocols: + +Configuring Redistribution of Routes from Other Routing Protocols +----------------------------------------------------------------- + +Routes from other protocols (including BGP) can be provided to VNC (both for +RFP and for redistribution via BGP) from three sources: the zebra kernel +routing process; directly from the main (default) unicast BGP RIB; or directly +from a designated BGP unicast exterior routing RIB instance. + +The protocol named in the `vnc redistribute` command indicates the route +source: `bgp-direct` routes come directly from the main (default) unicast BGP +RIB and are available for RFP and are redistributed via BGP; +`bgp-direct-to-nve-groups` routes come directly from a designated BGP unicast +routing RIB and are made available only to RFP; and routes from other protocols +come from the zebra kernel routing process. +Note that the zebra process does not need to be active if +only `bgp-direct` or `bgp-direct-to-nve-groups` routes are used. + +zebra routes +^^^^^^^^^^^^ + +Routes originating from protocols other than BGP must be obtained +via the zebra routing process. +Redistribution of these routes into VNC does not support policy mechanisms +such as prefix-lists or route-maps. + +bgp-direct routes +^^^^^^^^^^^^^^^^^ + +`bgp-direct` redistribution supports policy via +prefix lists and route-maps. This policy is applied to incoming +original unicast routes before the redistribution translations +(described below) are performed. + +Redistribution of `bgp-direct` routes is performed in one of three +possible modes: `plain`, `nve-group`, or `resolve-nve`. +The default mode is `plain`. +These modes indicate the kind of translations applied to routes before +they are added to the VNC RIB. + +In `plain` mode, the route's next hop is unchanged and the RD is set +based on the next hop. +For `bgp-direct` redistribution, the following translations are performed: + +- The VN address is set to the original unicast route's next hop address. +- The UN address is NOT set. (VN->UN mapping will occur via + ENCAP route or attribute, based on `vnc advertise-un-method` + setting, generated by the RFP registration of the actual NVE) +- The RD is set to as if auto:vn:0 were specified (i.e., + `rd_type=IP=1`:`IPv4-address=VN-address`:`two-byte-integer=0`) +- The RT list is included in the extended community list copied from the + original unicast route (i.e., it must be set in the original unicast route). + +In `nve-group` mode, routes are registered with VNC as if they came from an NVE +in the nve-group designated in the `vnc redistribute nve-group` command. The +following translations are performed: + +- The next hop/VN address is set to the VN prefix configured for the + redistribute nve-group. +- The UN address is set to the UN prefix configured for the redistribute + nve-group. +- The RD is set to the RD configured for the redistribute nve-group. +- The RT list is set to the RT list configured for the redistribute nve-group. + If `bgp-direct` routes are being redistributed, any extended communities + present in the original unicast route will also be included. + +In `resolve-nve` mode, the next hop of the original BGP route is typically the +address of an NVE connected router (CE) connected by one or more NVEs. +Each of the connected NVEs will register, via RFP, a VNC host route to the CE. +This mode may be though of as a mechanism to proxy RFP registrations of BGP +unicast routes on behalf of registering NVEs. + +Multiple copies of the BGP route, one per matching NVE host route, will be +added to VNC. In other words, for a given BGP unicast route, each instance of +a RFP-registered host route to the unicast route's next hop will result in an +instance of an imported VNC route. Each such imported VNC route will have a +prefix equal to the original BGP unicast route's prefix, and a next hop equal +to the next hop of the matching RFP-registered host route. If there is no +RFP-registered host route to the next hop of the BGP unicast route, no +corresponding VNC route will be imported. + +The following translations are applied: + +- The Next Hop is set to the next hop of the NVE route (i.e., the + VN address of the NVE). + +- The extended community list in the new route is set to the + union of: + +- Any extended communities in the original BGP route + + - Any extended communities in the NVE route + - An added route-origin extended community with the next hop of the + original BGP route + is added to the new route. + The value of the local administrator field defaults 5226 but may + be configured by the user via the `roo-ec-local-admin` parameter. + +- The Tunnel Encapsulation attribute is set to the value of the Tunnel + Encapsulation attribute of the NVE route, if any. + + +bgp-direct-to-nve-groups routes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Unicast routes from the main or a designated instance of BGP may be +redistributed to VNC as bgp-direct-to-nve-groups routes. These routes are NOT +announced via BGP, but they are made available for local RFP lookup in response +to queries from NVEs. + +A non-main/default BGP instance is configured using the `bgp multiple-instance` +and `router bgp AS view NAME` commands as described elsewhere in this document. + +In order for a route in the unicast BGP RIB to be made available to a querying +NVE, there must already be, available to that NVE, an (interior) VNC route +matching the next hop address of the unicast route. When the unicast route is +provided to the NVE, its next hop is replaced by the next hop of the +corresponding NVE. If there are multiple longest-prefix-match VNC routes, the +unicast route will be replicated for each. + +There is currently no policy (prefix-list or route-map) support for +`bgp-direct-to-nve-groups` routes. + +Redistribution Command Syntax +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. index:: vnc redistribute ipv4|ipv6 bgp|bgp-direct|ipv6 bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static +.. clicmd:: vnc redistribute ipv4|ipv6 bgp|bgp-direct|ipv6 bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static + +.. index:: vnc redistribute ipv4|ipv6 bgp-direct-to-nve-groups view VIEWNAME +.. clicmd:: vnc redistribute ipv4|ipv6 bgp-direct-to-nve-groups view VIEWNAME + +.. index:: no vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static +.. clicmd:: no vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static + + Import (or do not import) prefixes from another routing protocols. Specify + both the address family to import (`ipv4` or `ipv6`) and the protocol + (`bgp`, `bgp-direct`, `bgp-direct-to-nve-groups`, `connected`, `kernel`, + `ospf`, `rip`, or `static`). Repeat this statement as needed for each + combination of address family and routing protocol. Prefixes from protocol + `bgp-direct` are imported from unicast BGP in the same bgpd process. + Prefixes from all other protocols (including `bgp`) are imported via the + `zebra` kernel routing process. + +.. index:: vnc redistribute mode plain|nve-group|resolve-nve +.. clicmd:: vnc redistribute mode plain|nve-group|resolve-nve + + Redistribute routes from other protocols into VNC using the specified mode. + Not all combinations of modes and protocols are supported. + +.. index:: vnc redistribute nve-group GROUP-NAME +.. clicmd:: vnc redistribute nve-group GROUP-NAME + +.. index:: no vnc redistribute nve-group GROUP-NAME +.. clicmd:: no vnc redistribute nve-group GROUP-NAME + + When using `nve-group` mode, assign (or do not assign) the NVE group + `group-name` to routes redistributed from another routing protocol. + `group-name` must be configured using `vnc nve-group`. + + The VN and UN prefixes of the nve-group must both be configured, and each + prefix must be specified as a full-length (/32 for IPv4, /128 for IPv6) + prefix. + +.. index:: vnc redistribute lifetime LIFETIME|infinite +.. clicmd:: vnc redistribute lifetime LIFETIME|infinite + + Assign a registration lifetime, either `lifetime` seconds or `infinite`, to + prefixes redistributed from other routing protocols as if they had been + received via RFP registration messages from an NVE. `lifetime` can be any + integer between 1 and 4294967295, inclusive. + +.. index:: vnc redistribute resolve-nve roo-ec-local-admin 0-65536 +.. clicmd:: vnc redistribute resolve-nve roo-ec-local-admin 0-65536 + + Assign a value to the local-administrator subfield used in the + Route Origin extended community that is assigned to routes exported + under the `resolve-nve` mode. The default value is `5226`. + +The following four `prefix-list` and `route-map` commands may be specified +in the context of an nve-group or not. If they are specified in the context +of an nve-group, they apply only if the redistribution mode is `nve-group`, +and then only for routes being redistributed from `bgp-direct`. If they are +specified outside the context of an nve-group, then they apply only for +redistribution modes `plain` and `resolve-nve`, and then only for routes +being redistributed from `bgp-direct`. + +.. index:: vnc redistribute bgp-direct (ipv4|ipv6) prefix-list LIST-NAME +.. clicmd:: vnc redistribute bgp-direct (ipv4|ipv6) prefix-list LIST-NAME + + When redistributing `bgp-direct` routes, + specifies that the named prefix-list should be applied. + +.. index:: vnc redistribute bgp-direct no (ipv4|ipv6) prefix-list +.. clicmd:: vnc redistribute bgp-direct no (ipv4|ipv6) prefix-list + + When redistributing `bgp-direct` routes, + specifies that no prefix-list should be applied. + +.. index:: vnc redistribute bgp-direct route-map MAP-NAME +.. clicmd:: vnc redistribute bgp-direct route-map MAP-NAME + + When redistributing `bgp-direct` routes, + specifies that the named route-map should be applied. + +.. index:: vnc redistribute bgp-direct no route-map +.. clicmd:: vnc redistribute bgp-direct no route-map + + When redistributing `bgp-direct` routes, + specifies that no route-map should be applied. + +.. _configuring-export-of-routes-to-other-routing-protocols: + +Configuring Export of Routes to Other Routing Protocols +------------------------------------------------------- + +Routes from VNC (both for RFP and for redistribution via BGP) can be provided +to other protocols, either via zebra or directly to BGP. + +It is important to note that when exporting routes to other protocols, the +downstream protocol must also be configured to import the routes. For example, +when VNC routes are exported to unicast BGP, the BGP configuration must include +a corresponding `redistribute vnc-direct` statement. + +.. index:: export bgp|zebra mode none|group-nve|registering-nve|ce +.. clicmd:: export bgp|zebra mode none|group-nve|registering-nve|ce + + Specify how routes should be exported to bgp or zebra. If the mode is + `none`, routes are not exported. If the mode is `group-nve`, routes are + exported according to nve-group or vrf-policy group configuration + (:ref:`vnc-nve-group-configuration`): if a group is configured to allow + export, then each prefix visible to the group is exported with next hops set + to the currently-registered NVEs. If the mode is `registering-nve`, then all + VNC routes are exported with their original next hops. If the mode is `ce`, + only VNC routes that have an NVE connected CE Router encoded in a Route + Origin Extended Community are exported. This extended community must have an + administrative value that matches the configured `roo-ec-local-admin` value. + The next hop of the exported route is set to the encoded NVE connected CE + Router. + + The default for both bgp and zebra is mode `none`. + +.. index:: vnc export bgp|zebra group-nve group GROUP-NAME +.. clicmd:: vnc export bgp|zebra group-nve group GROUP-NAME + +.. index:: vnc export bgp|zebra group-nve no group GROUP-NAME +.. clicmd:: vnc export bgp|zebra group-nve no group GROUP-NAME + + When export mode is `group-nve`, export (or do not export) prefixes from the + specified nve-group or vrf-policy group to unicast BGP or to zebra. Repeat + this statement as needed for each nve-group to be exported. Each VNC prefix + that is exported will result in N exported routes to the prefix, each with a + next hop corresponding to one of the N NVEs currently associated with the + nve-group. + +Some commands have a special meaning under certain export modes. + +:clicmd:`export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME` + When export mode is `ce` or `registering-nve`, + specifies that the named prefix-list should be applied to routes + being exported to bgp or zebra. + Prefix-lists for ipv4 and ipv6 are independent of each other. + +:clicmd:`export bgp|zebra no ipv4|ipv6 prefix-list` + When export mode is `ce` or `registering-nve`, + specifies that no prefix-list should be applied to routes + being exported to bgp or zebra. + +:clicmd:`export bgp|zebra route-map MAP-NAME` + When export mode is `ce` or `registering-nve`, specifies that the named + route-map should be applied to routes being exported to bgp or zebra. + +:clicmd:`export bgp|zebra no route-map` + When export mode is `ce` or `registering-nve`, specifies that no route-map + should be applied to routes being exported to bgp or zebra. + + When the export mode is `group-nve`, policy for exported routes is specified + per-NVE-group or vrf-policy group inside a `nve-group` `RFG-NAME` block via + the following commands(:ref:`vnc-nve-group-configuration`): + +:clicmd:`export bgp|zebra route-map MAP-NAME` + This command is valid inside a `nve-group` `RFG-NAME` block. It specifies + that the named route-map should be applied to routes being exported to bgp + or zebra. + +:clicmd:`export bgp|zebra no route-map` + This command is valid inside a `nve-group` `RFG-NAME` block. It specifies + that no route-map should be applied to routes being exported to bgp or + zebra. + +:clicmd:`export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME` + This command is valid inside a `nve-group` `RFG-NAME` block. It specifies + that the named prefix-list filter should be applied to routes being exported + to bgp or zebra. Prefix-lists for ipv4 and ipv6 are independent of each + other. + +:clicmd:`export bgp|zebra no ipv4|ipv6 prefix-list` + This command is valid inside a `nve-group` `RFG-NAME` block. It specifies + that no prefix-list filter should be applied to routes being exported to + bgp or zebra. + +.. _manual-address-control: + +Manual Address Control +====================== + +The commands in this section can be used to augment normal dynamic VNC. The +`add vnc` commands can be used to manually add IP prefix or Ethernet MAC +address forwarding information. The `clear vnc` commands can be used to remove +manually and dynamically added information. + +.. clicmd:: add vnc prefix (A.B.C.D/M|X:X::X:X/M) vn (A.B.C.D|X:X::X:X) un (A.B.C.D|X:X::X:X) [cost (0-255)] [lifetime (infinite|(1-4294967295))] [local-next-hop (A.B.C.D|X:X::X:X) [local-cost (0-255)]] + + Register an IP prefix on behalf of the NVE identified by the VN and UN + addresses. The `cost` parameter provides the administrative preference of + the forwarding information for remote advertisement. If omitted, it defaults + to 255 (lowest preference). The `lifetime` parameter identifies the period, + in seconds, that the information remains valid. If omitted, it defaults to + `infinite`. The optional `local-next-hop` parameter is used to configure a + nexthop to be used by an NVE to reach the prefix via a locally connected CE + router. This information remains local to the NVA, i.e., not passed to other + NVAs, and is only passed to registered NVEs. When specified, it is also + possible to provide a `local-cost` parameter to provide a forwarding + preference. If omitted, it defaults to 255 (lowest preference). + +.. clicmd:: add vnc mac xx:xx:xx:xx:xx:xx virtual-network-identifier (1-4294967295) vn (A.B.C.D|X:X::X:X) un (A.B.C.D|X:X::X:X) [prefix (A.B.C.D/M|X:X::X:X/M)] [cost (0-255)] [lifetime (infinite|(1-4294967295))] + + Register a MAC address for a logical Ethernet (L2VPN) on behalf of the NVE + identified by the VN and UN addresses. The optional `prefix` parameter is to + support enable IP address mediation for the given prefix. The `cost` + parameter provides the administrative preference of the forwarding + information. If omitted, it defaults to 255. The `lifetime` parameter + identifies the period, in seconds, that the information remains valid. If + omitted, it defaults to `infinite`. + +.. clicmd:: clear vnc prefix (\*|A.B.C.D/M|X:X::X:X/M) (\*|[(vn|un) (A.B.C.D|X:X::X:X|\*) [(un|vn) (A.B.C.D|X:X::X:X|\*)] [mac xx:xx:xx:xx:xx:xx] [local-next-hop (A.B.C.D|X:X::X:X)]) + + Delete the information identified by prefix, VN address, and UN address. + Any or all of these parameters may be wilcarded to (potentially) match more + than one registration. The optional `mac` parameter specifies a layer-2 MAC + address that must match the registration(s) to be deleted. The optional + `local-next-hop` parameter is used to delete specific local nexthop + information. + +.. index:: clear vnc mac (\\*|xx:xx:xx:xx:xx:xx) virtual-network-identifier (\\*|(1-4294967295)) (\\*|[(vn|un) (A.B.C.D|X:X::X:X|\\*) [(un|vn) (A.B.C.D|X:X::X:X|\*)] [prefix (\\*|A.B.C.D/M|X:X::X:X/M)]) +.. clicmd:: clear vnc mac (\*|xx:xx:xx:xx:xx:xx) virtual-network-identifier (\*|(1-4294967295)) (\*|[(vn|un) (A.B.C.D|X:X::X:X|\*) [(un|vn) (A.B.C.D|X:X::X:X|\*)] [prefix (\*|A.B.C.D/M|X:X::X:X/M)]) + + Delete mac forwarding information. Any or all of these parameters may be + wilcarded to (potentially) match more than one registration. The default + value for the `prefix` parameter is the wildcard value `*`. + +.. index:: clear vnc nve (\*|((vn|un) (A.B.C.D|X:X::X:X) [(un|vn) (A.B.C.D|X:X::X:X)])) +.. clicmd:: clear vnc nve (\*|((vn|un) (A.B.C.D|X:X::X:X) [(un|vn) (A.B.C.D|X:X::X:X)])) + + Delete prefixes associated with the NVE specified by the given VN and UN + addresses. It is permissible to specify only one of VN or UN, in which case + any matching registration will be deleted. It is also permissible to specify + `*` in lieu of any VN or UN address, in which case all registrations will + match. + +.. _other-vnc-related-commands: + +Other VNC-Related Commands +========================== + +Note: VNC-Related configuration can be obtained via the `show +running-configuration` command when in `enable` mode. + +The following commands are used to clear and display Virtual Network Control +related information: + +.. index:: clear vnc counters +.. clicmd:: clear vnc counters + + Reset the counter values stored by the NVA. Counter + values can be seen using the `show vnc` commands listed above. This + command is only available in `enable` mode. + +.. index:: show vnc summary +.. clicmd:: show vnc summary + + Print counter values and other general information + about the NVA. Counter values can be reset + using the `clear vnc counters` command listed below. + +.. index:: show vnc nves +.. clicmd:: show vnc nves + +.. index:: show vnc nves vn|un ADDRESS +.. clicmd:: show vnc nves vn|un ADDRESS + + Display the NVA's current clients. Specifying `address` limits the output to + the NVEs whose addresses match `address`. The time since the NVA last + communicated with the NVE, per-NVE summary counters and each NVE's addresses + will be displayed. + +.. index:: show vnc queries +.. clicmd:: show vnc queries + +.. index:: show vnc queries PREFIX +.. clicmd:: show vnc queries PREFIX + + Display active Query information. Queries remain valid for the default + Response Lifetime (:ref:`vnc-defaults-configuration`) or NVE-group Response + Lifetime (:ref:`vnc-nve-group-configuration`). Specifying `prefix` limits + the output to Query Targets that fall within `prefix`. + + Query information is provided for each querying NVE, and includes the Query + Target and the time remaining before the information is removed. + +.. index:: show vnc registrations [all|local|remote|holddown|imported] +.. clicmd:: show vnc registrations [all|local|remote|holddown|imported] + +.. index:: show vnc registrations [all|local|remote|holddown|imported] PREFIX +.. clicmd:: show vnc registrations [all|local|remote|holddown|imported] PREFIX + + Display local, remote, holddown, and/or imported registration information. + Local registrations are routes received via RFP, which are present in the + NVA Registrations Cache. Remote registrations are routes received via BGP + (VPN SAFIs), which are present in the NVE-group import tables. Holddown + registrations are local and remote routes that have been withdrawn but whose + holddown timeouts have not yet elapsed. Imported information represents + routes that are imported into NVA and are made available to querying NVEs. + Depending on configuration, imported routes may also be advertised via BGP. + Specifying `prefix` limits the output to the registered prefixes that fall + within `prefix`. + + Registration information includes the registered prefix, the registering NVE + addresses, the registered administrative cost, the registration lifetime and + the time since the information was registered or, in the case of Holddown + registrations, the amount of time remaining before the information is + removed. + +.. index:: show vnc responses [active|removed] +.. clicmd:: show vnc responses [active|removed] + +.. index:: show vnc responses [active|removed] PREFIX +.. clicmd:: show vnc responses [active|removed] PREFIX + + Display all, active and/or removed response information which are + present in the NVA Responses Cache. Responses remain valid for the + default Response Lifetime (:ref:`vnc-defaults-configuration`) or + NVE-group Response Lifetime (:ref:`vnc-nve-group-configuration`.) + When Removal Responses are enabled (:ref:`general-vnc-configuration`), + such responses are listed for the Response Lifetime. Specifying + `prefix` limits the output to the addresses that fall within + `prefix`. + + Response information is provided for each querying NVE, and includes + the response prefix, the prefix-associated registering NVE addresses, + the administrative cost, the provided response lifetime and the time + remaining before the information is to be removed or will become inactive. + +.. index:: show memory vnc +.. clicmd:: show memory vnc + + Print the number of memory items allocated by the NVA. + +.. _example-vnc-and-vnc-gw-configurations: + +Example VNC and VNC-GW Configurations +===================================== + +.. _vnc-mesh-nva-config: + +Mesh NVA Configuration +---------------------- + +This example includes three NVAs, nine NVEs, and two NVE groups. Note that +while not shown, a single physical device may support multiple logical NVEs. +:ref:`vnc-fig-vnc-mesh` shows ``code NVA-1`` (192.168.1.100), ``NVA 2`` +(192.168.1.101), and ``NVA 3`` (192.168.1.102), which are connected in a full +mesh. Each is a member of the autonomous system 64512. Each NVA provides VNC +services to three NVE clients in the 172.16.0.0/16 virtual-network address +range. The 172.16.0.0/16 address range is partitioned into two NVE groups, +``group1`` (172.16.0.0/17) and ``group2`` (172.16.128.0/17). + +Each NVE belongs to either NVE group ``group1`` or NVE group ``group2``. The +NVEs ``NVE 1``, ``NVE 2``, ``NVE 4``, ``NVE 7``, and ``NVE 8`` are members of +the NVE group ``group1``. The NVEs ``NVE 3``, ``NVE 5``, ``NVE 6``, and ``NVE +9`` are members of the NVE group ``group2``. + +Each NVA advertises NVE underlay-network IP addresses using the +Tunnel Encapsulation Attribute. + +.. _vnc-fig-vnc-mesh: + +.. figure:: ../figures/fig-vnc-mesh.png + :align: center + :alt: Three-way Mesh + + A three-way full mesh with three NVEs per NVA. + +:file:`bgpd.conf` for ``NVA 1`` (192.168.1.100)::: + + router bgp 64512 + + bgp router-id 192.168.1.100 + + neighbor 192.168.1.101 remote-as 64512 + neighbor 192.168.1.102 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.101 activate + neighbor 192.168.1.102 activate + exit-address-family + + vnc defaults + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + + vnc nve-group group1 + prefix vn 172.16.0.0/17 + rt both 1000:1 + exit-vnc + + vnc nve-group group2 + prefix vn 172.16.128.0/17 + rt both 1000:2 + exit-vnc + + exit + +:file:`bgpd.conf` for ``NVA 2`` (192.168.1.101)::: + + router bgp 64512 + + bgp router-id 192.168.1.101 + + neighbor 192.168.1.100 remote-as 64512 + neighbor 192.168.1.102 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + neighbor 192.168.1.102 activate + exit-address-family + + vnc nve-group group1 + prefix vn 172.16.0.0/17 + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + exit + +:file:`bgpd.conf` for ``NVA 3`` (192.168.1.102)::: + + router bgp 64512 + + bgp router-id 192.168.1.102 + + neighbor 192.168.1.101 remote-as 64512 + neighbor 192.168.1.102 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + neighbor 192.168.1.101 activate + exit-address-family + + vnc defaults + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + + vnc nve-group group1 + prefix vn 172.16.128.0/17 + exit-vnc + exit + + +Mesh NVA and VNC-GW Configuration +--------------------------------- + +This example includes two NVAs, each with two associated NVEs, and two VNC-GWs, +each supporting two CE routers physically attached to the four NVEs. Note that +this example is showing a more complex configuration where VNC-GW is separated +from normal NVA functions; it is equally possible to simplify the configuration +and combine NVA and VNC-GW functions in a single FRR instance. + +.. _vnc-fig-vnc-gw: +.. figure:: ../figures/fig-vnc-gw.png + :align: center + :alt: FRR VNC Gateway + + Meshed NVEs and VNC-GWs + +As shown in :ref:`vnc-fig-vnc-gw`, NVAs and VNC-GWs are connected in a full iBGP +mesh. The VNC-GWs each have two CEs configured as route-reflector clients. +Each client provides BGP updates with unicast routes that the VNC-GW reflects +to the other client. The VNC-GW also imports these unicast routes into VPN +routes to be shared with the other VNC-GW and the two NVAs. This route +importation is controlled with the ``vnc redistribute`` statements shown in the +configuration. Similarly, registrations sent by NVEs via RFP to the NVAs are +exported by the VNC-GWs to the route-reflector clients as unicast routes. RFP +registrations exported this way have a next-hop address of the CE behind the +connected (registering) NVE. Exporting VNC routes as IPv4 unicast is enabled +with the ``vnc export`` command below. + +The configuration for ``VNC-GW 1`` is shown below.:: + + router bgp 64512 + bgp router-id 192.168.1.101 + bgp cluster-id 1.2.3.4 + neighbor 192.168.1.102 remote-as 64512 + neighbor 192.168.1.103 remote-as 64512 + neighbor 192.168.1.104 remote-as 64512 + neighbor 172.16.1.2 remote-as 64512 + neighbor 172.16.2.2 remote-as 64512 + ! + address-family ipv4 unicast + redistribute vnc-direct + no neighbor 192.168.1.102 activate + no neighbor 192.168.1.103 activate + no neighbor 192.168.1.104 activate + neighbor 172.16.1.2 route-reflector-client + neighbor 172.16.2.2 route-reflector-client + exit-address-family + ! + address-family ipv4 vpn + neighbor 192.168.1.102 activate + neighbor 192.168.1.103 activate + neighbor 192.168.1.104 activate + exit-address-family + vnc export bgp mode ce + vnc redistribute mode resolve-nve + vnc redistribute ipv4 bgp-direct + exit + +Note that in the VNC-GW configuration, the neighboring VNC-GW and NVAs each +have a statement disabling the IPv4 unicast address family. IPv4 unicast is on +by default and this prevents the other VNC-GW and NVAs from learning unicast +routes advertised by the route-reflector clients. + +Configuration for ``NVA 2``::: + + router bgp 64512 + bgp router-id 192.168.1.104 + neighbor 192.168.1.101 remote-as 64512 + neighbor 192.168.1.102 remote-as 64512 + neighbor 192.168.1.103 remote-as 64512 + ! + address-family ipv4 unicast + no neighbor 192.168.1.101 activate + no neighbor 192.168.1.102 activate + no neighbor 192.168.1.103 activate + exit-address-family + ! + address-family ipv4 vpn + neighbor 192.168.1.101 activate + neighbor 192.168.1.102 activate + neighbor 192.168.1.103 activate + exit-address-family + ! + vnc defaults + response-lifetime 3600 + exit-vnc + vnc nve-group nve1 + prefix vn 172.16.1.1/32 + response-lifetime 3600 + rt both 1000:1 1000:2 + exit-vnc + vnc nve-group nve2 + prefix vn 172.16.2.1/32 + response-lifetime 3600 + rt both 1000:1 1000:2 + exit-vnc + exit + +.. TBD make this its own example: +.. +.. @float Figure,fig:fig-vnc-gw-rr +.. @center @image{fig-vnc-gw-rr,400pt,,Frr VNC Gateway with RR} +.. @end float +.. An NVA can also import unicast routes from BGP without advertising the +.. imported routes as VPN routes. Such imported routes, while not +.. distributed to other NVAs or VNC-GWs, are are available to NVEs via +.. RFP query messages sent to the NVA. @ref{fig:fig-vnc-gw-rr} +.. shows an example topology where unicast routes are imported into NVAs +.. from a Route Reflector. (@pxref{Route Reflector} for route reflector +.. configuration details.) The following three lines can be added to the +.. ``NVA 1`` and ``NVA 2`` configurations to import routes into VNC +.. for local VNC use: +.. +.. @verbatim +.. neighbor 192.168.1.105 remote-as 64512 +.. vnc redistribute mode plain +.. vnc redistribute ipv4 bgp-direct-to-nve-groups +.. @end verbatim + +.. _vnc-with-frr-route-reflector-config: + +VNC with FRR Route Reflector Configuration +------------------------------------------ + +A route reflector eliminates the need for a fully meshed NVA network by acting +as the hub between NVAs. :ref:`vnc-fig-vnc-frr-route-reflector` shows BGP +route reflector ``BGP Route Reflector 1`` (192.168.1.100) as a route reflector +for NVAs ``NVA 2``(192.168.1.101) and ``NVA 3`` (192.168.1.102). + +.. _vnc-fig-vnc-frr-route-reflector: +.. figure:: ../figures/fig-vnc-frr-route-reflector.png + :align: center + :alt: FRR Route Reflector + + Two NVAs and a BGP Route Reflector + +``NVA 2`` and ``NVA 3`` advertise NVE underlay-network IP addresses using the +Tunnel Encapsulation Attribute. ``BGP Route Reflector 1`` ``reflects'' +advertisements from ``NVA 2`` to ``NVA 3`` and vice versa. + +As in the example of :ref:`vnc-mesh-nva-config`, there are two NVE groups. The +172.16.0.0/16 address range is partitioned into two NVE groups, ``group1`` +(172.16.0.0/17) and ``group2`` (172.16.128.0/17). The NVE ``NVE 4``, ``NVE +7``, and ``NVE 8`` are members of the NVE group ``group1``. The NVEs ``NVE +5``, ``NVE 6``, and ``NVE 9`` are members of the NVE group ``group2``. + +:file:`bgpd.conf` for ``BGP Route Reflector 1`` on 192.168.1.100::: + + router bgp 64512 + + bgp router-id 192.168.1.100 + + neighbor 192.168.1.101 remote-as 64512 + neighbor 192.168.1.101 port 7179 + neighbor 192.168.1.101 description iBGP-client-192-168-1-101 + + neighbor 192.168.1.102 remote-as 64512 + neighbor 192.168.1.102 port 7179 + neighbor 192.168.1.102 description iBGP-client-192-168-1-102 + + address-family ipv4 unicast + neighbor 192.168.1.101 route-reflector-client + neighbor 192.168.1.102 route-reflector-client + exit-address-family + + address-family ipv4 vpn + neighbor 192.168.1.101 activate + neighbor 192.168.1.102 activate + + neighbor 192.168.1.101 route-reflector-client + neighbor 192.168.1.102 route-reflector-client + exit-address-family + + exit + +:file:`bgpd.conf` for ``NVA 2`` on 192.168.1.101::: + + router bgp 64512 + + bgp router-id 192.168.1.101 + + neighbor 192.168.1.100 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + exit-address-family + + vnc nve-group group1 + prefix vn 172.16.0.0/17 + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + exit + +:file:`bgpd.conf` for ``NVA 2`` on 192.168.1.102::: + + router bgp 64512 + + bgp router-id 192.168.1.102 + + neighbor 192.168.1.100 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + exit-address-family + + vnc defaults + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + + vnc nve-group group1 + prefix vn 172.16.128.0/17 + exit-vnc + exit + +While not shown, an NVA can also be configured as a route reflector. + +.. _vnc-with-commercial-route-reflector-config: + +VNC with Commercial Route Reflector Configuration +------------------------------------------------- + +This example is identical to :ref:`vnc-with-frr-route-reflector-config` +with the exception that the route reflector is a commercial router. Only the +VNC-relevant configuration is provided. + +.. figure:: ../figures/fig-vnc-commercial-route-reflector.png + :align: center + :alt: Commercial Route Reflector + + Two NVAs with a commercial route reflector + +:file:`bgpd.conf` for BGP route reflector ``Commercial Router`` on 192.168.1.104::: + + version 8.5R1.13; + routing-options { + rib inet.0 { + static { + route 172.16.0.0/16 next-hop 192.168.1.104; + } + } + autonomous-system 64512; + resolution { + rib inet.3 { + resolution-ribs inet.0; + } + rib bgp.l3vpn.0 { + resolution-ribs inet.0; + } + } + } + protocols { + bgp { + advertise-inactive; + family inet { + labeled-unicast; + } + group 1 { + type internal; + advertise-inactive; + advertise-peer-as; + import h; + family inet { + unicast; + } + family inet-vpn { + unicast; + } + cluster 192.168.1.104; + neighbor 192.168.1.101; + neighbor 192.168.1.102; + } + } + } + policy-options { + policy-statement h { + from protocol bgp; + then { + as-path-prepend 64512; + accept; + } + } + } + +:file:`bgpd.conf` for ``NVA 2`` on 192.168.1.101::: + + router bgp 64512 + + bgp router-id 192.168.1.101 + + neighbor 192.168.1.100 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + exit-address-family + + vnc nve-group group1 + prefix vn 172.16.0.0/17 + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + exit + +:file:`bgpd.conf` for ``NVA 3`` on 192.168.1.102::: + + router bgp 64512 + + bgp router-id 192.168.1.102 + + neighbor 192.168.1.100 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + exit-address-family + + vnc defaults + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + + vnc nve-group group1 + prefix vn 172.16.128.0/17 + exit-vnc + exit + +VNC with Redundant Route Reflectors Configuration +------------------------------------------------- + +This example combines the previous two +(:ref:`vnc-with-frr-route-reflector-config` and +:ref:`vnc-with-commercial-route-reflector-config`) into a redundant route +reflector configuration. BGP route reflectors ``BGP Route Reflector 1`` and +``Commercial Router`` are the route reflectors for NVAs ``NVA 2`` and ``NVA +3``. The two NVAs have connections to both route reflectors. + +.. figure:: ../figures/fig-vnc-redundant-route-reflectors.png + :align: center + :alt: Redundant Route Reflectors + + FRR-based NVA with redundant route reflectors + +:file:`bgpd.conf` for ``Bgpd Route Reflector 1`` on 192.168.1.100::: + + router bgp 64512 + + bgp router-id 192.168.1.100 + bgp cluster-id 192.168.1.100 + + neighbor 192.168.1.104 remote-as 64512 + + neighbor 192.168.1.101 remote-as 64512 + neighbor 192.168.1.101 description iBGP-client-192-168-1-101 + neighbor 192.168.1.101 route-reflector-client + + neighbor 192.168.1.102 remote-as 64512 + neighbor 192.168.1.102 description iBGP-client-192-168-1-102 + neighbor 192.168.1.102 route-reflector-client + + address-family ipv4 vpn + neighbor 192.168.1.101 activate + neighbor 192.168.1.102 activate + neighbor 192.168.1.104 activate + + neighbor 192.168.1.101 route-reflector-client + neighbor 192.168.1.102 route-reflector-client + exit-address-family + exit + +:file:`bgpd.conf` for ``NVA 2`` on 192.168.1.101::: + + router bgp 64512 + + bgp router-id 192.168.1.101 + + neighbor 192.168.1.100 remote-as 64512 + neighbor 192.168.1.104 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + neighbor 192.168.1.104 activate + exit-address-family + + vnc nve-group group1 + prefix vn 172.16.0.0/17 + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + exit + +:file:`bgpd.conf` for ``NVA 3`` on 192.168.1.102::: + + router bgp 64512 + + bgp router-id 192.168.1.102 + + neighbor 192.168.1.100 remote-as 64512 + neighbor 192.168.1.104 remote-as 64512 + + address-family ipv4 vpn + neighbor 192.168.1.100 activate + neighbor 192.168.1.104 activate + exit-address-family + + vnc defaults + rd 64512:1 + response-lifetime 200 + rt both 1000:1 1000:2 + exit-vnc + + vnc nve-group group1 + prefix vn 172.16.128.0/17 + exit-vnc + exit + +:file:`bgpd.conf` for the Commercial Router route reflector on 192.168.1.104::: + + routing-options { + rib inet.0 { + static { + route 172.16.0.0/16 next-hop 192.168.1.104; + } + } + autonomous-system 64512; + resolution { + rib inet.3 { + resolution-ribs inet.0; + } + rib bgp.l3vpn.0 { + resolution-ribs inet.0; + } + } + } + protocols { + bgp { + advertise-inactive; + family inet { + labeled-unicast; + } + group 1 { + type internal; + advertise-inactive; + advertise-peer-as; + import h; + family inet { + unicast; + } + family inet-vpn { + unicast; + } + cluster 192.168.1.104; + neighbor 192.168.1.101; + neighbor 192.168.1.102; + } + + group 2 { + type internal; + advertise-inactive; + advertise-peer-as; + import h; + family inet { + unicast; + } + family inet-vpn { + unicast; + } + neighbor 192.168.1.100; + } + + } + } + policy-options { + policy-statement h { + from protocol bgp; + then { + as-path-prepend 64512; + accept; + } + } + } + +.. [#] The nve-id is carriedin the route distinguisher. It is the second octet + of the eight-octet route distinguisher generated for Ethernet / L2 + advertisements. The first octet is a constant 0xFF, and the third + through eighth octets are set to the L2 + ethernet address being advertised. + diff --git a/doc/user/vtysh.rst b/doc/user/vtysh.rst new file mode 100644 index 000000000..52d54f412 --- /dev/null +++ b/doc/user/vtysh.rst @@ -0,0 +1,163 @@ +.. _vty-shell: + +********* +VTY shell +********* + +.. program:: configure + +*vtysh* provides a combined frontend to all FRR daemons in a single combined +session. It is enabled by default at build time, but can be disabled through +the :option:`--disable-vtysh` option to the configure script. + +*vtysh* has a configuration file, :file:`vtysh.conf`. The location of that +file cannot be changed from |INSTALL_PREFIX_ETC| since it contains options +controlling authentication behavior. This file will also not be written by +configuration-save commands, it is intended to be updated manually by an +administrator with an external editor. + +.. warning:: + + This also means the ``hostname`` and ``banner motd`` commands (which both do + have effect for vtysh) need to be manually updated in :file:`vtysh.conf`. + + +Permissions and setup requirements +================================== + +*vtysh* connects to running daemons through Unix sockets located in +|INSTALL_PREFIX_STATE|. Running vtysh thus requires access to that directory, +plus membership in the |INSTALL_VTY_GROUP| group (which is the group that the +daemons will change ownership of their sockets to). + +To restrict access to FRR configuration, make sure no unauthorized users are +members of the |INSTALL_VTY_GROUP| group. + +PAM support (experimental) +-------------------------- + +vtysh has working (but rather useless) PAM support. It will perform an +"authenticate" PAM call using |PACKAGE_NAME| as service name. No other +(accounting, session, password change) calls will be performed by vtysh. + +Users using vtysh still need to have appropriate access to the daemons' VTY +sockets, usually by being member of the |INSTALL_VTY_GROUP| group. If they +have this membership, PAM support is useless since they can connect to daemons +and issue commands using some other tool. Alternatively, the *vtysh* binary +could be made SGID (set group ID) to the |INSTALL_VTY_GROUP| group. + +.. warning:: + + No security guarantees are made for this configuration. + + +.. index:: username USERNAME nopassword +.. clicmd:: username USERNAME nopassword + + If PAM support is enabled at build-time, this command allows disabling the + use of PAM on a per-user basis. If vtysh finds that an user is trying to + use vtysh and a "nopassword" entry is found, no calls to PAM will be made + at all. + + +.. _integrated-configuration-mode: + +Integrated configuration mode +============================= + +Integrated configuration mode uses a single configuration file, +:file:`frr.conf`, for all daemons. This replaces the individual files like +:file:`zebra.conf` or :file:`bgpd.conf`. + +:file:`frr.conf` is located in |INSTALL_PREFIX_ETC|. All daemons check for the +existence of this file at startup, and if it exists will not load their +individual configuration files. Instead, ``vtysh -b`` must be invoked to +process :file:`frr.conf` and apply its settings to the individual daemons. + +.. warning:: + + *vtysh -b* must also be executed after restarting any daemon. + + +Configuration saving, file ownership and permissions +---------------------------------------------------- + +The :file:`frr.conf` file is not written by any of the daemons; instead *vtysh* +contains the neccessary logic to collect configuration from all of the daemons, +combine it and write it out. + +.. warning:: + + Daemons must be running for *vtysh* to be able to collect their + configuration. Any configuration from non-running daemons is permanently + lost after doing a configuration save. + +Since the *vtysh* command may be running as ordinary user on the system, +configuration writes will be tried through *watchfrr*, using the ``write +integrated`` command internally. Since *watchfrr* is running as superuser, +*vtysh* is able to ensure correct ownership and permissions on +:file:`frr.conf`. + +If *watchfrr* is not running or the configuration write fails, *vtysh* will +attempt to directly write to the file. This is likely to fail if running as +unprivileged user; alternatively it may leave the file with incorrect owner or +permissions. + +Writing the configuration can be triggered directly by invoking *vtysh -w*. +This may be useful for scripting. Note this command should be run as either the +superuser or the FRR user. + +We recommend you do not mix the use of the two types of files. Further, it is +better not to use the integrated :file:`frr.conf` file, as any syntax error in +it can lead to /all/ of your daemons being unable to start up. Per daemon files +are more robust as impact of errors in configuration are limited to the daemon +in whose file the error is made. + +.. index:: service integrated-vtysh-config +.. clicmd:: service integrated-vtysh-config + +.. index:: no service integrated-vtysh-config +.. clicmd:: no service integrated-vtysh-config + + Control whether integrated :file:`frr.conf` file is written when + 'write file' is issued. + + These commands need to be placed in :file:`vtysh.conf` to have any effect. + Note that since :file:`vtysh.conf` is not written by FRR itself, they + therefore need to be manually placed in that file. + + This command has 3 states: + + + service integrated-vtysh-config + *vtysh* will always write :file:`frr.conf`. + + + no service integrated-vtysh-config + *vtysh* will never write :file:`frr.conf`; instead it will ask + daemons to write their individual configuration files. + + Neither option present (default) + *vtysh* will check whether :file:`frr.conf` exists. If it does, + configuration writes will update that file. Otherwise, writes are performed + through the individual daemons. + + This command is primarily intended for packaging/distribution purposes, to + preset one of the two operating modes and ensure consistent operation across + installations. + +.. index:: write integrated +.. clicmd:: write integrated + + Unconditionally (regardless of ``service integrated-vtysh-config`` setting) + write out integrated :file:`frr.conf` file through *watchfrr*. If *watchfrr* + is not running, this command is unavailable. + +.. warning:: + + Configuration changes made while some daemon is not running will be + invisible to that daemon. The daemon will start up with its saved + configuration (either in its individual configuration file, or in + :file:`frr.conf`). This is particularly troublesome for route-maps and + prefix lists, which would otherwise be synchronized between daemons. + diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst new file mode 100644 index 000000000..70a69cf0d --- /dev/null +++ b/doc/user/zebra.rst @@ -0,0 +1,628 @@ +.. _zebra: + +***** +Zebra +***** + +*zebra* is an IP routing manager. It provides kernel routing +table updates, interface lookups, and redistribution of routes between +different routing protocols. + +.. _invoking-zebra: + +Invoking zebra +============== + +Besides the common invocation options (:ref:`common-invocation-options`), the +*zebra* specific invocation options are listed below. + +.. program:: zebra + +.. option:: -b +.. option:: --batch + + Runs in batch mode. *zebra* parses configuration file and terminates + immediately. + +.. option:: -k +.. option:: --keep_kernel + + When zebra starts up, don't delete old self inserted routes. + +.. option:: -r +.. option:: --retain + + When program terminates, retain routes added by zebra. + +.. program:: configure + +.. _interface-commands: + +Interface Commands +================== + +.. _standard-commands: + +Standard Commands +----------------- + +.. index:: interface IFNAME + +.. clicmd:: interface IFNAME + +.. index:: shutdown + +.. clicmd:: shutdown +.. index:: no shutdown + +.. clicmd:: no shutdown + + Up or down the current interface. + +.. index:: ip address ADDRESS/PREFIX + +.. clicmd:: ip address ADDRESS/PREFIX +.. index:: ipv6 address ADDRESS/PREFIX + +.. clicmd:: ipv6 address ADDRESS/PREFIX +.. index:: no ip address ADDRESS/PREFIX + +.. clicmd:: no ip address ADDRESS/PREFIX +.. index:: no ipv6 address ADDRESS/PREFIX + +.. clicmd:: no ipv6 address ADDRESS/PREFIX + + Set the IPv4 or IPv6 address/prefix for the interface. + +.. index:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX + +.. clicmd:: ip address LOCAL-ADDR peer PEER-ADDR/PREFIX +.. index:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX + +.. clicmd:: no ip address LOCAL-ADDR peer PEER-ADDR/PREFIX + + Configure an IPv4 Pointopoint address on the interface. (The concept of PtP + addressing does not exist for IPv6.) + + `local-addr` has no subnet mask since the local side in PtP addressing is + always a single (/32) address. `peer-addr/prefix` can be an arbitrary subnet + behind the other end of the link (or even on the link in Point-to-Multipoint + setups), though generally /32s are used. + +.. index:: ip address ADDRESS/PREFIX secondary + +.. clicmd:: ip address ADDRESS/PREFIX secondary +.. index:: no ip address ADDRESS/PREFIX secondary + +.. clicmd:: no ip address ADDRESS/PREFIX secondary + + Set the secondary flag for this address. This causes ospfd to not treat the + address as a distinct subnet. + +.. index:: description DESCRIPTION ... + +.. clicmd:: description DESCRIPTION ... + + Set description for the interface. + +.. index:: multicast + +.. clicmd:: multicast +.. index:: no multicast + +.. clicmd:: no multicast + + Enable or disables multicast flag for the interface. + +.. index:: bandwidth (1-10000000) + +.. clicmd:: bandwidth (1-10000000) +.. index:: no bandwidth (1-10000000) + +.. clicmd:: no bandwidth (1-10000000) + + Set bandwidth value of the interface in kilobits/sec. This is for + calculating OSPF cost. This command does not affect the actual device + configuration. + +.. index:: link-detect + +.. clicmd:: link-detect +.. index:: no link-detect + +.. clicmd:: no link-detect + + Enable/disable link-detect on platforms which support this. Currently only + Linux and Solaris, and only where network interface drivers support + reporting link-state via the ``IFF_RUNNING`` flag. + +.. _link-parameters-commands: + +Link Parameters Commands +------------------------ + +.. index:: link-params +.. clicmd:: link-params + +.. index:: no link-param +.. clicmd:: no link-param + + Enter into the link parameters sub node. At least 'enable' must be set to + activate the link parameters, and consequently Traffic Engineering on this + interface. MPLS-TE must be enable at the OSPF + (:ref:`ospf-traffic-engineering`) or ISIS (:ref:`isis-traffic-engineering`) + router level in complement to this. Disable link parameters for this + interface. + + Under link parameter statement, the following commands set the different TE values: + +.. index:: link-params [enable] +.. clicmd:: link-params [enable] + + Enable link parameters for this interface. + +.. index:: link-params [metric (0-4294967295)] +.. clicmd:: link-params [metric (0-4294967295)] + +.. index:: link-params max-bw BANDWIDTH +.. clicmd:: link-params max-bw BANDWIDTH + +.. index:: link-params max-rsv-bw BANDWIDTH +.. clicmd:: link-params max-rsv-bw BANDWIDTH + +.. index:: link-params unrsv-bw (0-7) BANDWIDTH +.. clicmd:: link-params unrsv-bw (0-7) BANDWIDTH + +.. index:: link-params admin-grp BANDWIDTH +.. clicmd:: link-params admin-grp BANDWIDTH + + These commands specifies the Traffic Engineering parameters of the interface + in conformity to RFC3630 (OSPF) or RFC5305 (ISIS). There are respectively + the TE Metric (different from the OSPF or ISIS metric), Maximum Bandwidth + (interface speed by default), Maximum Reservable Bandwidth, Unreserved + Bandwidth for each 0-7 priority and Admin Group (ISIS) or Resource + Class/Color (OSPF). + + Note that BANDIWDTH is specified in IEEE floating point format and express + in Bytes/second. + +.. index:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] +.. clicmd:: link-param delay (0-16777215) [min (0-16777215) | max (0-16777215)] + +.. index:: link-param delay-variation (0-16777215) +.. clicmd:: link-param delay-variation (0-16777215) + +.. index:: link-param packet-loss PERCENTAGE +.. clicmd:: link-param packet-loss PERCENTAGE + +.. index:: link-param res-bw BANDWIDTH +.. clicmd:: link-param res-bw BANDWIDTH + +.. index:: link-param ava-bw BANDWIDTH +.. clicmd:: link-param ava-bw BANDWIDTH + +.. index:: link-param use-bw BANDWIDTH +.. clicmd:: link-param use-bw BANDWIDTH + + These command specifies additionnal Traffic Engineering parameters of the + interface in conformity to draft-ietf-ospf-te-metrics-extension-05.txt and + draft-ietf-isis-te-metrics-extension-03.txt. There are respectively the + delay, jitter, loss, available bandwidth, reservable bandwidth and utilized + bandwidth. + + Note that BANDWIDTH is specified in IEEE floating point format and express + in Bytes/second. Delays and delay variation are express in micro-second + (µs). Loss is specified in PERCENTAGE ranging from 0 to 50.331642% by step + of 0.000003. + +.. index:: link-param neighbor <A.B.C.D> as (0-65535) +.. clicmd:: link-param neighbor <A.B.C.D> as (0-65535) + +.. index:: link-param no neighbor +.. clicmd:: link-param no neighbor + + Specifies the remote ASBR IP address and Autonomous System (AS) number + for InterASv2 link in OSPF (RFC5392). Note that this option is not yet + supported for ISIS (RFC5316). + +.. _static-route-commands: + +Static Route Commands +===================== + +Static routing is a very fundamental feature of routing technology. It +defines static prefix and gateway. + +.. index:: ip route NETWORK GATEWAY +.. clicmd:: ip route NETWORK GATEWAY + + NETWORK is destination prefix with format of A.B.C.D/M. GATEWAY is gateway + for the prefix. When GATEWAY is A.B.C.D format. It is taken as a IPv4 + address gateway. Otherwise it is treated as an interface name. If the + interface name is ``null0`` then zebra installs a blackhole route. + + Some example configuration: + + :: + ip route 10.0.0.0/8 10.0.0.2 + ip route 10.0.0.0/8 ppp0 + ip route 10.0.0.0/8 null0 + + First example defines 10.0.0.0/8 static route with gateway 10.0.0.2. + Second one defines the same prefix but with gateway to interface ppp0. The + third install a blackhole route. + +.. index:: ip route NETWORK NETMASK GATEWAY +.. clicmd:: ip route NETWORK NETMASK GATEWAY + + This is alternate version of above command. When NETWORK is + A.B.C.D format, user must define NETMASK value with A.B.C.D + format. GATEWAY is same option as above command. + + :: + + ip route 10.0.0.0 255.255.255.0 10.0.0.2 + ip route 10.0.0.0 255.255.255.0 ppp0 + ip route 10.0.0.0 255.255.255.0 null0 + + + These statements are equivalent to those in the previous example. + +.. index:: ip route NETWORK GATEWAY DISTANCE +.. clicmd:: ip route NETWORK GATEWAY DISTANCE + + Installs the route with the specified distance. + +Multiple nexthop static route + +:: + + ip route 10.0.0.1/32 10.0.0.2 + ip route 10.0.0.1/32 10.0.0.3 + ip route 10.0.0.1/32 eth0 + + +If there is no route to 10.0.0.2 and 10.0.0.3, and interface eth0 +is reachable, then the last route is installed into the kernel. + +If zebra has been compiled with multipath support, and both 10.0.0.2 and +10.0.0.3 are reachable, zebra will install a multipath route via both +nexthops, if the platform supports this. + +:: + + zebra> show ip route + S> 10.0.0.1/32 [1/0] via 10.0.0.2 inactive + via 10.0.0.3 inactive + * is directly connected, eth0 + + +:: + + ip route 10.0.0.0/8 10.0.0.2 + ip route 10.0.0.0/8 10.0.0.3 + ip route 10.0.0.0/8 null0 255 + + +This will install a multihop route via the specified next-hops if they are +reachable, as well as a high-metric blackhole route, which can be useful to +prevent traffic destined for a prefix to match less-specific routes (eg +default) should the specified gateways not be reachable. Eg: + +:: + + zebra> show ip route 10.0.0.0/8 + Routing entry for 10.0.0.0/8 + Known via "static", distance 1, metric 0 + 10.0.0.2 inactive + 10.0.0.3 inactive + + Routing entry for 10.0.0.0/8 + Known via "static", distance 255, metric 0 + directly connected, Null0 + + +.. index:: ipv6 route NETWORK GATEWAY +.. clicmd:: ipv6 route NETWORK GATEWAY + +.. index:: ipv6 route NETWORK GATEWAY DISTANCE +.. clicmd:: ipv6 route NETWORK GATEWAY DISTANCE + + These behave similarly to their ipv4 counterparts. + +.. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY +.. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY + +.. index:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE +.. clicmd:: ipv6 route NETWORK from SRCPREFIX GATEWAY DISTANCE + + Install a static source-specific route. These routes are currently supported + on Linux operating systems only, and perform AND matching on packet's + destination and source addresses in the kernel's forwarding path. Note that + destination longest-prefix match is "more important" than source LPM, e.g. + *"2001:db8:1::/64 from 2001:db8::/48"* will win over + *"2001:db8::/48 from 2001:db8:1::/64"* if both match. + +.. index:: table TABLENO +.. clicmd:: table TABLENO + + Select the primary kernel routing table to be used. This only works + for kernels supporting multiple routing tables (like GNU/Linux 2.2.x + and later). After setting TABLENO with this command, + static routes defined after this are added to the specified table. + +.. _multicast-rib-commands: + +Multicast RIB Commands +====================== + +The Multicast RIB provides a separate table of unicast destinations which +is used for Multicast Reverse Path Forwarding decisions. It is used with +a multicast source's IP address, hence contains not multicast group +addresses but unicast addresses. + +This table is fully separate from the default unicast table. However, +RPF lookup can include the unicast table. + +WARNING: RPF lookup results are non-responsive in this version of FRR, +i.e. multicast routing does not actively react to changes in underlying +unicast topology! + +.. index:: ip multicast rpf-lookup-mode MODE +.. clicmd:: ip multicast rpf-lookup-mode MODE + +.. index:: no ip multicast rpf-lookup-mode [MODE] +.. clicmd:: no ip multicast rpf-lookup-mode [MODE] + + MODE sets the method used to perform RPF lookups. Supported modes: + +urib-only + Performs the lookup on the Unicast RIB. The Multicast RIB is never used. + +mrib-only + Performs the lookup on the Multicast RIB. The Unicast RIB is never used. + +mrib-then-urib + Tries to perform the lookup on the Multicast RIB. If any route is found, + that route is used. Otherwise, the Unicast RIB is tried. + +lower-distance + Performs a lookup on the Multicast RIB and Unicast RIB each. The result + with the lower administrative distance is used; if they're equal, the + Multicast RIB takes precedence. + +longer-prefix + Performs a lookup on the Multicast RIB and Unicast RIB each. The result + with the longer prefix length is used; if they're equal, the + Multicast RIB takes precedence. + + The `mrib-then-urib` setting is the default behavior if nothing is + configured. If this is the desired behavior, it should be explicitly + configured to make the configuration immune against possible changes in + what the default behavior is. + +.. warning:: + Unreachable routes do not receive special treatment and do not cause + fallback to a second lookup. + +.. index:: show ip rpf ADDR +.. clicmd:: show ip rpf ADDR + + Performs a Multicast RPF lookup, as configured with ``ip multicast + rpf-lookup-mode MODE``. ADDR specifies the multicast source address to look + up. + + :: + + > show ip rpf 192.0.2.1 + Routing entry for 192.0.2.0/24 using Unicast RIB + + Known via "kernel", distance 0, metric 0, best + * 198.51.100.1, via eth0 + + + Indicates that a multicast source lookup for 192.0.2.1 would use an + Unicast RIB entry for 192.0.2.0/24 with a gateway of 198.51.100.1. + +.. index:: show ip rpf +.. clicmd:: show ip rpf + + Prints the entire Multicast RIB. Note that this is independent of the + configured RPF lookup mode, the Multicast RIB may be printed yet not + used at all. + +.. index:: ip mroute PREFIX NEXTHOP [DISTANCE] +.. clicmd:: ip mroute PREFIX NEXTHOP [DISTANCE] + +.. index:: no ip mroute PREFIX NEXTHOP [DISTANCE] +.. clicmd:: no ip mroute PREFIX NEXTHOP [DISTANCE] + + Adds a static route entry to the Multicast RIB. This performs exactly as the + ``ip route`` command, except that it inserts the route in the Multicast RIB + instead of the Unicast RIB. + +.. _zebra-route-filtering: + +zebra Route Filtering +===================== + +Zebra supports :dfn:`prefix-list` s and :ref:`route-map` s to match routes +received from other FRR components. The permit/deny facilities provided by +these commands can be used to filter which routes zebra will install in the +kernel. + +.. index:: ip protocol PROTOCOL route-map ROUTEMAP +.. clicmd:: ip protocol PROTOCOL route-map ROUTEMAP + + Apply a route-map filter to routes for the specified protocol. PROTOCOL can + be **any** or one of + + - system, + - kernel, + - connected, + - static, + - rip, + - ripng, + - ospf, + - ospf6, + - isis, + - bgp, + - hsls. + +.. index:: set src ADDRESS +.. clicmd:: set src ADDRESS + + Within a route-map, set the preferred source address for matching routes + when installing in the kernel. + + +The following creates a prefix-list that matches all addresses, a route-map +that sets the preferred source address, and applies the route-map to all +*rip* routes. + +:: + + ip prefix-list ANY permit 0.0.0.0/0 le 32 + route-map RM1 permit 10 + match ip address prefix-list ANY + set src 10.0.0.1 + + ip protocol rip route-map RM1 + + +.. _zebra-fib-push-interface: + +zebra FIB push interface +======================== + +Zebra supports a 'FIB push' interface that allows an external +component to learn the forwarding information computed by the FRR +routing suite. This is a loadable module that needs to be enabled +at startup as described in :ref:`loadable-module-support`. + +In FRR, the Routing Information Base (RIB) resides inside +zebra. Routing protocols communicate their best routes to zebra, and +zebra computes the best route across protocols for each prefix. This +latter information makes up the Forwarding Information Base +(FIB). Zebra feeds the FIB to the kernel, which allows the IP stack in +the kernel to forward packets according to the routes computed by +FRR. The kernel FIB is updated in an OS-specific way. For example, +the `netlink` interface is used on Linux, and route sockets are +used on FreeBSD. + +The FIB push interface aims to provide a cross-platform mechanism to +support scenarios where the router has a forwarding path that is +distinct from the kernel, commonly a hardware-based fast path. In +these cases, the FIB needs to be maintained reliably in the fast path +as well. We refer to the component that programs the forwarding plane +(directly or indirectly) as the Forwarding Plane Manager or FPM. + +The FIB push interface comprises of a TCP connection between zebra and +the FPM. The connection is initiated by zebra -- that is, the FPM acts +as the TCP server. + +The relevant zebra code kicks in when zebra is configured with the +:option:`--enable-fpm` flag. Zebra periodically attempts to connect to +the well-known FPM port. Once the connection is up, zebra starts +sending messages containing routes over the socket to the FPM. Zebra +sends a complete copy of the forwarding table to the FPM, including +routes that it may have picked up from the kernel. The existing +interaction of zebra with the kernel remains unchanged -- that is, the +kernel continues to receive FIB updates as before. + +The encapsulation header for the messages exchanged with the FPM is +defined by the file :file:`fpm/fpm.h` in the frr tree. The routes +themselves are encoded in netlink or protobuf format, with netlink +being the default. + +Protobuf is one of a number of new serialization formats wherein the +message schema is expressed in a purpose-built language. Code for +encoding/decoding to/from the wire format is generated from the +schema. Protobuf messages can be extended easily while maintaining +backward-compatibility with older code. Protobuf has the following +advantages over netlink: + +- Code for serialization/deserialization is generated automatically. This + reduces the likelihood of bugs, allows third-party programs to be integrated + quickly, and makes it easy to add fields. +- The message format is not tied to an OS (Linux), and can be evolved + independently. + +As mentioned before, zebra encodes routes sent to the FPM in netlink +format by default. The format can be controlled via the FPM module's +load-time option to zebra, which currently takes the values `netlink` +and `protobuf`. + +The zebra FPM interface uses replace semantics. That is, if a 'route +add' message for a prefix is followed by another 'route add' message, +the information in the second message is complete by itself, and +replaces the information sent in the first message. + +If the connection to the FPM goes down for some reason, zebra sends +the FPM a complete copy of the forwarding table(s) when it reconnects. + +zebra Terminal Mode Commands +============================ + +.. index:: show ip route +.. clicmd:: show ip route + + Display current routes which zebra holds in its database. + +:: + + Router# show ip route + Codes: K - kernel route, C - connected, S - static, R - RIP, + B - BGP * - FIB route. + + K* 0.0.0.0/0 203.181.89.241 + S 0.0.0.0/0 203.181.89.1 + C* 127.0.0.0/8 lo + C* 203.181.89.240/28 eth0 + + +.. index:: show ipv6 route +.. clicmd:: show ipv6 route + +.. index:: show interface +.. clicmd:: show interface + +.. index:: show ip prefix-list [NAME] +.. clicmd:: show ip prefix-list [NAME] + +.. index:: show route-map [NAME] +.. clicmd:: show route-map [NAME] + +.. index:: show ip protocol +.. clicmd:: show ip protocol + +.. index:: show ipforward +.. clicmd:: show ipforward + + Display whether the host's IP forwarding function is enabled or not. + Almost any UNIX kernel can be configured with IP forwarding disabled. + If so, the box can't work as a router. + +.. index:: show ipv6forward +.. clicmd:: show ipv6forward + + Display whether the host's IP v6 forwarding is enabled or not. + +.. index:: show zebra +.. clicmd:: show zebra + + Display various statistics related to the installation and deletion + of routes, neighbor updates, and LSP's into the kernel. + +.. index:: show zebra fpm stats +.. clicmd:: show zebra fpm stats + + Display statistics related to the zebra code that interacts with the + optional Forwarding Plane Manager (FPM) component. + +.. index:: clear zebra fpm stats +.. clicmd:: clear zebra fpm stats + + Reset statistics related to the zebra code that interacts with the + optional Forwarding Plane Manager (FPM) component. + diff --git a/doc/vnc.texi b/doc/vnc.texi deleted file mode 100644 index 6193d3c90..000000000 --- a/doc/vnc.texi +++ /dev/null @@ -1,1593 +0,0 @@ -@c -*-texinfo-*- -@c This is part of the Frr Manual. -@c @value{COPYRIGHT_STR} -@c See file frr.texi for copying conditions. - -@node VNC and VNC-GW -@chapter VNC and VNC-GW -This chapter describes how to use -Virtual Network Control (@acronym{VNC}) services, -including Network Virtualization Authority (@acronym{NVA}) and -VNC Gateway (@acronym{VNC-GW}) functions. -Background information on NVAs, -Network Virtualization Edges (@acronym{NVE}s), underlay networks (@acronym{UN}s), -and virtual networks (@acronym{VN}s) is available from the -@url{https://datatracker.ietf.org/wg/nvo3,IETF Network Virtualization Overlays (@acronym{NVO3}) Working Group}. -VNC Gateways (@acronym{VNC-GW}s) support the import/export of routing -information between VNC and customer edge routers (@acronym{CE}s) -operating within a VN. Both IP/Layer 3 (L3) VNs, and IP with -Ethernet/Layer 2 (L2) VNs are supported. - -BGP, with IP VPNs and Tunnel Encapsulation, is used to distribute VN -information between NVAs. BGP based IP VPN support is defined in -@cite{RFC4364, BGP/MPLS IP Virtual Private Networks (VPNs)}, and -@cite{RFC4659, BGP-MPLS IP Virtual Private Network (VPN) Extension for -IPv6 VPN }. Encapsulation information is provided via -the Tunnel Encapsulation Attribute, @cite{RFC5512, The BGP -Encapsulation Subsequent Address Family Identifier (SAFI) and the BGP -Tunnel Encapsulation Attribute}, are supported. - -The protocol that is used to communicate routing and Ethernet / Layer 2 -(L2) forwarding information between NVAs and NVEs is referred to as the -Remote Forwarder Protocol (RFP). @code{OpenFlow} is an example -RFP. Specific RFP implementations may choose to implement either a -@code{hard-state} or @code{soft-state} prefix and address registration -model. To support a @code{soft-state} refresh model, a @var{lifetime} -in seconds is associated with all registrations and responses. - -The chapter also provides sample configurations for basic example scenarios. - -@menu -* Configuring VNC Services:: -* Manual Address Control:: -* Other VNC-Related Commands:: -* Example VNC and VNC-GW Configurations:: -* Release Notes:: -@end menu - -@node Configuring VNC Services -@section Configuring VNC - -Virtual Network Control (@acronym{VNC}) service configuration commands -appear in the @code{router bgp} section of the BGPD configuration file -(@pxref{BGP Configuration Examples}). The commands are broken down into -the following areas: - -@menu -* General VNC Configuration:: -* RFP Related Configuration:: -* VNC Defaults Configuration:: -* VNC NVE Group Configuration:: -* VNC L2 Group Configuration:: -* Configuring Redistribution of Routes from Other Routing Protocols:: -* Configuring Export of Routes to Other Routing Protocols:: -@end menu - -@code{General VNC} configuration applies to general VNC operation and is -primarily used to control the method used to advertise tunnel -information. - -@code{Remote Forwarder Protocol (RFP)} configuration relates to the -protocol used between NVAs and NVEs. - -@code{VNC Defaults} provides default parameters for registered NVEs. - -@code{VNC NVE Group} provides for configuration of a specific set of -registered NVEs and overrides default parameters. - -@code{Redistribution} and @code{Export} control VNC-GW operation, i.e., -the import/export of routing -information between VNC and customer edge routers (@acronym{CE}s) -operating within a VN. - -@node General VNC Configuration -@subsection General VNC Configuration - -@deffn {VNC} {vnc advertise-un-method encap-attr} {} -Advertise NVE underlay-network IP addresses using -the UN address sub-TLV of the Tunnel Encapsulation attribute -(@code{encap-attr}). The default is @code{encap-attr}. -@end deffn - -@node RFP Related Configuration -@subsection RFP Related Configuration - -The protocol that is used to communicate routing and Ethernet / L2 -forwarding information between NVAs and NVEs is referred to as the -Remote Forwarder Protocol (RFP). Currently, only a simple example RFP -is included in Frr. Developers may use this example as a starting -point to integrate Frr with an RFP of their choosing, e.g., -@code{OpenFlow}. The example code includes the following sample -configuration: - -@deffn {RFP} {rfp example-config-value @var{VALUE}} -This is a simple example configuration parameter included as part of the -RFP example code. @code{VALUE} must be in the range of 0 to 4294967295. -@end deffn - -@node VNC Defaults Configuration -@subsection VNC Defaults Configuration - -The VNC Defaults section allows the user to specify default values for -configuration parameters for all registered NVEs. -Default values are overridden by @ref{VNC NVE Group Configuration}. - -@deffn {VNC} {vnc defaults} {} -Enter VNC configuration mode for specifying VNC default behaviors. Use -@code{exit-vnc} to leave VNC configuration mode. @code{vnc -defaults} is optional. - -@example -vnc defaults - ... various VNC defaults -exit-vnc -@end example -@end deffn - -These are the statements that can appear between @code{vnc defaults} -and @code{exit-vnc}. - -@deffn {VNC} {rt import @var{rt-list}} {} -@deffnx {VNC} {rt export @var{rt-list}} {} -@deffnx {VNC} {rt both @var{rt-list}} {} - -Specify default route target import and export lists. @var{rt-list} is a -space-separated list of route targets, each element of which is -in one of the following forms: -@itemize -@item @var{IPv4-address}:@var{two-byte-integer} -@item @var{four-byte-autonomous-system-number}:@var{two-byte-integer} -@item @var{two-byte-autonomous-system-number}:@var{four-byte-integer} -@end itemize - -If no default import RT list is specified, then the default import RT -list is empty. -If no default export RT list is specified, then the default export RT -list is empty. - -A complete definition of these parameters is -given below (@pxref{VNC NVE Group Configuration}). - -@end deffn - -@deffn {VNC} {rd @var{route-distinguisher}} - -Specify the default route distinguisher (RD) for routes advertised via BGP -VPNs. The route distinguisher must be in one of four forms: -@itemize -@item @var{IPv4-address}:@var{two-byte-integer} -@item @var{four-byte-autonomous-system-number}:@var{two-byte-integer} -@item @var{two-byte-autonomous-system-number}:@var{four-byte-integer} -@item auto:vn:@var{two-byte-integer} -@end itemize - -If RD is specified in the defaults section, the default RD -value is @var{two-byte-autonomous-system-number=0}:@var{four-byte-integer=0}. - -A complete definition of this parameter is -given below (@pxref{VNC NVE Group Configuration}). -@end deffn - -@deffn {VNC} {l2rd @var{nve-id-value}} -Set the value used to distinguish NVEs connected to the same logical -Ethernet segment (i.e., L2VPN). - -A complete definition of this parameter is -given below (@pxref{VNC NVE Group Configuration}). -@end deffn - -@deffn {VNC} {response-lifetime @var{lifetime}|infinite} {} -Specify the default lifetime to be included in RFP -response messages sent to NVEs. - -A complete definition of this parameter is -given below (@pxref{VNC NVE Group Configuration}). - -@end deffn - -@deffn {VNC} {export bgp|zebra route-map MAP-NAME} -Specify that the named route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} {export bgp|zebra no route-map} -Specify that no route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} {export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME} -Specify that the named prefix-list filter should be applied to -routes being exported to bgp or zebra. -Prefix-lists for ipv4 and ipv6 are independent of each other. -@end deffn - -@deffn {VNC} {export bgp|zebra no ipv4|ipv6 prefix-list} -Specify that no prefix-list filter should be applied to -routes being exported to bgp or zebra. -@end deffn - -@deffn {VNC} {exit-vnc} {} -Exit VNC configuration mode. -@end deffn - -@c The following example @code{vnc defaults} defines a route target import-export -@c list for the route targets 1000:1 and 1000:2; a default route -@c distinguisher, 4444:10; and a default response lifetime of 500 -@c seconds. -@c -@c @example -@c vnc defaults -@c rt both 1000:1 1000:2 -@c rd 4444:10 -@c response-lifetime 500 -@c exit-vnc -@c @end example - -@node VNC NVE Group Configuration -@subsection VNC NVE Group Configuration - -A NVE Group corresponds to a specific set of NVEs. A Client NVE is -assigned to an NVE Group based on whether there is a match for either -its virtual or underlay network address against the VN and/or UN address -prefixes specified in the NVE Group definition. When an NVE Group -definition specifies both VN and UN address prefixes, then an NVE must -match both prefixes in order to be assigned to the NVE Group. In the -event that multiple NVE Groups match based on VN and/or UN addresses, -the NVE is assigned to the first NVE Group listed in the configuration. -If an NVE is not assigned to an NVE Group, its messages will be ignored. - -Configuration values specified for an NVE group apply to all -member NVEs and override configuration values specified in the VNC -Defaults section. - -@strong{At least one @code{nve-group} is mandatory for useful VNC -operation.} - -@deffn {VNC} {vnc nve-group @var{name}} {} -Enter VNC configuration mode for defining the NVE group @var{name}. -Use @code{exit} or @code{exit-vnc} to exit group configuration mode. - -@example -vnc nve-group group1 - ... configuration commands -exit-vnc -@end example -@end deffn - -@deffn {VNC} {no vnc nve-group @var{name}} {} -Delete the NVE group named @var{name}. -@end deffn - -The following statements are valid in an NVE group definition: - -@deffn {VNC} {l2rd @var{nve-id-value}} -Set the value used to distinguish NVEs connected to the same physical -Ethernet segment (i.e., at the same location)@footnote{The nve-id is -carried in the route -distinguisher. It is the second octet of the eight-octet route -distinguisher generated for Ethernet / L2 advertisements. -The first octet is a constant 0xFF, and the third through eighth -octets are set to the L2 ethernet address being advertised.} - -The nve-id subfield may be specified as either a literal value -in the range 1-255, or it may be specified as @code{auto:vn}, which -means to use the least-significant octet of the originating -NVE's VN address. -@end deffn - -@deffn {VNC} {prefix vn|un A.B.C.D/M|X:X::X:X/M} {} -@anchor{prefix} -Specify the matching prefix for this NVE group by either virtual-network address -(@code{vn}) or underlay-network address (@code{un}). Either or both virtual-network -and underlay-network prefixes may be specified. Subsequent virtual-network or -underlay-network values within a @code{vnc nve-group} @code{exit-vnc} -block override their respective previous values. - -These prefixes are used only for determining assignments of NVEs -to NVE Groups. -@end deffn - -@deffn {VNC} {rd @var{route-distinguisher}} -Specify the route distinguisher for routes advertised via BGP -VPNs. The route distinguisher must be in one of these forms: -@itemize -@item @var{IPv4-address}:@var{two-byte-integer} -@item @var{four-byte-autonomous-system-number}:@var{two-byte-integer} -@item @var{two-byte-autonomous-system-number}:@var{four-byte-integer} -@item auto:vn:@var{two-byte-integer} -@end itemize - -Routes originated by NVEs in the NVE group will use -the group's specified @var{route-distinguisher} when they are -advertised via BGP. -If the @code{auto} form is specified, it means that a matching NVE has -its RD set to -@var{rd_type=IP=1}:@var{IPv4-address=VN-address}:@var{two-byte-integer}, -for IPv4 VN addresses and -@var{rd_type=IP=1}:@var{IPv4-address=Last-four-bytes-of-VN-address}:@var{two-byte-integer}, -for IPv6 VN addresses. - -If the NVE group definition does not specify a @var{route-distinguisher}, -then the default @var{route-distinguisher} is used. -If neither a group nor a default @var{route-distinguisher} is -configured, then the advertised RD is set to -@var{two-byte-autonomous-system-number=0}:@var{four-byte-integer=0}. -@end deffn - -@deffn {VNC} {response-lifetime @var{lifetime}|infinite} {} -Specify the response lifetime, in seconds, to be included in RFP -response messages sent to NVEs. If the value -``infinite'' is given, an infinite lifetime will be used. - -Note that this parameter is not the same as the lifetime supplied by -NVEs in RFP registration messages. This parameter does not affect -the lifetime value attached to routes sent by this server via BGP. - -If the NVE group definition does not specify a @var{response-lifetime}, -the default @var{response-lifetime} will be used. -If neither a group nor a default @var{response-lifetime} is configured, -the value 3600 will be used. The maximum response lifetime is 2147483647. -@end deffn - -@deffn {VNC} {rt export @var{rt-list}} {} -@deffnx {VNC} {rt import @var{rt-list}} {} -@deffnx {VNC} {rt both @var{rt-list}} {} -Specify route target import and export lists. @var{rt-list} is a -space-separated list of route targets, each element of which is -in one of the following forms: -@itemize -@item @var{IPv4-address}:@var{two-byte-integer} -@item @var{four-byte-autonomous-system-number}:@var{two-byte-integer} -@item @var{two-byte-autonomous-system-number}:@var{four-byte-integer} -@end itemize - -The first form, @code{rt export}, specifies an @var{export rt-list}. -The @var{export rt-list} will be attached to routes originated by -NVEs in the NVE group when they are advertised via BGP. -If the NVE group definition does not specify an @var{export rt-list}, -then the default @var{export rt-list} is used. -If neither a group nor a default @var{export rt-list} is configured, -then no RT list will be sent; in turn, these routes will probably -not be processed -by receiving NVAs. - -The second form, @code{rt import} specifies an @var{import rt-list}, -which is a filter for incoming routes. -In order to be made available to NVEs in the group, -incoming BGP VPN @w{SAFI} routes must have -RT lists that have at least one route target in common with the -group's @var{import rt-list}. - -If the NVE group definition does not specify an import filter, -then the default @var{import rt-list} is used. -If neither a group nor a default @var{import rt-list} is configured, -there can be no RT intersections when receiving BGP routes and -therefore no incoming BGP routes will be processed for the group. - -The third, @code{rt both}, is a shorthand way of specifying both -lists simultaneously, and is equivalent to @code{rt export @var{rt-list}} -followed by @code{rt import @var{rt-list}}. -@end deffn - -@deffn {VNC} {export bgp|zebra route-map MAP-NAME} -Specify that the named route-map should be applied to routes -being exported to bgp or zebra. -This paramter is used in conjunction with -@ref{Configuring Export of Routes to Other Routing Protocols}. -This item is optional. -@end deffn - -@deffn {VNC} {export bgp|zebra no route-map} -Specify that no route-map should be applied to routes -being exported to bgp or zebra. -This paramter is used in conjunction with -@ref{Configuring Export of Routes to Other Routing Protocols}. -This item is optional. -@end deffn - -@deffn {VNC} {export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME} -Specify that the named prefix-list filter should be applied to -routes being exported to bgp or zebra. -Prefix-lists for ipv4 and ipv6 are independent of each other. -This paramter is used in conjunction with -@ref{Configuring Export of Routes to Other Routing Protocols}. -This item is optional. -@end deffn - -@deffn {VNC} {export bgp|zebra no ipv4|ipv6 prefix-list} -Specify that no prefix-list filter should be applied to -routes being exported to bgp or zebra. -This paramter is used in conjunction with -@ref{Configuring Export of Routes to Other Routing Protocols}. -This item is optional. -@end deffn - -@c The following example shows two @code{vnc nve-group} definitions. The first one, -@c ``group1'', applies to the IPV4 virtual-network route prefix 172.16/16. It -@c sets the response lifetime to 200 seconds. It defines a route target -@c import-export filter for the route targets 1000:1 and 1000:2 -@c -@c The second @code{vnc nve-group} definition, ``group2'', applies to the IPV6 -@c underlay-network route prefix 10.0.2/24. It defines the same response -@c lifetime and import-export filter as ``group1''. -@c -@c @example -@c vnc nve-group group1 -@c prefix vn 172.16/16 -@c response-lifetime 200 -@c rt both 1000:1 1000:2 -@c exit-vnc -@c -@c vnc nve-group group2 -@c prefix un 10.0.2/24 -@c response-lifetime 200 -@c rt both 1000:1 1000:2 -@c exit-vnc -@c @end example - -@node VNC L2 Group Configuration -@subsection VNC L2 Group Configuration - -The route targets advertised with prefixes and addresses registered by -an NVE are determined based on the NVE's associated VNC NVE Group -Configuration, @pxref{VNC NVE Group Configuration}. Layer 2 (L2) Groups -are used to override the route targets for an NVE's Ethernet -registrations based on the Logical Network Identifier and label value. -A Logical Network Identifier is used to uniquely identify a logical -Ethernet segment and is conceptually similar to the Ethernet Segment -Identifier defined in @cite{RFC7432, BGP MPLS-Based Ethernet VPN}. Both -the Logical Network Identifier and Label are passed to VNC via RFP -prefix and address registration. - -Note that a corresponding NVE group configuration must be present, and -that other NVE associated configuration information, notably RD, is -not impacted by L2 Group Configuration. - -@deffn {VNC} {vnc l2-group @var{name}} {} -Enter VNC configuration mode for defining the L2 group @var{name}. -Use @code{exit} or @code{exit-vnc} to exit group configuration mode. - -@example -vnc l2-group group1 - ... configuration commands -exit-vnc -@end example -@end deffn - -@deffn {VNC} {no vnc l2-group @var{name}} {} -Delete the L2 group named @var{name}. -@end deffn - -The following statements are valid in a L2 group definition: - -@deffn {VNC} {logical-network-id @var{VALUE}} -Define the Logical Network Identifier with a value in the range of -0-4294967295 that identifies the logical Ethernet segment. -@end deffn - -@deffn {VNC} {labels @var{label-list}} -@deffnx {VNC} {no labels @var{label-list}} -Add or remove labels associated with the group. @var{label-list} is a -space separated list of label values in the range of 0-1048575. -@end deffn - -@deffn {VNC} {rt import @var{rt-target}} {} -@deffnx {VNC} {rt export @var{rt-target}} {} -@deffnx {VNC} {rt both @var{rt-target}} {} -Specify the route target import and export value associated with the -group. A complete definition of these parameters is given above, -@pxref{VNC NVE Group Configuration}. -@end deffn - - -@node Configuring Redistribution of Routes from Other Routing Protocols -@subsection Configuring Redistribution of Routes from Other Routing Protocols - -Routes from other protocols (including BGP) can be provided to VNC (both -for RFP and for redistribution via BGP) -from three sources: the zebra kernel routing process; -directly from the main (default) unicast BGP RIB; or directly -from a designated BGP unicast exterior routing RIB instance. - -The protocol named in the @code{vnc redistribute} command indicates -the route source: -@code{bgp-direct} routes come directly from the main (default) -unicast BGP RIB and are available for RFP and are redistributed via BGP; -@code{bgp-direct-to-nve-groups} routes come directly from a designated -BGP unicast routing RIB and are made available only to RFP; -and routes from other protocols come from the zebra kernel -routing process. -Note that the zebra process does not need to be active if -only @code{bgp-direct} or @code{bgp-direct-to-nve-groups} routes are used. - -@subsubsection @code{zebra} routes - -Routes originating from protocols other than BGP must be obtained -via the zebra routing process. -Redistribution of these routes into VNC does not support policy mechanisms -such as prefix-lists or route-maps. - -@subsubsection @code{bgp-direct} routes - -@code{bgp-direct} redistribution supports policy via -prefix lists and route-maps. This policy is applied to incoming -original unicast routes before the redistribution translations -(described below) are performed. - -Redistribution of @code{bgp-direct} routes is performed in one of three -possible modes: @code{plain}, @code{nve-group}, or @code{resolve-nve}. -The default mode is @code{plain}. -These modes indicate the kind of translations applied to routes before -they are added to the VNC RIB. - -In @code{plain} mode, the route's next hop is unchanged and the RD is set -based on the next hop. -For @code{bgp-direct} redistribution, the following translations are performed: -@itemize @bullet -@item -The VN address is set to the original unicast route's next hop address. -@item -The UN address is NOT set. (VN->UN mapping will occur via -ENCAP route or attribute, based on @code{vnc advertise-un-method} -setting, generated by the RFP registration of the actual NVE) -@item -The RD is set to as if auto:vn:0 were specified (i.e., -@var{rd_type=IP=1}:@var{IPv4-address=VN-address}:@var{two-byte-integer=0}) -@item -The RT list is included in the extended community list copied from the -original unicast route (i.e., it must be set in the original unicast route). -@end itemize - - - -In @code{nve-group} mode, routes are registered with VNC as -if they came from an NVE in the nve-group designated in the -@code{vnc redistribute nve-group} command. The following -translations are performed: - -@itemize @bullet -@item -The next hop/VN address is set to the VN prefix configured for the -redistribute nve-group. -@item -The UN address is set to the UN prefix configured for the -redistribute nve-group. -@item -The RD is set to the RD configured for the redistribute nve-group. -@item -The RT list is set to the RT list configured for the redistribute nve-group. -If @code{bgp-direct} routes are being redistributed, -any extended communities present in the original unicast route -will also be included. -@end itemize - - -In @code{resolve-nve} mode, the next hop of the original BGP route is -typically the address of an NVE connected router (CE) connected by one or -more NVEs. -Each of the connected NVEs will register, via RFP, a VNC host route -to the CE. -This mode may be though of as a mechanism to proxy RFP registrations -of BGP unicast routes on behalf of registering NVEs. - -Multiple copies of the BGP route, one per matching NVE host route, will be -added to VNC. -In other words, for a given BGP unicast route, each instance of a -RFP-registered host route to the unicast route's next hop will result -in an instance of an imported VNC route. -Each such imported VNC route will have a prefix equal to the original -BGP unicast route's prefix, and a next hop equal to the next hop of the -matching RFP-registered host route. -If there is no RFP-registered host route to the next hop of the BGP unicast -route, no corresponding VNC route will be imported. - -The following translations are applied: - -@itemize @bullet -@item -The Next Hop is set to the next hop of the NVE route (i.e., the -VN address of the NVE). - -@item -The extended community list in the new route is set to the -union of: -@itemize @minus -@item -Any extended communities in the original BGP route -@item -Any extended communities in the NVE route -@item -An added route-origin extended community with the next hop of the -original BGP route -is added to the new route. -The value of the local administrator field defaults 5226 but may -be configured by the user via the @code{roo-ec-local-admin} parameter. -@end itemize - -@item -The Tunnel Encapsulation attribute is set to the value of the Tunnel -Encapsulation attribute of the NVE route, if any. - -@end itemize - -@subsubsection @code{bgp-direct-to-nve-groups} routes - -Unicast routes from the main or a designated instance of BGP -may be redistributed to VNC as bgp-direct-to-nve-groups routes. These -routes are NOT announced via BGP, -but they are made available for local RFP lookup in response to -queries from NVEs. - -A non-main/default BGP instance is configured using the -@code{bgp multiple-instance} and @code{router bgp AS view NAME} -commands as described elsewhere in this document. - -In order for a route in the unicast BGP RIB to be made -available to a querying NVE, there must already be, available to -that NVE, an (interior) VNC route matching the next hop address -of the unicast route. -When the unicast route is provided to the NVE, its next hop -is replaced by the next hop of the corresponding -NVE. If there are multiple longest-prefix-match VNC routes, -the unicast route will be replicated for each. - -There is currently no policy (prefix-list or route-map) support -for @code{bgp-direct-to-nve-groups} routes. - -@subsubsection Redistribution Command Syntax - -@deffn {VNC} {vnc redistribute ipv4|ipv6 bgp|bgp-direct|ipv6 bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static} {} -@deffnx {VNC} {vnc redistribute ipv4|ipv6 bgp-direct-to-nve-groups view @var{VIEWNAME}} {} -@deffnx {VNC} {no vnc redistribute ipv4|ipv6 bgp|bgp-direct|bgp-direct-to-nve-groups|connected|kernel|ospf|rip|static} {} -Import (or do not import) prefixes from another routing -protocols. Specify both the address family to import (@code{ipv4} or -@code{ipv6}) and the protocol (@code{bgp}, @code{bgp-direct}, -@code{bgp-direct-to-nve-groups}, @code{connected}, -@code{kernel}, @code{ospf}, @code{rip}, or @code{static}). Repeat -this statement as needed for each combination of address family and -routing protocol. -Prefixes from protocol @code{bgp-direct} are imported from unicast BGP -in the same bgpd process. -Prefixes from all other protocols (including @code{bgp}) are imported -via the @code{zebra} kernel routing process. -@end deffn - -@deffn {VNC} {vnc redistribute mode plain|nve-group|resolve-nve} -Redistribute routes from other protocols into VNC using the -specified mode. -Not all combinations of modes and protocols are supported. -@end deffn - -@deffn {VNC} {vnc redistribute nve-group @var{group-name}} {} -@deffnx {VNC} {no vnc redistribute nve-group @var{group-name}} {} -When using @code{nve-group} mode, -assign (or do not assign) the NVE group @var{group-name} to routes -redistributed from another routing protocol. @var{group-name} -must be configured using @code{vnc nve-group}. - -The VN and UN prefixes of the nve-group must both be configured, -and each prefix must be specified as a full-length (/32 for IPv4, -/128 for IPv6) prefix. -@end deffn - -@deffn {VNC} {vnc redistribute lifetime @var{lifetime}|infinite} {} -Assign a registration lifetime, either @var{lifetime} seconds or -@code{infinite}, to prefixes redistributed from other routing -protocols as if they had been received via RFP registration messages -from an NVE. @var{lifetime} can be any integer between 1 and -4294967295, inclusive. -@end deffn - -@deffn {VNC} {vnc redistribute resolve-nve roo-ec-local-admin @var{0-65536}} -Assign a value to the local-administrator subfield used in the -Route Origin extended community that is assigned to routes exported -under the @code{resolve-nve} mode. The default value is @var{5226}. -@end deffn - -The following four @code{prefix-list} and @code{route-map} commands -may be specified in the context of an nve-group or not. -If they are specified in the context of an nve-group, they -apply only if the redistribution mode is @code{nve-group}, -and then only for routes being redistributed from -@code{bgp-direct}. -If they are specified outside the context of an nve-group, then -they apply only for redistribution modes @code{plain} and @code{resolve-nve}, -and then only for routes being redistributed from @code{bgp-direct}. - -@deffn {VNC} {vnc redistribute bgp-direct (ipv4|ipv6) prefix-list @var{LIST-NAME}} -When redistributing @code{bgp-direct} routes, -specifies that the named prefix-list should be applied. -@end deffn - -@deffn {VNC} {vnc redistribute bgp-direct no (ipv4|ipv6) prefix-list} -When redistributing @code{bgp-direct} routes, -specifies that no prefix-list should be applied. -@end deffn - -@deffn {VNC} {vnc redistribute bgp-direct route-map @var{MAP-NAME}} -When redistributing @code{bgp-direct} routes, -specifies that the named route-map should be applied. -@end deffn - -@deffn {VNC} {vnc redistribute bgp-direct no route-map} -When redistributing @code{bgp-direct} routes, -specifies that no route-map should be applied. -@end deffn - -@node Configuring Export of Routes to Other Routing Protocols -@subsection Configuring Export of Routes to Other Routing Protocols - -Routes from VNC (both for RFP and for redistribution via BGP) can be -provided to other protocols, either via zebra or directly to BGP. - -It is important to note that when exporting routes to other protocols, -the downstream protocol must also be configured to import the routes. -For example, when VNC routes are exported to unicast BGP, the BGP -configuration must include a corresponding @code{redistribute vnc-direct} -statement. - -@deffn {VNC} {export bgp|zebra mode none|group-nve|registering-nve|ce} -Specify how routes should be exported to bgp or zebra. -If the mode is @code{none}, routes are not exported. -If the mode is @code{group-nve}, routes are exported according -to nve-group or vrf-policy group configuration (@pxref{VNC NVE Group Configuration}): if a group is configured to -allow export, then each prefix visible to the group is exported -with next hops set to the currently-registered NVEs. -If the mode is @code{registering-nve}, then all VNC routes are -exported with their original next hops. -If the mode is @code{ce}, only VNC routes that have an NVE connected CE Router -encoded in a Route Origin Extended Community are exported. -This extended community must have an administrative value that -matches the configured @code{roo-ec-local-admin} value. -The next hop of the exported route is set to the encoded -NVE connected CE Router. - -The default for both bgp and zebra is mode @code{none}. -@end deffn - -@deffn {VNC} {vnc export bgp|zebra group-nve group @var{group-name}} -@deffnx {VNC} {vnc export bgp|zebra group-nve no group @var{group-name}} -When export mode is @code{group-nve}, -export (or do not export) prefixes from the specified nve-group or -vrf-policy group -to unicast BGP or to zebra. -Repeat this statement as needed for each nve-group to be exported. -Each VNC prefix that is exported will result in N exported routes to the -prefix, each with a next hop corresponding to one of the N NVEs currently -associated with the nve-group. -@end deffn - -@deffn {VNC} export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME -When export mode is @code{ce} or @code{registering-nve}, -specifies that the named prefix-list should be applied to routes -being exported to bgp or zebra. -Prefix-lists for ipv4 and ipv6 are independent of each other. -@end deffn - -@deffn {VNC} export bgp|zebra no ipv4|ipv6 prefix-list -When export mode is @code{ce} or @code{registering-nve}, -specifies that no prefix-list should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} export bgp|zebra route-map MAP-NAME -When export mode is @code{ce} or @code{registering-nve}, -specifies that the named route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} export bgp|zebra no route-map -When export mode is @code{ce} or @code{registering-nve}, -specifies that no route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -When the export mode is @code{group-nve}, policy for exported -routes is specified per-NVE-group or vrf-policy group inside a @code{nve-group} @var{RFG-NAME} block -via the following commands(@pxref{VNC NVE Group Configuration}): - -@deffn {VNC} {export bgp|zebra route-map MAP-NAME} -This command is valid inside a @code{nve-group} @var{RFG-NAME} block. -It specifies that the named route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} {export bgp|zebra no route-map} -This command is valid inside a @code{nve-group} @var{RFG-NAME} block. -It specifies that no route-map should be applied to routes -being exported to bgp or zebra. -@end deffn - -@deffn {VNC} {export bgp|zebra ipv4|ipv6 prefix-list LIST-NAME} -This command is valid inside a @code{nve-group} @var{RFG-NAME} block. -It specifies that the named prefix-list filter should be applied to -routes being exported to bgp or zebra. -Prefix-lists for ipv4 and ipv6 are independent of each other. -@end deffn - -@deffn {VNC} {export bgp|zebra no ipv4|ipv6 prefix-list} -This command is valid inside a @code{nve-group} @var{RFG-NAME} block. -It specifies that no prefix-list filter should be applied to -routes being exported to bgp or zebra. -@end deffn - -@node Manual Address Control -@section Manual Address Control - -The commands in this section can be used to augment normal dynamic VNC. -The @code{add vnc} commands can be used to manually add IP prefix or -Ethernet MAC address forwarding information. The @code{clear vnc} -commands can be used to remove manually and dynamically added -information. - -@deffn {Command} {add vnc prefix (A.B.C.D/M|X:X::X:X/M) vn (A.B.C.D|X:X::X:X) un (A.B.C.D|X:X::X:X) [cost <0-255>] [lifetime (infinite|<1-4294967295>)] [local-next-hop (A.B.C.D|X:X::X:X) [local-cost <0-255>]]} {} -Register an IP prefix on behalf of the NVE identified by the VN and UN -addresses. The @code{cost} parameter provides the administrative -preference of the forwarding information for remote advertisement. If -omitted, it defaults to 255 (lowest preference). The @code{lifetime} -parameter identifies the period, in seconds, that the information -remains valid. If omitted, it defaults to @var{infinite}. The optional -@code{local-next-hop} parameter is used to configure a nexthop to be -used by an NVE to reach the prefix via a locally connected CE router. -This information remains local to the NVA, i.e., not passed to other -NVAs, and is only passed to registered NVEs. When specified, it is also -possible to provide a @code{local-cost} parameter to provide a -forwarding preference. If omitted, it defaults to 255 (lowest -preference). -@end deffn - - -@deffn {Command} {add vnc mac xx:xx:xx:xx:xx:xx virtual-network-identifier <1-4294967295> vn (A.B.C.D|X:X::X:X) un (A.B.C.D|X:X::X:X) [prefix (A.B.C.D/M|X:X::X:X/M)] [cost <0-255>] [lifetime (infinite|<1-4294967295>)]} {} -Register a MAC address for a logical Ethernet (L2VPN) on behalf of the -NVE identified by the VN and UN addresses. -The optional @code{prefix} parameter is to support enable IP address -mediation for the given prefix. The @code{cost} parameter provides the administrative -preference of the forwarding information. If omitted, it defaults to -255. The @code{lifetime} parameter identifies the period, in seconds, -that the information remains valid. If omitted, it defaults to -@var{infinite}. -@end deffn - -@deffn {Command} {clear vnc prefix (*|A.B.C.D/M|X:X::X:X/M) (*|[(vn|un) (A.B.C.D|X:X::X:X|*) [(un|vn) (A.B.C.D|X:X::X:X|*)] [mac xx:xx:xx:xx:xx:xx] [local-next-hop (A.B.C.D|X:X::X:X)])} {} -Delete the information identified by prefix, VN address, and UN address. -Any or all of these parameters may be wilcarded to (potentially) match -more than one registration. -The optional @code{mac} parameter specifies a layer-2 MAC address -that must match the registration(s) to be deleted. -The optional @code{local-next-hop} parameter is used to -delete specific local nexthop information. -@end deffn - -@deffn {Command} {clear vnc mac (*|xx:xx:xx:xx:xx:xx) virtual-network-identifier (*|<1-4294967295>) (*|[(vn|un) (A.B.C.D|X:X::X:X|*) [(un|vn) (A.B.C.D|X:X::X:X|*)] [prefix (*|A.B.C.D/M|X:X::X:X/M)])} {} -Delete mac forwarding information. -Any or all of these parameters may be wilcarded to (potentially) match -more than one registration. -The default value for the @code{prefix} parameter is the wildcard value @var{*}. -@end deffn - -@deffn {Command} {clear vnc nve (*|((vn|un) (A.B.C.D|X:X::X:X) [(un|vn) (A.B.C.D|X:X::X:X)])) } {} -Delete prefixes associated with the NVE specified by the given VN and UN -addresses. -It is permissible to specify only one of VN or UN, in which case -any matching registration will be deleted. -It is also permissible to specify @code{*} in lieu of any VN or UN -address, in which case all registrations will match. -@end deffn - -@node Other VNC-Related Commands -@section Other VNC-Related Commands - -Note: VNC-Related configuration can be obtained via the @code{show -running-configuration} command when in @code{enable} mode. - -The following commands are used to clear and display -Virtual Network Control related information: - -@deffn {COMMAND} {clear vnc counters} {} -Reset the counter values stored by the NVA. Counter -values can be seen using the @code{show vnc} commands listed above. This -command is only available in @code{enable} mode. -@end deffn - -@deffn {Command} {show vnc summary} {} -Print counter values and other general information -about the NVA. Counter values can be reset -using the @code{clear vnc counters} command listed below. -@end deffn - -@deffn {Command} {show vnc nves} {} -@deffnx {Command} {show vnc nves vn|un @var{address}} {} -Display the NVA's current clients. Specifying @var{address} -limits the output to the NVEs whose addresses match @var{address}. -The time since the NVA last communicated with the NVE, per-NVE -summary counters and each NVE's addresses will be displayed. -@end deffn - -@deffn {Command} {show vnc queries} {} -@deffnx {Command} {show vnc queries @var{prefix}} {} -Display active Query information. Queries remain valid for the default -Response Lifetime (@pxref{VNC Defaults Configuration}) or NVE-group -Response Lifetime (@pxref{VNC NVE Group Configuration}). Specifying -@var{prefix} limits the output to Query Targets that fall within -@var{prefix}. - -Query information is provided for each querying NVE, and includes the -Query Target and the time remaining before the information is removed. -@end deffn - -@deffn {Command} {show vnc registrations [all|local|remote|holddown|imported]} {} -@deffnx {Command} {show vnc registrations [all|local|remote|holddown|imported] @var{prefix}} {} -Display local, remote, holddown, and/or imported registration information. -Local registrations are routes received via RFP, which are present in the -NVA Registrations Cache. -Remote registrations are routes received via BGP (VPN SAFIs), which -are present in the NVE-group import tables. -Holddown registrations are local and remote routes that have been -withdrawn but whose holddown timeouts have not yet elapsed. -Imported information represents routes that are imported into NVA and -are made available to querying NVEs. Depending on configuration, -imported routes may also be advertised via BGP. -Specifying @var{prefix} limits the output to the registered prefixes that -fall within @var{prefix}. - -Registration information includes the registered prefix, the registering -NVE addresses, the registered administrative cost, the registration -lifetime and the time since the information was registered or, in the -case of Holddown registrations, the amount of time remaining before the -information is removed. -@end deffn - -@deffn {Command} {show vnc responses [active|removed]} {} -@deffnx {Command} {show vnc responses [active|removed] @var{prefix}} {} -Display all, active and/or removed response information which are -present in the NVA Responses Cache. Responses remain valid for the -default Response Lifetime (@pxref{VNC Defaults Configuration}) or -NVE-group Response Lifetime (@pxref{VNC NVE Group Configuration}.) -When Removal Responses are enabled (@pxref{General VNC Configuration}), -such responses are listed for the Response Lifetime. Specifying -@var{prefix} limits the output to the addresses that fall within -@var{prefix}. - -Response information is provided for each querying NVE, and includes -the response prefix, the prefix-associated registering NVE addresses, -the administrative cost, the provided response lifetime and the time -remaining before the information is to be removed or will become inactive. -@end deffn - -@deffn {Command} {show memory vnc} {} -Print the number of memory items allocated by the NVA. -@end deffn - -@node Example VNC and VNC-GW Configurations -@section Example VNC and VNC-GW Configurations - -@menu -* Mesh NVA Configuration:: -* Mesh NVA and VNC-GW Configuration:: -* VNC with Frr Route Reflector Configuration:: -* VNC with Commercial Route Reflector Configuration:: -* VNC with Redundant Route Reflectors Configuration:: -@c * Interfacing VNC to an IGP:: -@end menu - -@node Mesh NVA Configuration -@subsection Mesh NVA Configuration - -This example includes three NVAs, nine NVEs, and two NVE groups. Note -that while not shown, a single physical device may support multiple -logical NVEs. @ref{fig:fig-vnc-mesh} shows @code{NVA 1} -(192.168.1.100), @code{NVA 2} (192.168.1.101), and @code{NVA 3} -(192.168.1.102), which are connected in a full mesh. Each is a -member of the autonomous system 64512. Each NVA provides VNC -services to three NVE clients in the 172.16.0.0/16 virtual-network -address range. The 172.16.0.0/16 address range is partitioned into -two NVE groups, @code{group1} (172.16.0.0/17) and @code{group2} -(172.16.128.0/17). - -Each NVE belongs to either NVE group @code{group1} or NVE group -@code{group2}. The NVEs @code{NVE 1}, @code{NVE 2}, @code{NVE -4}, @code{NVE 7}, and @code{NVE 8} are members of the NVE group -@code{group1}. The NVEs @code{NVE 3}, @code{NVE 5}, @code{NVE -6}, and @code{NVE 9} are members of the NVE group @code{group2}. - -Each NVA advertises NVE underlay-network IP addresses using the -Tunnel Encapsulation Attribute. - -@float Figure,fig:fig-vnc-mesh -@center @image{fig-vnc-mesh,400pt,,Three-way Mesh} -@caption{A three-way full mesh with three NVEs per NVA} -@end float - -@file{bgpd.conf} for @code{NVA 1} (192.168.1.100) -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.100 - - neighbor 192.168.1.101 remote-as 64512 - neighbor 192.168.1.102 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.101 activate - neighbor 192.168.1.102 activate - exit-address-family - - vnc defaults - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc - - vnc nve-group group1 - prefix vn 172.16.0.0/17 - rt both 1000:1 - exit-vnc - - vnc nve-group group2 - prefix vn 172.16.128.0/17 - rt both 1000:2 - exit-vnc - -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 2} (192.168.1.101): -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.101 - - neighbor 192.168.1.100 remote-as 64512 - neighbor 192.168.1.102 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - neighbor 192.168.1.102 activate - exit-address-family - - vnc nve-group group1 - prefix vn 172.16.0.0/17 - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 3} (192.168.1.102): -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.102 - - neighbor 192.168.1.101 remote-as 64512 - neighbor 192.168.1.102 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - neighbor 192.168.1.101 activate - exit-address-family - - vnc defaults - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc - - vnc nve-group group1 - prefix vn 172.16.128.0/17 - exit-vnc -exit -@end verbatim - -@node Mesh NVA and VNC-GW Configuration -@subsection Mesh NVA and VNC-GW Configuration - -This example includes two NVAs, each with two associated NVEs, and two -VNC-GWs, each supporting two CE routers physically attached to the four -NVEs. Note that this example is showing a more complex configuration -where VNC-GW is separated from normal NVA functions; it is equally -possible to simplify the configuration and combine NVA and VNC-GW -functions in a single frr instance. - -@float Figure,fig:fig-vnc-gw -@center @image{fig-vnc-gw,400pt,,Frr VNC Gateway} -@caption{Meshed NVEs and VNC-GWs} -@end float - -As shown in @ref{fig:fig-vnc-gw}, NVAs and VNC-GWs are connected in a -full iBGP mesh. The VNC-GWs each have two CEs configured as -route-reflector clients. Each client provides BGP updates with unicast -routes that the VNC-GW reflects to the other client. The VNC-GW also -imports these unicast routes into VPN routes to be shared with the other -VNC-GW and the two NVAs. This route importation is controlled with the -@code{vnc redistribute} statements shown in the configuration. -Similarly, registrations sent by NVEs via RFP to the NVAs are exported -by the VNC-GWs to the route-reflector clients as unicast routes. RFP -registrations exported this way have a next-hop address of the CE behind -the connected (registering) NVE. Exporting VNC routes as IPv4 unicast -is enabled with the @code{vnc export} command below. - -The configuration for @code{VNC-GW 1} is shown below. -@verbatim -router bgp 64512 - bgp router-id 192.168.1.101 - bgp cluster-id 1.2.3.4 - neighbor 192.168.1.102 remote-as 64512 - neighbor 192.168.1.103 remote-as 64512 - neighbor 192.168.1.104 remote-as 64512 - neighbor 172.16.1.2 remote-as 64512 - neighbor 172.16.2.2 remote-as 64512 - ! - address-family ipv4 unicast - redistribute vnc-direct - no neighbor 192.168.1.102 activate - no neighbor 192.168.1.103 activate - no neighbor 192.168.1.104 activate - neighbor 172.16.1.2 route-reflector-client - neighbor 172.16.2.2 route-reflector-client - exit-address-family - ! - address-family ipv4 vpn - neighbor 192.168.1.102 activate - neighbor 192.168.1.103 activate - neighbor 192.168.1.104 activate - exit-address-family - vnc export bgp mode ce - vnc redistribute mode resolve-nve - vnc redistribute ipv4 bgp-direct - exit -@end verbatim - -Note that in the VNC-GW configuration, the neighboring VNC-GW and -NVAs each have a statement disabling the IPv4 unicast address family. -IPv4 unicast is on by default and this prevents the other VNC-GW and -NVAs from learning unicast routes advertised by the route-reflector clients. - -Configuration for @code{NVA 2}: -@verbatim -router bgp 64512 - bgp router-id 192.168.1.104 - neighbor 192.168.1.101 remote-as 64512 - neighbor 192.168.1.102 remote-as 64512 - neighbor 192.168.1.103 remote-as 64512 - ! - address-family ipv4 unicast - no neighbor 192.168.1.101 activate - no neighbor 192.168.1.102 activate - no neighbor 192.168.1.103 activate - exit-address-family - ! - address-family ipv4 vpn - neighbor 192.168.1.101 activate - neighbor 192.168.1.102 activate - neighbor 192.168.1.103 activate - exit-address-family - ! - vnc defaults - response-lifetime 3600 - exit-vnc - vnc nve-group nve1 - prefix vn 172.16.1.1/32 - response-lifetime 3600 - rt both 1000:1 1000:2 - exit-vnc - vnc nve-group nve2 - prefix vn 172.16.2.1/32 - response-lifetime 3600 - rt both 1000:1 1000:2 - exit-vnc - exit -@end verbatim - -@c TBD make this its own example: -@c -@c @float Figure,fig:fig-vnc-gw-rr -@c @center @image{fig-vnc-gw-rr,400pt,,Frr VNC Gateway with RR} -@c @end float -@c An NVA can also import unicast routes from BGP without advertising the -@c imported routes as VPN routes. Such imported routes, while not -@c distributed to other NVAs or VNC-GWs, are are available to NVEs via -@c RFP query messages sent to the NVA. @ref{fig:fig-vnc-gw-rr} -@c shows an example topology where unicast routes are imported into NVAs -@c from a Route Reflector. (@pxref{Route Reflector} for route reflector -@c configuration details.) The following three lines can be added to the -@c @code{NVA 1} and @code{NVA 2} configurations to import routes into VNC -@c for local VNC use: -@c -@c @verbatim -@c neighbor 192.168.1.105 remote-as 64512 -@c vnc redistribute mode plain -@c vnc redistribute ipv4 bgp-direct-to-nve-groups -@c @end verbatim - -@node VNC with Frr Route Reflector Configuration -@subsection VNC with Frr Route Reflector Configuration -A route reflector eliminates the need for a fully meshed NVA -network by acting as the hub between NVAs. -@ref{fig:fig-vnc-frr-route-reflector} shows BGP route reflector -@code{BGP Route Reflector 1} (192.168.1.100) as a route reflector for -NVAs @code{NVA 2}(192.168.1.101) and @code{NVA 3} -(192.168.1.102). - -@float Figure,fig:fig-vnc-frr-route-reflector -@center @image{fig-vnc-frr-route-reflector,400pt,,Frr Route Reflector} -@caption{Two NVAs and a BGP Route Reflector} -@end float - -@code{NVA 2} and @code{NVA 3} -advertise NVE underlay-network IP addresses using the Tunnel Encapsulation Attribute. -@code{BGP Route Reflector 1} ``reflects'' advertisements from -@code{NVA 2} to @code{NVA 3} and vice versa. - -As in the example of @ref{Mesh NVA Configuration}, there are two NVE groups. -The 172.16.0.0/16 address range is partitioned into two NVE groups, -@code{group1} (172.16.0.0/17) and @code{group2} (172.16.128.0/17). -The NVE @code{NVE 4}, @code{NVE 7}, and @code{NVE 8} are -members of the NVE group @code{group1}. The NVEs @code{NVE 5}, -@code{NVE 6}, and @code{NVE 9} are members of the NVE group -@code{group2}. - -@file{bgpd.conf} for @code{BGP Route Reflector 1} on 192.168.1.100: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.100 - - neighbor 192.168.1.101 remote-as 64512 - neighbor 192.168.1.101 port 7179 - neighbor 192.168.1.101 description iBGP-client-192-168-1-101 - - neighbor 192.168.1.102 remote-as 64512 - neighbor 192.168.1.102 port 7179 - neighbor 192.168.1.102 description iBGP-client-192-168-1-102 - - address-family ipv4 unicast - neighbor 192.168.1.101 route-reflector-client - neighbor 192.168.1.102 route-reflector-client - exit-address-family - - address-family ipv4 vpn - neighbor 192.168.1.101 activate - neighbor 192.168.1.102 activate - - neighbor 192.168.1.101 route-reflector-client - neighbor 192.168.1.102 route-reflector-client - exit-address-family - -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 2} on 192.168.1.101: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.101 - - neighbor 192.168.1.100 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - exit-address-family - - vnc nve-group group1 - prefix vn 172.16.0.0/17 - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 2} on 192.168.1.102: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.102 - - neighbor 192.168.1.100 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - exit-address-family - - vnc defaults - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc - - vnc nve-group group1 - prefix vn 172.16.128.0/17 - exit-vnc -exit -@end verbatim - -While not shown, an NVA can also be configured as a route reflector. - -@node VNC with Commercial Route Reflector Configuration -@subsection VNC with Commercial Route Reflector Configuration -This example is identical to @ref{VNC with Frr Route Reflector -Configuration} with the exception that the route reflector is a -commercial router. Only the -VNC-relevant configuration is provided. - -@float Figure,fig:fig-vnc-commercial-route-reflector -@center @image{fig-vnc-commercial-route-reflector,400pt,,Commercial Route Reflector} -@caption{Two NVAs with a commercial route reflector} -@end float - -@file{bgpd.conf} for BGP route reflector @code{Commercial Router} on 192.168.1.104: -@verbatim -version 8.5R1.13; -routing-options { - rib inet.0 { - static { - route 172.16.0.0/16 next-hop 192.168.1.104; - } - } - autonomous-system 64512; - resolution { - rib inet.3 { - resolution-ribs inet.0; - } - rib bgp.l3vpn.0 { - resolution-ribs inet.0; - } - } -} -protocols { - bgp { - advertise-inactive; - family inet { - labeled-unicast; - } - group 1 { - type internal; - advertise-inactive; - advertise-peer-as; - import h; - family inet { - unicast; - } - family inet-vpn { - unicast; - } - cluster 192.168.1.104; - neighbor 192.168.1.101; - neighbor 192.168.1.102; - } - } -} -policy-options { - policy-statement h { - from protocol bgp; - then { - as-path-prepend 64512; - accept; - } - } -} -@end verbatim - -@file{bgpd.conf} for @code{NVA 2} on 192.168.1.101: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.101 - - neighbor 192.168.1.100 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - exit-address-family - - vnc nve-group group1 - prefix vn 172.16.0.0/17 - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 3} on 192.168.1.102: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.102 - - neighbor 192.168.1.100 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - exit-address-family - - vnc defaults - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc - - vnc nve-group group1 - prefix vn 172.16.128.0/17 - exit-vnc -exit -@end verbatim - -@node VNC with Redundant Route Reflectors Configuration -@subsection VNC with Redundant Route Reflectors Configuration -This example combines the previous two (@ref{VNC with Frr Route -Reflector Configuration} and @ref{VNC with Commercial Route Reflector -Configuration}) into a redundant route reflector configuration. BGP -route reflectors @code{BGP Route Reflector 1} and @code{Commercial Router} -are the route reflectors for NVAs @code{NVA 2} and -@code{NVA 3}. The two NVAs have connections to both -route reflectors. - -@float Figure,fig:fig-vnc-redundant-route-reflectors -@center @image{fig-vnc-redundant-route-reflectors,400pt,,Redundant Route Reflectors} -@caption{Frr-based NVA with redundant route reflectors} -@end float - -@file{bgpd.conf} for @code{Bgpd Route Reflector 1} on 192.168.1.100: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.100 - bgp cluster-id 192.168.1.100 - - neighbor 192.168.1.104 remote-as 64512 - - neighbor 192.168.1.101 remote-as 64512 - neighbor 192.168.1.101 description iBGP-client-192-168-1-101 - neighbor 192.168.1.101 route-reflector-client - - neighbor 192.168.1.102 remote-as 64512 - neighbor 192.168.1.102 description iBGP-client-192-168-1-102 - neighbor 192.168.1.102 route-reflector-client - - address-family ipv4 vpn - neighbor 192.168.1.101 activate - neighbor 192.168.1.102 activate - neighbor 192.168.1.104 activate - - neighbor 192.168.1.101 route-reflector-client - neighbor 192.168.1.102 route-reflector-client - exit-address-family -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 2} on 192.168.1.101: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.101 - - neighbor 192.168.1.100 remote-as 64512 - neighbor 192.168.1.104 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - neighbor 192.168.1.104 activate - exit-address-family - - vnc nve-group group1 - prefix vn 172.16.0.0/17 - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc -exit -@end verbatim - -@file{bgpd.conf} for @code{NVA 3} on 192.168.1.102: -@verbatim -router bgp 64512 - - bgp router-id 192.168.1.102 - - neighbor 192.168.1.100 remote-as 64512 - neighbor 192.168.1.104 remote-as 64512 - - address-family ipv4 vpn - neighbor 192.168.1.100 activate - neighbor 192.168.1.104 activate - exit-address-family - - vnc defaults - rd 64512:1 - response-lifetime 200 - rt both 1000:1 1000:2 - exit-vnc - - vnc nve-group group1 - prefix vn 172.16.128.0/17 - exit-vnc -exit -@end verbatim - -@file{bgpd.conf} for the Commercial Router route reflector on -192.168.1.104: -@verbatim -routing-options { - rib inet.0 { - static { - route 172.16.0.0/16 next-hop 192.168.1.104; - } - } - autonomous-system 64512; - resolution { - rib inet.3 { - resolution-ribs inet.0; - } - rib bgp.l3vpn.0 { - resolution-ribs inet.0; - } - } -} -protocols { - bgp { - advertise-inactive; - family inet { - labeled-unicast; - } - group 1 { - type internal; - advertise-inactive; - advertise-peer-as; - import h; - family inet { - unicast; - } - family inet-vpn { - unicast; - } - cluster 192.168.1.104; - neighbor 192.168.1.101; - neighbor 192.168.1.102; - } - - group 2 { - type internal; - advertise-inactive; - advertise-peer-as; - import h; - family inet { - unicast; - } - family inet-vpn { - unicast; - } - neighbor 192.168.1.100; - } - - } -} -policy-options { - policy-statement h { - from protocol bgp; - then { - as-path-prepend 64512; - accept; - } - } -} -@end verbatim - -@node Release Notes -@section Release Notes - -@c A paragraph that introduces our release notes. - -@c outer list, one item per VNC release, items preceded by bullet -@itemize @bullet -@item - -@c @item -@end itemize - -@evenheading @thispage@|@|@thistitle -@oddheading @thischapter@|@|@thispage -@everyfooting - diff --git a/doc/vtysh.1.in b/doc/vtysh.1.in deleted file mode 100644 index ba8f3df72..000000000 --- a/doc/vtysh.1.in +++ /dev/null @@ -1,103 +0,0 @@ -.TH VTYSH 1 "27 July 2006" "@PACKAGE_FULLNAME@ VTY shell" "Version @PACKAGE_VERSION@" -.SH NAME -vtysh \- a integrated shell for @PACKAGE_FULLNAME@. -.SH SYNOPSIS -.B vtysh -[ -.B \-b -] -.br -.B vtysh -[ -.B \-E -] [ -.B \-d -.I daemon -] -] [ -.B \-c -.I command -] -.SH DESCRIPTION -.B vtysh -is a integrated shell for -.B @PACKAGE_FULLNAME@ -routing engine. -.SH OPTIONS -Options available for the -.B vtysh -command: -.IP "\fB\-b, \-\-boot\fP" -Execute boot startup configuration. It makes sense only if integrated config -file is in use (not default in @PACKAGE_FULLNAME@). See Info file -\fB@PACKAGE_NAME@\fR for more info. -.IP "\fB\-c, \-\-command \fIcommand\fP" -Specify command to be executed under batch mode. It behaves like -c option in -any other shell - -.I command -is executed and -.B vtysh -exits. - -It's useful for gathering info from @PACKAGE_FULLNAME@ daemons or reconfiguring -daemons from inside shell scripts, etc. -Note that multiple commands may be executed by using more than one --c option and/or embedding linefeed characters inside the -.I command -string. -.IP "\fB\-d, \-\-daemon \fIdaemon_name\fP" -Specify which daemon to connect to. By default, -.B vtysh -attempts to connect to all @PACKAGE_FULLNAME@ daemons running on the system. With this -flag, one can specify a single daemon to connect to instead. For example, -specifying '-d ospfd' will connect only to ospfd. This can be particularly -useful inside scripts with -c where the command is targeted for a single daemon. -.IP "\fB\-e, \-\-execute \fIcommand\fP" -Alias for -c. It's here only for compatibility with Zebra routing software and -older Frr versions. This will be removed in future. -.IP "\fB\-E, \-\-echo\fP" -When the -c option is being used, this flag will cause the standard -.B vtysh -prompt and command to be echoed prior to displaying the results. -This is particularly useful to separate the results -when executing multiple commands. -.IP "\fB\-h, \-\-help\fP" -Display a usage message on standard output and exit. -.SH ENVIRONMENT VARIABLES -.IP "\fBVTYSH_PAGER\fR" -This should be the name of the pager to use. Default is \fBmore\fR. -.SH FILES -.TP -.BI @CFG_SYSCONF@/vtysh.conf -The default location of the -.B vtysh -config file. -.TP -.BI @CFG_SYSCONF@/frr.conf -The default location of the integrated @PACKAGE_FULLNAME@ routing engine config file -if integrated config file is in use (not default). -.TP -.BI ${HOME}/.history_frr -Location of history of commands entered via cli -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR zebra (8) -.SH BUGS -.B vtysh -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/doc/vtysh.texi b/doc/vtysh.texi deleted file mode 100644 index de681c801..000000000 --- a/doc/vtysh.texi +++ /dev/null @@ -1,161 +0,0 @@ -@node VTY shell -@chapter VTY shell - -@menu -* Integrated configuration mode:: -@end menu - -@command{vtysh} provides a combined frontend to all Frr daemons in a -single combined session. It is enabled by default at build time, but can -be disabled through the @option{--disable-vtysh} option to -@command{./configure}. - -@command{vtysh} has a configuration file, @file{vtysh.conf}. The location -of that file cannot be changed from @file{@value{INSTALL_PREFIX_ETC}} since -it contains options controlling authentication behavior. This file will -also not be written by configuration-save commands, it is intended to be -updated manually by an administrator with an external editor. - -@quotation Warning -This also means the @command{hostname} and @command{banner motd} commands -(which both do have effect for vtysh) need to be manually updated in -@file{vtysh.conf}. -@end quotation - -@section Permissions and setup requirements - -@command{vtysh} connects to running daemons through Unix sockets located in -@file{@value{INSTALL_PREFIX_STATE}}. Running vtysh thus requires access to -that directory, plus membership in the @emph{@value{INSTALL_VTY_GROUP}} -group (which is the group that the daemons will change ownership of their -sockets to). - -To restrict access to Frr configuration, make sure no unauthorized users -are members of the @emph{@value{INSTALL_VTY_GROUP}} group. - -@subsection PAM support (experimental) - -vtysh has working (but rather useless) PAM support. It will perform -an "authenticate" PAM call using @emph{@value{PACKAGE_NAME}} as service -name. No other (accounting, session, password change) calls will be -performed by vtysh. - -Users using vtysh still need to have appropriate access to the daemons' -VTY sockets, usually by being member of the @emph{@value{INSTALL_VTY_GROUP}} -group. If they have this membership, PAM support is useless since they can -connect to daemons and issue commands using some other tool. Alternatively, -the @command{vtysh} binary could be made SGID (set group ID) to the -@emph{@value{INSTALL_VTY_GROUP}} group. @strong{No security guarantees are -made for this configuration}. - -@deffn {Command} {username @var{username} nopassword} {} - -If PAM support is enabled at build-time, this command allows disabling the -use of PAM on a per-user basis. If vtysh finds that an user is trying to -use vtysh and a "nopassword" entry is found, no calls to PAM will be made -at all. - -@end deffn - -@node Integrated configuration mode -@section Integrated configuration mode - -Integrated configuration mode uses a single configuration file, -@file{frr.conf}, for all daemons. This replaces the individual files like -@file{zebra.conf} or @file{bgpd.conf}. - -@file{frr.conf} is located in @file{@value{INSTALL_PREFIX_ETC}}. All -daemons check for the existence of this file at startup, and if it exists -will not load their individual configuration files. Instead, -@command{vtysh -b} must be invoked to process @file{frr.conf} and apply -its settings to the individual daemons. - -@quotation Warning -@command{vtysh -b} must also be executed after restarting any daemon. -@end quotation - -@subsection Configuration saving, file ownership and permissions - -The @file{frr.conf} file is not written by any of the daemons; instead -@command{vtysh} contains the neccessary logic to collect configuration from -all of the daemons, combine it and write it out. - -@quotation Warning -Daemons must be running for @command{vtysh} to be able to collect their -configuration. Any configuration from non-running daemons is permanently -lost after doing a configuration save. -@end quotation - -Since the @command{vtysh} command may be running as ordinary user on the -system, configuration writes will be tried through @command{watchfrr}, -using the @command{write integrated} command internally. Since -@command{watchfrr} is running as superuser, @command{vtysh} is able to -ensure correct ownership and permissions on @file{frr.conf}. - -If @command{watchfrr} is not running or the configuration write fails, -@command{vtysh} will attempt to directly write to the file. This is likely -to fail if running as unprivileged user; alternatively it may leave the -file with incorrect owner or permissions. - -Writing the configuration can be triggered directly by invoking -@command{vtysh -w}. This may be useful for scripting. Note this command -should be run as either the superuser or the Frr user. - -We recommend you do not mix the use of the two types of files. Further, it -is better not to use the integrated frr.conf file, as any syntax error in -it can lead to /all/ of your daemons being unable to start up. Per daemon -files are more robust as impact of errors in configuration are limited to -the daemon in whose file the error is made. - -@deffn {Command} {service integrated-vtysh-config} {} -@deffnx {Command} {no service integrated-vtysh-config} {} - -Control whether integrated @file{frr.conf} file is written when -'write file' is issued. - -These commands need to be placed in @file{vtysh.conf} to have any effect. -Note that since @file{vtysh.conf} is not written by Frr itself, they -therefore need to be manually placed in that file. - -This command has 3 states: -@itemize @bullet -@item -@command{service integrated-vtysh-config} - -@command{vtysh} will always write @file{frr.conf}. - -@item -@command{no service integrated-vtysh-config} - -@command{vtysh} will never write @file{frr.conf}; instead it will ask -daemons to write their individual configuration files. - -@item -Neither option present (default) - -@command{vtysh} will check whether @file{frr.conf} exists. If it does, -configuration writes will update that file. Otherwise, writes are performed -through the individual daemons. -@end itemize - -This command is primarily intended for packaging/distribution purposes, to -preset one of the two operating modes and ensure consistent operation across -installations. -@end deffn - -@deffn {Command} {write integrated} {} - -Unconditionally (regardless of @command{service integrated-vtysh-config} -setting) write out integrated @file{frr.conf} file through -@command{watchfrr}. If @command{watchfrr} is not running, this command -is unavailable. - -@end deffn - -@section Caveats - -Configuration changes made while some daemon is not running will be invisible -to that daemon. The daemon will start up with its saved configuration -(either in its individual configuration file, or in @file{frr.conf}). -This is particularly troublesome for route-maps and prefix lists, which would -otherwise be synchronized between daemons. diff --git a/doc/watchfrr.8.in b/doc/watchfrr.8.in deleted file mode 100644 index 782ac7b46..000000000 --- a/doc/watchfrr.8.in +++ /dev/null @@ -1,155 +0,0 @@ -.\" This file was originally generated by help2man 1.36. -.TH WATCHFRR 8 "July 2010" -.SH NAME -watchfrr \- a program to monitor the status of frr daemons -.SH SYNOPSIS -.B watchfrr -.RI [ option ...] -.IR daemon ... -.br -.B watchfrr -.BR \-h " | " \-v -.SH DESCRIPTION -.B watchfrr -is a watchdog program that monitors the status of supplied frr -.IR daemon s -and tries to restart them in case they become unresponsive or shut down. -.PP -To determine whether a daemon is running, it tries to connect to the -daemon's VTY UNIX stream socket, and send echo commands to ensure the -daemon responds. When the daemon crashes, EOF is received from the socket, -so that watchfrr can react immediately. -.PP -In order to avoid restarting the daemons in quick succession, you can -supply the -.B \-m -and -.B \-M -options to set the minimum and maximum delay between the restart commands. -The minimum restart delay is recalculated each time a restart is attempted. -If the time since the last restart attempt exceeds twice the value of -.BR \-M , -the restart delay is set to the value of -.BR \-m , -otherwise the interval is doubled (but capped at the value of -.BR \-M ). -.SH OPTIONS -The following 3 options specify scripts that -.B watchfrr -uses to perform start/stop/restart actions. These options are mandatory -unless the -.B --dry -option is used: -.TP -.BI \-s " command" "\fR, \fB\-\-start\-command " command -Supply a Bourne shell -.I command -to start a single daemon. The command string should contain the '%s' -placeholder to be substituted with the daemon name. -.TP -.BI \-k " command" "\fR, \fB\-\-kill\-command " command -Supply a Bourne shell -.I command -to stop a single daemon. The command string should contain the '%s' -placeholder to be substituted with the daemon name. -.TP -.BI \-r " command" "\fR, \fB\-\-restart " command -Supply a Bourne shell -.I command -to restart a single daemon. The command string should contain the '%s' -placeholder to be substituted with the daemon name. -.PP -Other options: -.TP -.BI \-\-dry -Run watchfrr in "dry-run" mode, only monitoring the specified daemons but not -performing any start/stop/restart actions. -.TP -.BR \-d ", " \-\-daemon -Run in daemon mode. When supplied, error messages are sent to Syslog -instead of standard output (stdout). -.TP -.BI \-S " directory" "\fR, \fB\-\-statedir " directory -Set the VTY socket -.I directory -(the default value is "/var/run/frr"). -.TP -.BI \-l " level" "\fR, \fB\-\-loglevel " level -Set the logging -.I level -(the default value is "6"). The value should range from 0 (LOG_EMERG) to 7 -(LOG_DEBUG), but higher number can be supplied if extra debugging messages -are required. -.TP -.BI \-\-min\-restart\-interval " number -Set the minimum -.I number -of seconds to wait between invocations of the daemon restart commands (the -default value is "60"). -.TP -.BI \-\-max\-restart\-interval " number -Set the maximum -.I number -of seconds to wait between invocations of the daemon restart commands (the -default value is "600"). -.TP -.BI \-i " number" "\fR, \fB\-\-interval " number -Set the status polling interval in seconds (the default value is "5"). -.TP -.BI \-t " number" "\fR, \fB\-\-timeout " number -Set the unresponsiveness timeout in seconds (the default value is "10"). -.TP -.BI \-T " number" "\fR, \fB\-\-restart\-timeout " number -Set the restart (kill) timeout in seconds (the default value is "20"). If -any background jobs are still running after this period has elapsed, they -will be killed. -.TP -.BI \-p " filename" "\fR, \fB\-\-pid\-file " filename -Set the process identifier -.I filename -(the default value is "/var/run/frr/watchfrr.pid"). -.TP -.BI \-b " string" "\fR, \fB\-\-blank\-string " string -When the supplied -.I string -is found in any of the command line option arguments (i.e., -.BR \-r , -.BR \-s , -or -.BR \-k ), -replace it with a space. -.IP -This is an ugly hack to circumvent problems with passing the command line -arguments containing embedded spaces. -.TP -.BR \-v ", " \-\-version -Display the version information and exit. -.TP -.BR \-h ", " \-\-help -Display the usage information and exit. -.SH PREVIOUS OPTIONS -Prior versions of \fBwatchfrr\fR supported some additional options that no -longer exist: -.IP -.BR \-a ,\ \-A ,\ \-e ,\ \-R ,\ \-z -.PP -The \fB-a\fR, \fB-A\fR and \fB-R\fR options were used to select alternate -monitoring modes that offered different patterns of restarting daemons. The -"correct" mode (phased restart) is now the default. The \fB-e\fR and \fB-z\fR -options used to disable some monitoring aspects, watchfrr now always has all -monitoring features enabled. -.PP -Removing these options should result in correct operation, if it does not -please file a bug report. -.SH SEE ALSO -.BR zebra (8), -.BR bgpd (8), -.BR isisd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR ripd (8), -.BR ripngd (8) -.PP -See the project homepage at <@PACKAGE_URL@>. -.SH AUTHORS -Copyright 2004 Andrew J. Schorr diff --git a/doc/zebra.8.in b/doc/zebra.8.in deleted file mode 100644 index 3e1d10e06..000000000 --- a/doc/zebra.8.in +++ /dev/null @@ -1,158 +0,0 @@ -.TH ZEBRA 8 "25 November 2004" "Zebra daemon" "Version @PACKAGE_VERSION@" -.SH NAME -zebra \- a routing manager for use with associated @PACKAGE_FULLNAME@ components. -.SH SYNOPSIS -.B zebra -[ -.B \-bdhklrv -] [ -.B \-f -.I config-file -] [ -.B \-i -.I pid-file -] [ -.B \-P -.I port-number -] [ -.B \-A -.I vty-address -] [ -.B \-u -.I user -] [ -.B \-g -.I group -] [ -.B \-M -.I module:options -] [ -.B \-z -.I socketpath -] -.SH DESCRIPTION -.B zebra -is a routing manager that implements the -.B zebra -route engine. -.B zebra -supports RIPv1, RIPv2, RIPng, OSPF, OSPF6, IS-IS, BGP4+, and BGP4-. -.SH OPTIONS -Options available for the -.B zebra -command: -.TP -\fB\-b\fR, \fB\-\-batch\fR -Runs in batch mode, \fBzebra\fR parses its config and exits. -.TP -\fB\-d\fR, \fB\-\-daemon\fR -Runs in daemon mode, forking and exiting from tty. -.TP -\fB\-f\fR, \fB\-\-config-file \fR\fIconfig-file\fR -Specifies the config file to use for startup. If not specified this -option will default to \fB\fI@CFG_SYSCONF@/zebra.conf\fR. -.TP -\fB\-g\fR, \fB\-\-group \fR\fIgroup\fR -Specify the group to run as. Default is \fI@enable_group@\fR. -.TP -\fB\-h\fR, \fB\-\-help\fR -A brief message. -.TP -\fB\-i\fR, \fB\-\-pid_file \fR\fIpid-file\fR -When zebra starts its process identifier is written to -\fB\fIpid-file\fR. The init system uses the recorded PID to stop or -restart zebra. The default is \fB\fI@CFG_STATE@/zebra.pid\fR. -.TP -\fB\-k\fR, \fB\-\-keep_kernel\fR -On startup, don't delete self inserted routes. -.TP -\fB\-P\fR, \fB\-\-vty_port \fR\fIport-number\fR -Specify the port that the zebra VTY will listen on. This defaults to -2601, as specified in \fB\fI/etc/services\fR. -.TP -\fB\-A\fR, \fB\-\-vty_addr \fR\fIvty-address\fR -Specify the address that the zebra VTY will listen on. Default is all -interfaces. -.TP -\fB\-u\fR, \fB\-\-user \fR\fIuser\fR -Specify the user to run as. Default is \fI@enable_user@\fR. -.TP -\fB\-r\fR, \fB\-\-retain\fR -When the program terminates, retain routes added by \fBzebra\fR. -.TP -\fB\-s\fR, \fB\-\-nl-bufsize \fR\fInetlink-buffer-size\fR -Set netlink receive buffer size. There are cases where zebra daemon can't -handle flood of netlink messages from kernel. If you ever see "recvmsg overrun" -messages in zebra log, you are in trouble. - -Solution is to increase receive buffer of netlink socket. Note that kernel -< 2.6.14 doesn't allow to increase it over maximum value defined in -\fI/proc/sys/net/core/rmem_max\fR. If you want to do it, you have to increase -maximum before starting zebra. - -Note that this affects Linux only. -.TP -\fB\-n\fR, \fB\-\-vrfwnetns \fR\fIEnable namespace VRF\fR -Enable namespace VRF backend. By default, the VRF backend relies on VRF-lite -support from Linux devices. This option permits discovering using Linux named -Netns and map it to FRR VRF contexts. -.TP -\fB\-M\fR, \fB\-\-module \fR\fImodule:options\fR -Load a module at startup. May be specified more than once. -The \fBsnmp\fR and \fBfpm\fR modules may be -available for \fBzebra\fR, if the package was built with SNMP and FPM support -respectively. The \fBfpm\fR module takes an additional colon-separated -argument specifying the encapsulation, either \fBnetlink\fR or \fBprotobuf\fR. -It should thus be loaded with \fB-M fpm:netlink\fR or \fB-M fpm:protobuf\fR. -.TP -\fB\-z\fR, \fB\-\-socket \fR\fIsocketpath\fR -Use the specified path to open the zebra API socket on. -The default is \fB\fI@CFG_STATE@/zserv.api\fR. This option must be given with -the same value to all FRR protocol daemons. -.TP -\fB\-v\fR, \fB\-\-version\fR -Print the version and exit. -.SH FILES -.TP -.BI @CFG_SBIN@/zebra -The default location of the -.B zebra -binary. -.TP -.BI @CFG_SYSCONF@/zebra.conf -The default location of the -.B zebra -config file. -.TP -.BI $(PWD)/zebra.log -If the -.B zebra -process is config'd to output logs to a file, then you will find this -file in the directory where you started \fBzebra\fR. -.SH WARNING -This man page is intended to be a quick reference for command line -options. The definitive document is the Info file \fB@PACKAGE_NAME@\fR. -.SH DIAGNOSTICS -The zebra process may log to standard output, to a VTY, to a log -file, or through syslog to the system logs. \fBzebra\fR supports many -debugging options, see the Info file, or the source for details. -.SH "SEE ALSO" -.BR bgpd (8), -.BR ripd (8), -.BR ripngd (8), -.BR ospfd (8), -.BR ospf6d (8), -.BR isisd (8), -.BR nhrpd (8), -.BR vtysh (1) -.SH BUGS -.B zebra -eats bugs for breakfast. If you have food for the maintainers try -.BI @PACKAGE_BUGREPORT@ -.SH AUTHORS -See -.BI http://www.zebra.org -and -.BI @PACKAGE_URL@ -or the Info file for an accurate list of authors. - diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 72e6d4bdb..a6e1a55a9 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -47,6 +47,7 @@ #include "isisd/isis_spf.h" #include "isisd/isis_events.h" #include "isisd/isis_mt.h" +#include "isisd/isis_tlvs.h" extern struct isis *isis; @@ -78,6 +79,7 @@ struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, adj->level = level; adj->flaps = 0; adj->last_flap = time(NULL); + adj->threeway_state = ISIS_THREEWAY_DOWN; if (circuit->circ_type == CIRCUIT_T_BROADCAST) { listnode_add(circuit->u.bc.adjdb[level - 1], adj); adj->dischanges[level - 1] = 0; @@ -161,6 +163,51 @@ static const char *adj_state2string(int state) return NULL; /* not reached */ } +void isis_adj_process_threeway(struct isis_adjacency *adj, + struct isis_threeway_adj *tw_adj, + enum isis_adj_usage adj_usage) +{ + enum isis_threeway_state next_tw_state = ISIS_THREEWAY_DOWN; + + if (tw_adj && !adj->circuit->disable_threeway_adj) { + if (tw_adj->state == ISIS_THREEWAY_DOWN) { + next_tw_state = ISIS_THREEWAY_INITIALIZING; + } else if (tw_adj->state == ISIS_THREEWAY_INITIALIZING) { + next_tw_state = ISIS_THREEWAY_UP; + } else if (tw_adj->state == ISIS_THREEWAY_UP) { + if (adj->threeway_state == ISIS_THREEWAY_DOWN) + next_tw_state = ISIS_THREEWAY_DOWN; + else + next_tw_state = ISIS_THREEWAY_UP; + } + } else { + next_tw_state = ISIS_THREEWAY_UP; + } + + if (next_tw_state != adj->threeway_state) { + if (isis->debugs & DEBUG_ADJ_PACKETS) { + zlog_info("ISIS-Adj (%s): Threeway state change %s to %s", + adj->circuit->area->area_tag, + isis_threeway_state_name(adj->threeway_state), + isis_threeway_state_name(next_tw_state)); + } + } + + if (next_tw_state == ISIS_THREEWAY_DOWN) { + isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Neighbor restarted"); + return; + } + + if (next_tw_state == ISIS_THREEWAY_UP) { + if (adj->adj_state != ISIS_ADJ_UP) { + isis_adj_state_change(adj, ISIS_ADJ_UP, NULL); + adj->adj_usage = adj_usage; + } + } + + adj->threeway_state = next_tw_state; +} + void isis_adj_state_change(struct isis_adjacency *adj, enum isis_adj_state new_state, const char *reason) { diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index 98bb9838f..2c3bd19af 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -25,6 +25,8 @@ #ifndef _ZEBRA_ISIS_ADJACENCY_H #define _ZEBRA_ISIS_ADJACENCY_H +#include "isisd/isis_tlvs.h" + enum isis_adj_usage { ISIS_ADJ_NONE, ISIS_ADJ_LEVEL1, @@ -91,6 +93,8 @@ struct isis_adjacency { u_int16_t hold_time; /* entryRemainingTime */ u_int32_t last_upd; u_int32_t last_flap; /* last time the adj flapped */ + enum isis_threeway_state threeway_state; + uint32_t ext_circuit_id; int flaps; /* number of adjacency flaps */ struct thread *t_expire; /* expire after hold_time */ struct isis_circuit *circuit; /* back pointer */ @@ -98,12 +102,17 @@ struct isis_adjacency { unsigned int mt_count; /* Number of entries in mt_set */ }; +struct isis_threeway_adj; + struct isis_adjacency *isis_adj_lookup(const u_char *sysid, struct list *adjdb); struct isis_adjacency *isis_adj_lookup_snpa(const u_char *ssnpa, struct list *adjdb); struct isis_adjacency *isis_new_adj(const u_char *id, const u_char *snpa, int level, struct isis_circuit *circuit); void isis_delete_adj(void *adj); +void isis_adj_process_threeway(struct isis_adjacency *adj, + struct isis_threeway_adj *tw_adj, + enum isis_adj_usage adj_usage); void isis_adj_state_change(struct isis_adjacency *adj, enum isis_adj_state state, const char *reason); void isis_adj_print(struct isis_adjacency *adj); diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 75d439763..2c443c71f 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -234,8 +234,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit, #ifdef EXTREME_DEBUG prefix2str(connected->address, buf, sizeof(buf)); - zlog_debug("Added IP address %s to circuit %d", buf, - circuit->circuit_id); + zlog_debug("Added IP address %s to circuit %s", buf, + circuit->interface->name); #endif /* EXTREME_DEBUG */ } if (connected->address->family == AF_INET6) { @@ -265,8 +265,8 @@ void isis_circuit_add_addr(struct isis_circuit *circuit, #ifdef EXTREME_DEBUG prefix2str(connected->address, buf, sizeof(buf)); - zlog_debug("Added IPv6 address %s to circuit %d", buf, - circuit->circuit_id); + zlog_debug("Added IPv6 address %s to circuit %s", buf, + circuit->interface->name); #endif /* EXTREME_DEBUG */ } return; @@ -300,9 +300,9 @@ void isis_circuit_del_addr(struct isis_circuit *circuit, } else { prefix2str(connected->address, buf, sizeof(buf)); zlog_warn( - "Nonexistant ip address %s removal attempt from \ - circuit %d", - buf, circuit->circuit_id); + "Nonexistent ip address %s removal attempt from \ + circuit %s", + buf, circuit->interface->name); zlog_warn("Current ip addresses on %s:", circuit->interface->name); for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, node, @@ -349,9 +349,9 @@ void isis_circuit_del_addr(struct isis_circuit *circuit, if (!found) { prefix2str(connected->address, buf, sizeof(buf)); zlog_warn( - "Nonexitant ip address %s removal attempt from \ - circuit %d", - buf, circuit->circuit_id); + "Nonexistent ip address %s removal attempt from \ + circuit %s", + buf, circuit->interface->name); zlog_warn("Current ip addresses on %s:", circuit->interface->name); for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_link, node, @@ -377,17 +377,15 @@ void isis_circuit_del_addr(struct isis_circuit *circuit, return; } -static uint8_t isis_circuit_id_gen(struct interface *ifp) +static uint8_t isis_circuit_id_gen(struct isis *isis, struct interface *ifp) { /* Circuit ids MUST be unique for any broadcast circuits. Otherwise, * Pseudo-Node LSPs cannot be generated correctly. * - * Currently, allocate one circuit ID for any circuit, limiting the - * total + * Currently, allocate one circuit ID for any circuit, limiting the total * numer of circuits IS-IS can run on to 255. * - * We should revisit this when implementing 3-way adjacencies for p2p, - * since + * We should revisit this when implementing 3-way adjacencies for p2p, since * we then have extended interface IDs available. */ uint8_t id = ifp->ifindex; @@ -405,6 +403,7 @@ static uint8_t isis_circuit_id_gen(struct interface *ifp) return 0; } + _ISIS_SET_FLAG(isis->circuit_ids_used, id); return id; } @@ -413,11 +412,7 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp) struct listnode *node, *nnode; struct connected *conn; - circuit->circuit_id = isis_circuit_id_gen(ifp); - _ISIS_SET_FLAG(isis->circuit_ids_used, circuit->circuit_id); - isis_circuit_if_bind(circuit, ifp); - /* isis_circuit_update_addrs (circuit, ifp); */ if (if_is_broadcast(ifp)) { if (circuit->circ_type_config == CIRCUIT_T_P2P) @@ -442,8 +437,6 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp) for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn)) isis_circuit_add_addr(circuit, conn); - - return; } void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp) @@ -460,26 +453,19 @@ void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp) if (circuit->ip_addrs) { assert(listcount(circuit->ip_addrs) == 0); list_delete_and_null(&circuit->ip_addrs); - circuit->ip_addrs = NULL; } if (circuit->ipv6_link) { assert(listcount(circuit->ipv6_link) == 0); list_delete_and_null(&circuit->ipv6_link); - circuit->ipv6_link = NULL; } if (circuit->ipv6_non_link) { assert(listcount(circuit->ipv6_non_link) == 0); list_delete_and_null(&circuit->ipv6_non_link); - circuit->ipv6_non_link = NULL; } circuit->circ_type = CIRCUIT_T_UNKNOWN; - _ISIS_CLEAR_FLAG(isis->circuit_ids_used, circuit->circuit_id); - circuit->circuit_id = 0; - - return; } void isis_circuit_if_bind(struct isis_circuit *circuit, struct interface *ifp) @@ -593,6 +579,12 @@ int isis_circuit_up(struct isis_circuit *circuit) } if (circuit->circ_type == CIRCUIT_T_BROADCAST) { + circuit->circuit_id = isis_circuit_id_gen(isis, circuit->interface); + if (!circuit->circuit_id) { + zlog_err("There are already 255 broadcast circuits active!"); + return ISIS_ERROR; + } + /* * Get the Hardware Address */ @@ -737,6 +729,9 @@ void isis_circuit_down(struct isis_circuit *circuit) THREAD_TIMER_OFF(circuit->u.bc.t_refresh_pseudo_lsp[1]); circuit->lsp_regenerate_pending[0] = 0; circuit->lsp_regenerate_pending[1] = 0; + + _ISIS_CLEAR_FLAG(isis->circuit_ids_used, circuit->circuit_id); + circuit->circuit_id = 0; } else if (circuit->circ_type == CIRCUIT_T_P2P) { isis_delete_adj(circuit->u.p2p.neighbor); circuit->u.p2p.neighbor = NULL; @@ -1046,6 +1041,11 @@ int isis_interface_config_write(struct vty *vty) write++; } + if (circuit->disable_threeway_adj) { + vty_out(vty, " no isis three-way-handshake\n"); + write++; + } + /* ISIS - Hello interval */ if (circuit->hello_interval[0] == circuit->hello_interval[1]) { diff --git a/isisd/isis_circuit.h b/isisd/isis_circuit.h index 0d392036e..246279c6f 100644 --- a/isisd/isis_circuit.h +++ b/isisd/isis_circuit.h @@ -32,8 +32,6 @@ #include "isis_constants.h" #include "isis_common.h" -#define CIRCUIT_MAX 255 - struct isis_lsp; struct password { @@ -69,7 +67,7 @@ struct isis_p2p_info { struct isis_circuit { int state; - u_char circuit_id; /* l1/l2 p2p/bcast CircuitID */ + u_char circuit_id; /* l1/l2 bcast CircuitID */ struct isis_area *area; /* back pointer to the area */ struct interface *interface; /* interface info from z */ int fd; /* IS-IS l1/2 socket */ @@ -82,9 +80,8 @@ struct isis_circuit { struct thread *t_send_csnp[2]; struct thread *t_send_psnp[2]; struct thread *t_send_lsp; - struct list *lsp_queue; /* LSPs to be txed (both levels) */ - struct isis_lsp_hash - *lsp_hash; /* Hashtable synchronized with lsp_queue */ + struct list *lsp_queue; /* LSPs to be txed (both levels) */ + struct isis_lsp_hash *lsp_hash; /* Hashtable synchronized with lsp_queue */ time_t lsp_queue_last_push[2]; /* timestamp used to enforce transmit * interval; * for scalability, use one timestamp per @@ -135,6 +132,7 @@ struct isis_circuit { u_int16_t upadjcount[2]; #define ISIS_CIRCUIT_FLAPPED_AFTER_SPF 0x01 u_char flags; + bool disable_threeway_adj; /* * Counters as in 10589--11.2.5.9 */ diff --git a/isisd/isis_csm.c b/isisd/isis_csm.c index a283260d9..10870d5c5 100644 --- a/isisd/isis_csm.c +++ b/isisd/isis_csm.c @@ -86,13 +86,6 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg) case IF_UP_FROM_Z: circuit = isis_circuit_new(); isis_circuit_if_add(circuit, (struct interface *)arg); - if (!circuit->circuit_id) { - isis_circuit_if_del(circuit, - (struct interface *)arg); - isis_circuit_del(circuit); - circuit = NULL; - break; - } listnode_add(isis->init_circ_list, circuit); circuit->state = C_STATE_INIT; break; @@ -143,8 +136,6 @@ isis_csm_state_change(int event, struct isis_circuit *circuit, void *arg) break; case IF_UP_FROM_Z: isis_circuit_if_add(circuit, (struct interface *)arg); - if (!circuit->circuit_id) - break; if (isis_circuit_up(circuit) != ISIS_OK) { zlog_err( "Could not bring up %s because of invalid config.", diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 55888bd38..b2ba8b393 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1034,7 +1034,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) break; case CIRCUIT_T_P2P: { struct isis_adjacency *nei = circuit->u.p2p.neighbor; - if (nei && (level & nei->circuit_t)) { + if (nei && nei->adj_state == ISIS_ADJ_UP + && (level & nei->circuit_t)) { uint8_t ne_id[7]; memcpy(ne_id, nei->sysid, ISIS_SYS_ID_LEN); LSP_PSEUDO_ID(ne_id) = 0; @@ -1875,15 +1876,12 @@ int lsp_tick(struct thread *thread) if (!circuit->lsp_queue) continue; - if (now - - circuit->lsp_queue_last_push - [level] + if (now - circuit->lsp_queue_last_push[level] < MIN_LSP_RETRANS_INTERVAL) { continue; } - circuit->lsp_queue_last_push[level] = - now; + circuit->lsp_queue_last_push[level] = now; for (ALL_LIST_ELEMENTS_RO( lsp_list, lspnode, lsp)) { diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 20c39a624..bcbda3308 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -120,6 +120,32 @@ struct iih_info { static int process_p2p_hello(struct iih_info *iih) { + struct isis_threeway_adj *tw_adj = iih->tlvs->threeway_adj; + if (tw_adj) { + if (tw_adj->state > ISIS_THREEWAY_DOWN) { + if (isis->debugs & DEBUG_ADJ_PACKETS) { + zlog_debug("ISIS-Adj (%s): Rcvd P2P IIH from (%s) with invalid three-way state: %d\n", + iih->circuit->area->area_tag, + iih->circuit->interface->name, + tw_adj->state); + } + return ISIS_WARNING; + } + + if (tw_adj->neighbor_set + && (memcmp(tw_adj->neighbor_id, isis->sysid, ISIS_SYS_ID_LEN) + || tw_adj->neighbor_circuit_id != (uint32_t) iih->circuit->idx)) { + + if (isis->debugs & DEBUG_ADJ_PACKETS) { + zlog_debug("ISIS-Adj (%s): Rcvd P2P IIH from (%s) which lists IS/Circuit different from us as neighbor.\n", + iih->circuit->area->area_tag, + iih->circuit->interface->name); + } + + return ISIS_WARNING; + } + } + /* * My interpertation of the ISO, if no adj exists we will create one for * the circuit @@ -155,6 +181,9 @@ static int process_p2p_hello(struct iih_info *iih) adj->sys_type = ISIS_SYSTYPE_UNKNOWN; } + if (tw_adj && adj->threeway_state == ISIS_THREEWAY_DOWN) + adj->ext_circuit_id = tw_adj->local_circuit_id; + /* 8.2.6 Monitoring point-to-point adjacencies */ adj->hold_time = iih->holdtime; adj->last_upd = time(NULL); @@ -183,14 +212,10 @@ static int process_p2p_hello(struct iih_info *iih) switch (iih->circ_type) { case IS_LEVEL_1: case IS_LEVEL_1_AND_2: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (4) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (5) adj usage level 1 */ - adj->adj_usage = ISIS_ADJ_LEVEL1; - } else if (adj->adj_usage == ISIS_ADJ_LEVEL1) { - ; /* accept */ + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL1) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL1); } break; case IS_LEVEL_2: @@ -213,14 +238,10 @@ static int process_p2p_hello(struct iih_info *iih) if (iih->circuit->area->is_type == IS_LEVEL_1_AND_2) { switch (iih->circ_type) { case IS_LEVEL_1: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (6) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (7) adj usage level 1 */ - adj->adj_usage = ISIS_ADJ_LEVEL1; - } else if (adj->adj_usage == ISIS_ADJ_LEVEL1) { - ; /* accept */ + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL1) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL1); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1AND2) || (adj->adj_usage @@ -232,12 +253,10 @@ static int process_p2p_hello(struct iih_info *iih) } break; case IS_LEVEL_2: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (6) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (9) adj usage level 2 */ - adj->adj_usage = ISIS_ADJ_LEVEL2; + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL2) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL2); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) || (adj->adj_usage == ISIS_ADJ_LEVEL1AND2)) { @@ -245,17 +264,13 @@ static int process_p2p_hello(struct iih_info *iih) isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Wrong System"); - } else if (adj->adj_usage == ISIS_ADJ_LEVEL2) { - ; /* Accept */ } break; case IS_LEVEL_1_AND_2: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (6) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (10) adj usage level 1 */ - adj->adj_usage = ISIS_ADJ_LEVEL1AND2; + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL1AND2) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL1AND2); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) || (adj->adj_usage == ISIS_ADJ_LEVEL2)) { @@ -263,9 +278,6 @@ static int process_p2p_hello(struct iih_info *iih) isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Wrong System"); - } else if (adj->adj_usage - == ISIS_ADJ_LEVEL1AND2) { - ; /* Accept */ } break; } @@ -292,20 +304,16 @@ static int process_p2p_hello(struct iih_info *iih) break; case IS_LEVEL_1_AND_2: case IS_LEVEL_2: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (7) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (8) adj usage level 2 */ - adj->adj_usage = ISIS_ADJ_LEVEL2; + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL2) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL2); } else if (adj->adj_usage == ISIS_ADJ_LEVEL1AND2) { /* (6) down - wrong system */ isis_adj_state_change(adj, ISIS_ADJ_DOWN, "Wrong System"); - } else if (adj->adj_usage == ISIS_ADJ_LEVEL2) { - ; /* Accept */ } break; } @@ -350,12 +358,10 @@ static int process_p2p_hello(struct iih_info *iih) break; case IS_LEVEL_1_AND_2: case IS_LEVEL_2: - if (adj->adj_state != ISIS_ADJ_UP) { - /* (8) adj state up */ - isis_adj_state_change(adj, ISIS_ADJ_UP, - NULL); - /* (9) adj usage level 2 */ - adj->adj_usage = ISIS_ADJ_LEVEL2; + if (adj->adj_state != ISIS_ADJ_UP + || adj->adj_usage == ISIS_ADJ_LEVEL2) { + isis_adj_process_threeway(adj, tw_adj, + ISIS_ADJ_LEVEL2); } else if (adj->adj_usage == ISIS_ADJ_LEVEL1) { /* (7) down - wrong system */ isis_adj_state_change(adj, @@ -374,8 +380,6 @@ static int process_p2p_hello(struct iih_info *iih) adj, ISIS_ADJ_DOWN, "Area Mismatch"); } - } else if (adj->adj_usage == ISIS_ADJ_LEVEL2) { - ; /* Accept */ } break; } @@ -415,7 +419,7 @@ static int process_p2p_hello(struct iih_info *iih) if (isis->debugs & DEBUG_ADJ_PACKETS) { zlog_debug( "ISIS-Adj (%s): Rcvd P2P IIH from (%s), cir type %s," - " cir id %02d, length %d", + " cir id %hhu, length %" PRIu16, iih->circuit->area->area_tag, iih->circuit->interface->name, circuit_t2string(iih->circuit->is_type), @@ -1184,8 +1188,7 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit, entry = entry->next) { zlog_debug( "ISIS-Snp (%s): %cSNP entry %s, seq 0x%08" PRIx32 - ", cksum 0x%04" PRIx16 ", lifetime %" PRIu16 - "s", + ", cksum 0x%04" PRIx16 ", lifetime %" PRIu16 "s", circuit->area->area_tag, typechar, rawlspid_print(entry->id), entry->seqno, entry->checksum, entry->rem_lifetime); @@ -1244,12 +1247,10 @@ static int process_snp(uint8_t pdu_type, struct isis_circuit *circuit, ISIS_SYS_ID_LEN + 1); LSP_FRAGMENT(lspid) = 0; lsp0 = lsp_search( - lspid, - circuit->area - ->lspdb[level - 1]); + lspid, + circuit->area->lspdb[level - 1]); if (!lsp0) { - zlog_debug( - "Got lsp frag in snp, while zero not in database"); + zlog_debug("Got lsp frag in snp, while zero not in database"); continue; } } @@ -1555,9 +1556,25 @@ int send_hello(struct isis_circuit *circuit, int level) isis_tlvs_add_area_addresses(tlvs, circuit->area->area_addrs); - if (circuit->circ_type == CIRCUIT_T_BROADCAST) + if (circuit->circ_type == CIRCUIT_T_BROADCAST) { isis_tlvs_add_lan_neighbors( tlvs, circuit->u.bc.lan_neighs[level - 1]); + } else if (circuit->circ_type == CIRCUIT_T_P2P + && !circuit->disable_threeway_adj) { + uint32_t ext_circuit_id = circuit->idx; + if (circuit->u.p2p.neighbor) { + isis_tlvs_add_threeway_adj(tlvs, + circuit->u.p2p.neighbor->threeway_state, + ext_circuit_id, + circuit->u.p2p.neighbor->sysid, + circuit->u.p2p.neighbor->ext_circuit_id); + } else { + isis_tlvs_add_threeway_adj(tlvs, + ISIS_THREEWAY_DOWN, + ext_circuit_id, + NULL, 0); + } + } isis_tlvs_set_protocols_supported(tlvs, &circuit->nlpids); diff --git a/isisd/isis_route.c b/isisd/isis_route.c index b9605018e..ad769f988 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -100,26 +100,6 @@ static int nexthoplookup(struct list *nexthops, struct in_addr *ip, return 0; } -#ifdef EXTREME_DEBUG -static void nexthop_print(struct isis_nexthop *nh) -{ - u_char buf[BUFSIZ]; - - inet_ntop(AF_INET, &nh->ip, (char *)buf, BUFSIZ); - - zlog_debug(" %s %u", buf, nh->ifindex); -} - -static void nexthops_print(struct list *nhs) -{ - struct listnode *node; - struct isis_nexthop *nh; - - for (ALL_LIST_ELEMENTS_RO(nhs, node, nh)) - nexthop_print(nh); -} -#endif /* EXTREME_DEBUG */ - static struct isis_nexthop6 *isis_nexthop6_new(struct in6_addr *ip6, ifindex_t ifindex) { @@ -184,26 +164,6 @@ static int nexthop6lookup(struct list *nexthops6, struct in6_addr *ip6, return 0; } -#ifdef EXTREME_DEBUG -static void nexthop6_print(struct isis_nexthop6 *nh6) -{ - u_char buf[BUFSIZ]; - - inet_ntop(AF_INET6, &nh6->ip6, (char *)buf, BUFSIZ); - - zlog_debug(" %s %u", buf, nh6->ifindex); -} - -static void nexthops6_print(struct list *nhs6) -{ - struct listnode *node; - struct isis_nexthop6 *nh6; - - for (ALL_LIST_ELEMENTS_RO(nhs6, node, nh6)) - nexthop6_print(nh6); -} -#endif /* EXTREME_DEBUG */ - static void adjinfo2nexthop(struct list *nexthops, struct isis_adjacency *adj) { struct isis_nexthop *nh; diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 0eabcb7e4..dc86d4c10 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -85,10 +85,10 @@ struct isis_vertex { struct prefix prefix; } N; - u_int32_t d_N; /* d(N) Distance from this IS */ - u_int16_t depth; /* The depth in the imaginary tree */ - struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ - struct list *parents; /* list of parents for ECMP */ + u_int32_t d_N; /* d(N) Distance from this IS */ + u_int16_t depth; /* The depth in the imaginary tree */ + struct list *Adj_N; /* {Adj(N)} next hop or neighbor list */ + struct list *parents; /* list of parents for ECMP */ uint64_t insert_counter; }; @@ -276,12 +276,11 @@ static void isis_vertex_queue_delete(struct isis_vertex_queue *queue, struct isis_spftree { struct isis_vertex_queue paths; /* the SPT */ struct isis_vertex_queue tents; /* TENT */ - struct isis_area *area; /* back pointer to area */ - unsigned int runcount; /* number of runs since uptime */ - time_t last_run_timestamp; /* last run timestamp as wall time for - display */ - time_t last_run_monotime; /* last run as monotime for scheduling */ - time_t last_run_duration; /* last run duration in msec */ + struct isis_area *area; /* back pointer to area */ + unsigned int runcount; /* number of runs since uptime */ + time_t last_run_timestamp; /* last run timestamp as wall time for display */ + time_t last_run_monotime; /* last run as monotime for scheduling */ + time_t last_run_duration; /* last run duration in msec */ uint16_t mtid; int family; @@ -335,12 +334,12 @@ static void remove_excess_adjs(struct list *adjs) if (comp < 0) continue; - if (candidate->circuit->circuit_id > adj->circuit->circuit_id) { + if (candidate->circuit->idx > adj->circuit->idx) { excess = node; continue; } - if (candidate->circuit->circuit_id < adj->circuit->circuit_id) + if (candidate->circuit->idx < adj->circuit->idx) continue; comp = memcmp(candidate->snpa, adj->snpa, ETH_ALEN); @@ -831,10 +830,10 @@ static int isis_spf_process_lsp(struct isis_spftree *spftree, return ISIS_OK; /* RFC3787 section 4 SHOULD ignore overload bit in pseudo LSPs */ - bool no_overload = - (pseudo_lsp || (spftree->mtid == ISIS_MT_IPV4_UNICAST + bool no_overload = (pseudo_lsp + || (spftree->mtid == ISIS_MT_IPV4_UNICAST && !ISIS_MASK_LSP_OL_BIT(lsp->hdr.lsp_bits)) - || (mt_router_info && !mt_router_info->overload)); + || (mt_router_info && !mt_router_info->overload)); lspfragloop: if (lsp->hdr.seqno == 0) { @@ -1153,7 +1152,7 @@ static int isis_spf_preload_tent(struct isis_spftree *spftree, root_sysid, parent); } else if (circuit->circ_type == CIRCUIT_T_P2P) { adj = circuit->u.p2p.neighbor; - if (!adj) + if (!adj || adj->adj_state != ISIS_ADJ_UP) continue; if (!adj_has_mt(adj, spftree->mtid)) continue; @@ -1430,8 +1429,7 @@ int isis_spf_schedule(struct isis_area *area, int level) /* wait configured min_spf_interval before doing the SPF */ long timer; if (diff >= area->min_spf_interval[level - 1]) { - /* Last run is more than min interval ago, schedule immediate - * run */ + /* Last run is more than min interval ago, schedule immediate run */ timer = 0; } else { timer = area->min_spf_interval[level - 1] - diff; @@ -1549,9 +1547,7 @@ DEFUN (show_isis_topology, continue; if (area->ip_circuits > 0 && area->spftree[level - 1] - && isis_vertex_queue_count( - &area->spftree[level - 1]->paths) - > 0) { + && isis_vertex_queue_count(&area->spftree[level - 1]->paths) > 0) { vty_out(vty, "IS-IS paths to level-%d routers that speak IP\n", level); @@ -1561,9 +1557,7 @@ DEFUN (show_isis_topology, vty_out(vty, "\n"); } if (area->ipv6_circuits > 0 && area->spftree6[level - 1] - && isis_vertex_queue_count( - &area->spftree6[level - 1]->paths) - > 0) { + && isis_vertex_queue_count(&area->spftree6[level - 1]->paths) > 0) { vty_out(vty, "IS-IS paths to level-%d routers that speak IPv6\n", level); diff --git a/isisd/isis_te.c b/isisd/isis_te.c index df0b8b62d..5de936a6e 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -549,7 +549,8 @@ void isis_link_params_update(struct isis_circuit *circuit, if ((SUBTLV_TYPE(mtc->rmt_ipaddr) == 0) && (circuit->circ_type == CIRCUIT_T_P2P)) { struct isis_adjacency *adj = circuit->u.p2p.neighbor; - if (adj->ipv4_address_count) { + if (adj && adj->adj_state == ISIS_ADJ_UP + && adj->ipv4_address_count) { set_circuitparams_rmt_ipaddr( mtc, adj->ipv4_addresses[0]); } @@ -805,8 +806,7 @@ static u_char print_subtlv_mm_delay(struct sbuf *buf, int indent, A = (u_int32_t)ntohl(tlv->low) & TE_EXT_ANORMAL; high = (u_int32_t)ntohl(tlv->high) & TE_EXT_MASK; - sbuf_push(buf, indent, "%s Min/Max Link Delay: %" PRIu32 " / %" PRIu32 - " (micro-sec)\n", + sbuf_push(buf, indent, "%s Min/Max Link Delay: %" PRIu32 " / %" PRIu32 " (micro-sec)\n", A ? "Anomalous" : "Normal", low, high); return (SUBTLV_HDR_SIZE + SUBTLV_DEF_SIZE); @@ -913,8 +913,8 @@ static u_char print_unknown_tlv(struct sbuf *buf, int indent, } /* Main Show function */ -void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, - uint8_t subtlv_len) +void mpls_te_print_detail(struct sbuf *buf, int indent, + uint8_t *subtlvs, uint8_t subtlv_len) { struct subtlv_header *tlvh = (struct subtlv_header *)subtlvs; uint16_t sum = 0; @@ -922,8 +922,7 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, for (; sum < subtlv_len; tlvh = SUBTLV_HDR_NEXT(tlvh)) { switch (tlvh->type) { case TE_SUBTLV_ADMIN_GRP: - sum += print_subtlv_admin_grp( - buf, indent, + sum += print_subtlv_admin_grp(buf, indent, (struct te_subtlv_admin_grp *)tlvh); break; case TE_SUBTLV_LLRI: @@ -931,31 +930,27 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, (struct te_subtlv_llri *)tlvh); break; case TE_SUBTLV_LOCAL_IPADDR: - sum += print_subtlv_local_ipaddr( - buf, indent, + sum += print_subtlv_local_ipaddr(buf, indent, (struct te_subtlv_local_ipaddr *)tlvh); break; case TE_SUBTLV_RMT_IPADDR: - sum += print_subtlv_rmt_ipaddr( - buf, indent, + sum += print_subtlv_rmt_ipaddr(buf, indent, (struct te_subtlv_rmt_ipaddr *)tlvh); break; case TE_SUBTLV_MAX_BW: - sum += print_subtlv_max_bw( - buf, indent, (struct te_subtlv_max_bw *)tlvh); + sum += print_subtlv_max_bw(buf, indent, + (struct te_subtlv_max_bw *)tlvh); break; case TE_SUBTLV_MAX_RSV_BW: - sum += print_subtlv_max_rsv_bw( - buf, indent, + sum += print_subtlv_max_rsv_bw(buf, indent, (struct te_subtlv_max_rsv_bw *)tlvh); break; case TE_SUBTLV_UNRSV_BW: - sum += print_subtlv_unrsv_bw( - buf, indent, (struct te_subtlv_unrsv_bw *)tlvh); + sum += print_subtlv_unrsv_bw(buf, indent, + (struct te_subtlv_unrsv_bw *)tlvh); break; case TE_SUBTLV_TE_METRIC: - sum += print_subtlv_te_metric( - buf, indent, + sum += print_subtlv_te_metric(buf, indent, (struct te_subtlv_te_metric *)tlvh); break; case TE_SUBTLV_RAS: @@ -967,33 +962,32 @@ void mpls_te_print_detail(struct sbuf *buf, int indent, uint8_t *subtlvs, (struct te_subtlv_rip *)tlvh); break; case TE_SUBTLV_AV_DELAY: - sum += print_subtlv_av_delay( - buf, indent, (struct te_subtlv_av_delay *)tlvh); + sum += print_subtlv_av_delay(buf, indent, + (struct te_subtlv_av_delay *)tlvh); break; case TE_SUBTLV_MM_DELAY: - sum += print_subtlv_mm_delay( - buf, indent, (struct te_subtlv_mm_delay *)tlvh); + sum += print_subtlv_mm_delay(buf, indent, + (struct te_subtlv_mm_delay *)tlvh); break; case TE_SUBTLV_DELAY_VAR: - sum += print_subtlv_delay_var( - buf, indent, + sum += print_subtlv_delay_var(buf, indent, (struct te_subtlv_delay_var *)tlvh); break; case TE_SUBTLV_PKT_LOSS: - sum += print_subtlv_pkt_loss( - buf, indent, (struct te_subtlv_pkt_loss *)tlvh); + sum += print_subtlv_pkt_loss(buf, indent, + (struct te_subtlv_pkt_loss *)tlvh); break; case TE_SUBTLV_RES_BW: - sum += print_subtlv_res_bw( - buf, indent, (struct te_subtlv_res_bw *)tlvh); + sum += print_subtlv_res_bw(buf, indent, + (struct te_subtlv_res_bw *)tlvh); break; case TE_SUBTLV_AVA_BW: - sum += print_subtlv_ava_bw( - buf, indent, (struct te_subtlv_ava_bw *)tlvh); + sum += print_subtlv_ava_bw(buf, indent, + (struct te_subtlv_ava_bw *)tlvh); break; case TE_SUBTLV_USE_BW: - sum += print_subtlv_use_bw( - buf, indent, (struct te_subtlv_use_bw *)tlvh); + sum += print_subtlv_use_bw(buf, indent, + (struct te_subtlv_use_bw *)tlvh); break; default: sum += print_unknown_tlv(buf, indent, tlvh); diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 8e0fd74b7..66a19e150 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -161,11 +161,9 @@ static int unpack_subtlv_ipv6_source_prefix(enum isis_tlv_context context, sbuf_push(log, indent, "Unpacking IPv6 Source Prefix Sub-TLV...\n"); if (tlv_len < 1) { - sbuf_push( - log, indent, - "Not enough data left. (expected 1 or more bytes, got %" PRIu8 - ")\n", - tlv_len); + sbuf_push(log, indent, + "Not enough data left. (expected 1 or more bytes, got %" PRIu8 ")\n", + tlv_len); return 1; } @@ -625,11 +623,10 @@ static int unpack_item_extended_reach(uint16_t mtid, uint8_t len, (mtid == ISIS_MT_IPV4_UNICAST) ? "extended" : "mt"); if (len < 11) { - sbuf_push( - log, indent, - "Not enough data left. (expected 11 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 11 or more bytes, got %" + PRIu8 ")\n", + len); goto out; } @@ -977,7 +974,8 @@ static void format_item_mt_router_info(uint16_t mtid, struct isis_item *i, struct isis_mt_router_info *info = (struct isis_mt_router_info *)i; sbuf_push(buf, indent, "MT Router Info: %s%s%s\n", - isis_mtid2str(info->mtid), info->overload ? " Overload" : "", + isis_mtid2str(info->mtid), + info->overload ? " Overload" : "", info->attached ? " Attached" : ""); } @@ -1126,8 +1124,8 @@ static void format_item_extended_ip_reach(uint16_t mtid, struct isis_item *i, sbuf_push(buf, indent, "%s IP Reachability: %s (Metric: %u)%s", (mtid == ISIS_MT_IPV4_UNICAST) ? "Extended" : "MT", - prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), - r->metric, r->down ? " Down" : ""); + prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), r->metric, + r->down ? " Down" : ""); if (mtid != ISIS_MT_IPV4_UNICAST) sbuf_push(buf, 0, " %s", isis_mtid2str(mtid)); sbuf_push(buf, 0, "\n"); @@ -1180,11 +1178,9 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, consume = 5; if (len < consume) { - sbuf_push( - log, indent, - "Not enough data left. (expected 5 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 5 or more bytes, got %" PRIu8 ")\n", + len); goto out; } @@ -1203,10 +1199,9 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, consume += PSIZE(rv->prefix.prefixlen); if (len < consume) { - sbuf_push( - log, indent, - "Expected %u bytes of prefix, but only %u bytes available.\n", - PSIZE(rv->prefix.prefixlen), len - 5); + sbuf_push(log, indent, + "Expected %u bytes of prefix, but only %u bytes available.\n", + PSIZE(rv->prefix.prefixlen), len - 5); goto out; } stream_get(&rv->prefix.prefix.s_addr, s, PSIZE(rv->prefix.prefixlen)); @@ -1221,26 +1216,23 @@ static int unpack_item_extended_ip_reach(uint16_t mtid, uint8_t len, if (control & ISIS_EXTENDED_IP_REACH_SUBTLV) { consume += 1; if (len < consume) { - sbuf_push( - log, indent, - "Expected 1 byte of subtlv len, but no more data present.\n"); + sbuf_push(log, indent, + "Expected 1 byte of subtlv len, but no more data present.\n"); goto out; } subtlv_len = stream_getc(s); if (!subtlv_len) { - sbuf_push( - log, indent + 2, - " WARNING: subtlv bit is set, but there are no subtlvs.\n"); + sbuf_push(log, indent + 2, + " WARNING: subtlv bit is set, but there are no subtlvs.\n"); } consume += subtlv_len; if (len < consume) { - sbuf_push( - log, indent, - "Expected %" PRIu8 - " bytes of subtlvs, but only %u bytes available.\n", - subtlv_len, - len - 6 - PSIZE(rv->prefix.prefixlen)); + sbuf_push(log, indent, + "Expected %" PRIu8 + " bytes of subtlvs, but only %u bytes available.\n", + subtlv_len, + len - 6 - PSIZE(rv->prefix.prefixlen)); goto out; } sbuf_push(log, indent, "Skipping %" PRIu8 " bytes of subvls", @@ -1337,6 +1329,119 @@ static int unpack_tlv_dynamic_hostname(enum isis_tlv_context context, return 0; } +/* Functions related to TLV 240 P2P Three-Way Adjacency */ + +const char *isis_threeway_state_name(enum isis_threeway_state state) +{ + switch (state) { + case ISIS_THREEWAY_DOWN: + return "Down"; + case ISIS_THREEWAY_INITIALIZING: + return "Initializing"; + case ISIS_THREEWAY_UP: + return "Up"; + default: + return "Invalid!"; + } +} + +static struct isis_threeway_adj *copy_tlv_threeway_adj( + const struct isis_threeway_adj *threeway_adj) +{ + if (!threeway_adj) + return NULL; + + struct isis_threeway_adj *rv = XMALLOC(MTYPE_ISIS_TLV, sizeof(*rv)); + memcpy(rv, threeway_adj, sizeof(*rv)); + + return rv; +} + +static void format_tlv_threeway_adj(const struct isis_threeway_adj *threeway_adj, + struct sbuf *buf, int indent) +{ + if (!threeway_adj) + return; + + sbuf_push(buf, indent, "P2P Three-Way Adjacency:\n"); + sbuf_push(buf, indent, " State: %s (%d)\n", + isis_threeway_state_name(threeway_adj->state), + threeway_adj->state); + sbuf_push(buf, indent, " Extended Local Circuit ID: %" PRIu32 "\n", + threeway_adj->local_circuit_id); + if (!threeway_adj->neighbor_set) + return; + + sbuf_push(buf, indent, " Neighbor System ID: %s\n", + isis_format_id(threeway_adj->neighbor_id, 6)); + sbuf_push(buf, indent, " Neighbor Extended Circuit ID: %" PRIu32 "\n", + threeway_adj->neighbor_circuit_id); +} + +static void free_tlv_threeway_adj(struct isis_threeway_adj *threeway_adj) +{ + XFREE(MTYPE_ISIS_TLV, threeway_adj); +} + +static int pack_tlv_threeway_adj(const struct isis_threeway_adj *threeway_adj, + struct stream *s) +{ + if (!threeway_adj) + return 0; + + uint8_t tlv_len = (threeway_adj->neighbor_set) ? 15 : 5; + + if (STREAM_WRITEABLE(s) < (unsigned)(2 + tlv_len)) + return 1; + + stream_putc(s, ISIS_TLV_THREE_WAY_ADJ); + stream_putc(s, tlv_len); + stream_putc(s, threeway_adj->state); + stream_putl(s, threeway_adj->local_circuit_id); + + if (threeway_adj->neighbor_set) { + stream_put(s, threeway_adj->neighbor_id, 6); + stream_putl(s, threeway_adj->neighbor_circuit_id); + } + + return 0; +} + +static int unpack_tlv_threeway_adj(enum isis_tlv_context context, + uint8_t tlv_type, uint8_t tlv_len, + struct stream *s, struct sbuf *log, + void *dest, int indent) +{ + struct isis_tlvs *tlvs = dest; + + sbuf_push(log, indent, "Unpacking P2P Three-Way Adjacency TLV...\n"); + if (tlv_len != 5 && tlv_len != 15) { + sbuf_push(log, indent, "WARNING: Unexepected TLV size\n"); + stream_forward_getp(s, tlv_len); + return 0; + } + + if (tlvs->threeway_adj) { + sbuf_push(log, indent, + "WARNING: P2P Three-Way Adjacency TLV present multiple times.\n"); + stream_forward_getp(s, tlv_len); + return 0; + } + + tlvs->threeway_adj = XCALLOC(MTYPE_ISIS_TLV, sizeof(*tlvs->threeway_adj)); + + tlvs->threeway_adj->state = stream_getc(s); + tlvs->threeway_adj->local_circuit_id = stream_getl(s); + + if (tlv_len == 15) { + tlvs->threeway_adj->neighbor_set = true; + stream_get(tlvs->threeway_adj->neighbor_id, s, 6); + tlvs->threeway_adj->neighbor_circuit_id = stream_getl(s); + } + + return 0; +} + /* Functions related to TLVs 236/237 IPv6/MT-IPv6 reach */ static struct isis_item *copy_item_ipv6_reach(struct isis_item *i) @@ -1361,7 +1466,8 @@ static void format_item_ipv6_reach(uint16_t mtid, struct isis_item *i, sbuf_push(buf, indent, "%sIPv6 Reachability: %s (Metric: %u)%s%s", (mtid == ISIS_MT_IPV4_UNICAST) ? "" : "MT ", prefix2str(&r->prefix, prefixbuf, sizeof(prefixbuf)), - r->metric, r->down ? " Down" : "", + r->metric, + r->down ? " Down" : "", r->external ? " External" : ""); if (mtid != ISIS_MT_IPV4_UNICAST) sbuf_push(buf, 0, " %s", isis_mtid2str(mtid)); @@ -1426,11 +1532,10 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, (mtid == ISIS_MT_IPV4_UNICAST) ? "" : "mt "); consume = 6; if (len < consume) { - sbuf_push( - log, indent, - "Not enough data left. (expected 6 or more bytes, got %" PRIu8 - ")\n", - len); + sbuf_push(log, indent, + "Not enough data left. (expected 6 or more bytes, got %" + PRIu8 ")\n", + len); goto out; } @@ -1451,10 +1556,9 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, consume += PSIZE(rv->prefix.prefixlen); if (len < consume) { - sbuf_push( - log, indent, - "Expected %u bytes of prefix, but only %u bytes available.\n", - PSIZE(rv->prefix.prefixlen), len - 6); + sbuf_push(log, indent, + "Expected %u bytes of prefix, but only %u bytes available.\n", + PSIZE(rv->prefix.prefixlen), len - 6); goto out; } stream_get(&rv->prefix.prefix.s6_addr, s, PSIZE(rv->prefix.prefixlen)); @@ -1468,26 +1572,23 @@ static int unpack_item_ipv6_reach(uint16_t mtid, uint8_t len, struct stream *s, if (control & ISIS_IPV6_REACH_SUBTLV) { consume += 1; if (len < consume) { - sbuf_push( - log, indent, - "Expected 1 byte of subtlv len, but no more data persent.\n"); + sbuf_push(log, indent, + "Expected 1 byte of subtlv len, but no more data persent.\n"); goto out; } subtlv_len = stream_getc(s); if (!subtlv_len) { - sbuf_push( - log, indent + 2, - " WARNING: subtlv bit set, but there are no subtlvs.\n"); + sbuf_push(log, indent + 2, + " WARNING: subtlv bit set, but there are no subtlvs.\n"); } consume += subtlv_len; if (len < consume) { - sbuf_push( - log, indent, - "Expected %" PRIu8 - " bytes of subtlvs, but only %u bytes available.\n", - subtlv_len, - len - 6 - PSIZE(rv->prefix.prefixlen)); + sbuf_push(log, indent, + "Expected %" PRIu8 + " bytes of subtlvs, but only %u bytes available.\n", + subtlv_len, + len - 6 - PSIZE(rv->prefix.prefixlen)); goto out; } @@ -1710,19 +1811,16 @@ static int pack_item(enum isis_tlv_context context, enum isis_tlv_type type, return 1; } -static void add_item_to_fragment(struct isis_item *i, - struct pack_order_entry *pe, +static void add_item_to_fragment(struct isis_item *i, struct pack_order_entry *pe, struct isis_tlvs *fragment_tlvs, uint16_t mtid) { struct isis_item_list *l; if (pe->how_to_pack == ISIS_ITEMS) { - l = (struct isis_item_list *)(((char *)fragment_tlvs) - + pe->what_to_pack); + l = (struct isis_item_list *)(((char *)fragment_tlvs) + pe->what_to_pack); } else { struct isis_mt_item_list *m; - m = (struct isis_mt_item_list *)(((char *)fragment_tlvs) - + pe->what_to_pack); + m = (struct isis_mt_item_list *)(((char *)fragment_tlvs) + pe->what_to_pack); l = isis_get_mt_items(m, mtid); } @@ -2082,6 +2180,8 @@ struct isis_tlvs *isis_copy_tlvs(struct isis_tlvs *tlvs) copy_mt_items(ISIS_CONTEXT_LSP, ISIS_TLV_MT_IPV6_REACH, &tlvs->mt_ipv6_reach, &rv->mt_ipv6_reach); + rv->threeway_adj = copy_tlv_threeway_adj(tlvs->threeway_adj); + return rv; } @@ -2143,6 +2243,8 @@ static void format_tlvs(struct isis_tlvs *tlvs, struct sbuf *buf, int indent) format_mt_items(ISIS_CONTEXT_LSP, ISIS_TLV_MT_IPV6_REACH, &tlvs->mt_ipv6_reach, buf, indent); + + format_tlv_threeway_adj(tlvs->threeway_adj, buf, indent); } const char *isis_format_tlvs(struct isis_tlvs *tlvs) @@ -2193,6 +2295,7 @@ void isis_free_tlvs(struct isis_tlvs *tlvs) free_items(ISIS_CONTEXT_LSP, ISIS_TLV_IPV6_REACH, &tlvs->ipv6_reach); free_mt_items(ISIS_CONTEXT_LSP, ISIS_TLV_MT_IPV6_REACH, &tlvs->mt_ipv6_reach); + free_tlv_threeway_adj(tlvs->threeway_adj); XFREE(MTYPE_ISIS_TLV, tlvs); } @@ -2364,6 +2467,14 @@ static int pack_tlvs(struct isis_tlvs *tlvs, struct stream *stream, copy_tlv_te_router_id(tlvs->te_router_id); } + rv = pack_tlv_threeway_adj(tlvs->threeway_adj, stream); + if (rv) + return rv; + if (fragment_tlvs) { + fragment_tlvs->threeway_adj = + copy_tlv_threeway_adj(tlvs->threeway_adj); + } + for (size_t pack_idx = 0; pack_idx < array_size(pack_order); pack_idx++) { rv = handle_pack_entry(&pack_order[pack_idx], tlvs, stream, @@ -2459,11 +2570,9 @@ static int unpack_tlv(enum isis_tlv_context context, size_t avail_len, tlv_type, tlv_len); if (avail_len < ((size_t)tlv_len) + 2) { - sbuf_push( - log, indent + 2, - "Available data %zu too short for claimed TLV len %" PRIu8 - ".\n", - avail_len - 2, tlv_len); + sbuf_push(log, indent + 2, + "Available data %zu too short for claimed TLV len %" PRIu8 ".\n", + avail_len - 2, tlv_len); return 1; } @@ -2541,7 +2650,7 @@ int isis_unpack_tlvs(size_t avail_len, struct stream *stream, static const struct tlv_ops tlv_##_name_##_ops = { \ .name = _desc_, \ .unpack = unpack_tlv_with_items, \ - \ + \ .pack_item = pack_item_##_name_, \ .free_item = free_item_##_name_, \ .unpack_item = unpack_item_##_name_, \ @@ -2566,54 +2675,41 @@ TLV_OPS(te_router_id, "TLV 134 TE Router ID"); ITEM_TLV_OPS(extended_ip_reach, "TLV 135 Extended IP Reachability"); TLV_OPS(dynamic_hostname, "TLV 137 Dynamic Hostname"); ITEM_TLV_OPS(mt_router_info, "TLV 229 MT Router Information"); +TLV_OPS(threeway_adj, "TLV 240 P2P Three-Way Adjacency"); ITEM_TLV_OPS(ipv6_address, "TLV 232 IPv6 Interface Address"); ITEM_TLV_OPS(ipv6_reach, "TLV 236 IPv6 Reachability"); SUBTLV_OPS(ipv6_source_prefix, "Sub-TLV 22 IPv6 Source Prefix"); -static const struct tlv_ops *tlv_table[ISIS_CONTEXT_MAX][ISIS_TLV_MAX] = - {[ISIS_CONTEXT_LSP] = - { - [ISIS_TLV_AREA_ADDRESSES] = - &tlv_area_address_ops, - [ISIS_TLV_OLDSTYLE_REACH] = - &tlv_oldstyle_reach_ops, - [ISIS_TLV_LAN_NEIGHBORS] = - &tlv_lan_neighbor_ops, - [ISIS_TLV_LSP_ENTRY] = &tlv_lsp_entry_ops, - [ISIS_TLV_AUTH] = &tlv_auth_ops, - [ISIS_TLV_EXTENDED_REACH] = - &tlv_extended_reach_ops, - [ISIS_TLV_MT_REACH] = &tlv_extended_reach_ops, - [ISIS_TLV_OLDSTYLE_IP_REACH] = - &tlv_oldstyle_ip_reach_ops, - [ISIS_TLV_PROTOCOLS_SUPPORTED] = - &tlv_protocols_supported_ops, - [ISIS_TLV_OLDSTYLE_IP_REACH_EXT] = - &tlv_oldstyle_ip_reach_ops, - [ISIS_TLV_IPV4_ADDRESS] = - &tlv_ipv4_address_ops, - [ISIS_TLV_TE_ROUTER_ID] = - &tlv_te_router_id_ops, - [ISIS_TLV_EXTENDED_IP_REACH] = - &tlv_extended_ip_reach_ops, - [ISIS_TLV_MT_IP_REACH] = - &tlv_extended_ip_reach_ops, - [ISIS_TLV_DYNAMIC_HOSTNAME] = - &tlv_dynamic_hostname_ops, - [ISIS_TLV_MT_ROUTER_INFO] = - &tlv_mt_router_info_ops, - [ISIS_TLV_IPV6_ADDRESS] = - &tlv_ipv6_address_ops, - [ISIS_TLV_IPV6_REACH] = &tlv_ipv6_reach_ops, - [ISIS_TLV_MT_IPV6_REACH] = &tlv_ipv6_reach_ops, - }, - [ISIS_CONTEXT_SUBTLV_NE_REACH] = {}, - [ISIS_CONTEXT_SUBTLV_IP_REACH] = {}, - [ISIS_CONTEXT_SUBTLV_IPV6_REACH] = { - [ISIS_SUBTLV_IPV6_SOURCE_PREFIX] = - &subtlv_ipv6_source_prefix_ops, - }}; +static const struct tlv_ops *tlv_table[ISIS_CONTEXT_MAX][ISIS_TLV_MAX] = { + [ISIS_CONTEXT_LSP] = { + [ISIS_TLV_AREA_ADDRESSES] = &tlv_area_address_ops, + [ISIS_TLV_OLDSTYLE_REACH] = &tlv_oldstyle_reach_ops, + [ISIS_TLV_LAN_NEIGHBORS] = &tlv_lan_neighbor_ops, + [ISIS_TLV_LSP_ENTRY] = &tlv_lsp_entry_ops, + [ISIS_TLV_AUTH] = &tlv_auth_ops, + [ISIS_TLV_EXTENDED_REACH] = &tlv_extended_reach_ops, + [ISIS_TLV_MT_REACH] = &tlv_extended_reach_ops, + [ISIS_TLV_OLDSTYLE_IP_REACH] = &tlv_oldstyle_ip_reach_ops, + [ISIS_TLV_PROTOCOLS_SUPPORTED] = &tlv_protocols_supported_ops, + [ISIS_TLV_OLDSTYLE_IP_REACH_EXT] = &tlv_oldstyle_ip_reach_ops, + [ISIS_TLV_IPV4_ADDRESS] = &tlv_ipv4_address_ops, + [ISIS_TLV_TE_ROUTER_ID] = &tlv_te_router_id_ops, + [ISIS_TLV_EXTENDED_IP_REACH] = &tlv_extended_ip_reach_ops, + [ISIS_TLV_MT_IP_REACH] = &tlv_extended_ip_reach_ops, + [ISIS_TLV_DYNAMIC_HOSTNAME] = &tlv_dynamic_hostname_ops, + [ISIS_TLV_MT_ROUTER_INFO] = &tlv_mt_router_info_ops, + [ISIS_TLV_THREE_WAY_ADJ] = &tlv_threeway_adj_ops, + [ISIS_TLV_IPV6_ADDRESS] = &tlv_ipv6_address_ops, + [ISIS_TLV_IPV6_REACH] = &tlv_ipv6_reach_ops, + [ISIS_TLV_MT_IPV6_REACH] = &tlv_ipv6_reach_ops, + }, + [ISIS_CONTEXT_SUBTLV_NE_REACH] = {}, + [ISIS_CONTEXT_SUBTLV_IP_REACH] = {}, + [ISIS_CONTEXT_SUBTLV_IPV6_REACH] = { + [ISIS_SUBTLV_IPV6_SOURCE_PREFIX] = &subtlv_ipv6_source_prefix_ops, + } +}; /* Accessor functions */ @@ -3104,6 +3200,25 @@ void isis_tlvs_add_extended_reach(struct isis_tlvs *tlvs, uint16_t mtid, append_item(l, (struct isis_item *)r); } +void isis_tlvs_add_threeway_adj(struct isis_tlvs *tlvs, + enum isis_threeway_state state, + uint32_t local_circuit_id, + const uint8_t *neighbor_id, + uint32_t neighbor_circuit_id) +{ + assert(!tlvs->threeway_adj); + + tlvs->threeway_adj = XCALLOC(MTYPE_ISIS_TLV, sizeof(*tlvs->threeway_adj)); + tlvs->threeway_adj->state = state; + tlvs->threeway_adj->local_circuit_id = local_circuit_id; + + if (neighbor_id) { + tlvs->threeway_adj->neighbor_set = true; + memcpy(tlvs->threeway_adj->neighbor_id, neighbor_id, 6); + tlvs->threeway_adj->neighbor_circuit_id = neighbor_circuit_id; + } +} + struct isis_mt_router_info * isis_tlvs_lookup_mt_router_info(struct isis_tlvs *tlvs, uint16_t mtid) { diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 6ade0af28..98edbf14e 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -103,6 +103,20 @@ struct isis_protocols_supported { uint8_t *protocols; }; +enum isis_threeway_state { + ISIS_THREEWAY_DOWN = 2, + ISIS_THREEWAY_INITIALIZING = 1, + ISIS_THREEWAY_UP = 0 +}; + +struct isis_threeway_adj { + enum isis_threeway_state state; + uint32_t local_circuit_id; + bool neighbor_set; + uint8_t neighbor_id[6]; + uint32_t neighbor_circuit_id; +}; + struct isis_item; struct isis_item { struct isis_item *next; @@ -190,6 +204,7 @@ struct isis_tlvs { char *hostname; struct isis_item_list ipv6_reach; struct isis_mt_item_list mt_ipv6_reach; + struct isis_threeway_adj *threeway_adj; }; struct isis_subtlvs { @@ -227,6 +242,7 @@ enum isis_tlv_type { ISIS_TLV_MT_IP_REACH = 235, ISIS_TLV_IPV6_REACH = 236, ISIS_TLV_MT_IPV6_REACH = 237, + ISIS_TLV_THREE_WAY_ADJ = 240, ISIS_TLV_MAX = 256, ISIS_SUBTLV_IPV6_SOURCE_PREFIX = 22 @@ -303,6 +319,14 @@ void isis_tlvs_add_extended_reach(struct isis_tlvs *tlvs, uint16_t mtid, uint8_t *id, uint32_t metric, uint8_t *subtlvs, uint8_t subtlv_len); +const char *isis_threeway_state_name(enum isis_threeway_state state); + +void isis_tlvs_add_threeway_adj(struct isis_tlvs *tlvs, + enum isis_threeway_state state, + uint32_t local_circuit_id, + const uint8_t *neighbor_id, + uint32_t neighbor_circuit_id); + struct isis_mt_router_info * isis_tlvs_lookup_mt_router_info(struct isis_tlvs *tlvs, uint16_t mtid); #endif diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c index 02e28a73f..66d79b2e9 100644 --- a/isisd/isis_vty.c +++ b/isisd/isis_vty.c @@ -927,6 +927,21 @@ DEFUN (no_isis_hello_padding, return CMD_SUCCESS; } +DEFUN (isis_threeway_adj, + isis_threeway_adj_cmd, + "[no] isis three-way-handshake", + NO_STR + "IS-IS commands\n" + "Enable/Disable three-way handshake\n") +{ + struct isis_circuit *circuit = isis_circuit_lookup(vty); + if (!circuit) + return CMD_ERR_NO_MATCH; + + circuit->disable_threeway_adj = !strcmp(argv[0]->text, "no"); + return CMD_SUCCESS; +} + DEFUN (csnp_interval, csnp_interval_cmd, "isis csnp-interval (1-600)", @@ -2085,6 +2100,8 @@ void isis_vty_init(void) install_element(INTERFACE_NODE, &isis_hello_padding_cmd); install_element(INTERFACE_NODE, &no_isis_hello_padding_cmd); + install_element(INTERFACE_NODE, &isis_threeway_adj_cmd); + install_element(INTERFACE_NODE, &csnp_interval_cmd); install_element(INTERFACE_NODE, &no_csnp_interval_cmd); install_element(INTERFACE_NODE, &csnp_interval_l1_cmd); diff --git a/isisd/isisd.h b/isisd/isisd.h index a8dcc8ada..85d3974fa 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -52,9 +52,8 @@ struct isis { struct area_addr *man_area_addrs; /* manualAreaAddresses */ u_int32_t debugs; /* bitmap for debug */ time_t uptime; /* when did we start */ - struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */ - uint32_t circuit_ids_used - [8]; /* 256 bits to track circuit ids 0 through 255 */ + struct thread *t_dync_clean; /* dynamic hostname cache cleanup thread */ + uint32_t circuit_ids_used[8]; /* 256 bits to track circuit ids 1 through 255 */ struct route_table *ext_info[REDIST_PROTOCOL_COUNT]; diff --git a/ldpd/.gitignore b/ldpd/.gitignore index eee96c636..a2f4b5169 100644 --- a/ldpd/.gitignore +++ b/ldpd/.gitignore @@ -15,4 +15,3 @@ TAGS .arch-ids *~ *.loT -ldp_vty_cmds_clippy.c diff --git a/lib/.gitignore b/lib/.gitignore index 94f401ebe..072146dbd 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -24,4 +24,3 @@ refix grammar_sandbox clippy defun_lex.c -plist_clippy.c diff --git a/lib/debug.h b/lib/debug.h index 3e6772aac..d0fa27d3f 100644 --- a/lib/debug.h +++ b/lib/debug.h @@ -104,76 +104,77 @@ struct debug_callbacks { * * MT-Safe */ -#define DEBUG_MODE_CHECK(name, type) \ - CHECK_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_MODE_ALL) +#define DEBUG_MODE_CHECK(name, mode) \ + CHECK_FLAG_ATOMIC(&(name)->flags, (mode)&DEBUG_MODE_ALL) /* * Check if an option bit is set for a debug. * * MT-Safe */ -#define DEBUG_OPT_CHECK(name, type) \ - CHECK_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_OPT_ALL) +#define DEBUG_OPT_CHECK(name, opt) \ + CHECK_FLAG_ATOMIC(&(name)->flags, (opt)&DEBUG_OPT_ALL) /* * Check if bits are set for a debug. * * MT-Safe */ -#define DEBUG_FLAGS_CHECK(name, type) CHECK_FLAG_ATOMIC(&(name)->flags, (type)) - -/* - * Check if any mode is on for a debug. - * - * MT-Safe - */ -#define DEBUG(name) DEBUG_MODE_CHECK((name), DEBUG_MODE_ALL) +#define DEBUG_FLAGS_CHECK(name, fl) CHECK_FLAG_ATOMIC(&(name)->flags, (fl)) /* * Set modes on a debug. * * MT-Safe */ -#define DEBUG_MODE_SET(name, type) \ - SET_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_MODE_ALL) +#define DEBUG_MODE_SET(name, mode, onoff) \ + do { \ + if (onoff) \ + SET_FLAG_ATOMIC(&(name)->flags, \ + (mode)&DEBUG_MODE_ALL); \ + else \ + UNSET_FLAG_ATOMIC(&(name)->flags, \ + (mode)&DEBUG_MODE_ALL); \ + } while (0) -/* - * Unset modes on a debug. - * - * MT-Safe - */ -#define DEBUG_MODE_UNSET(name, type) \ - UNSET_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_MODE_ALL) +/* Convenience macros for specific set operations. */ +#define DEBUG_MODE_ON(name, mode) DEBUG_MODE_SET(name, mode, true) +#define DEBUG_MODE_OFF(name, mode) DEBUG_MODE_SET(name, mode, false) /* * Set options on a debug. * * MT-Safe */ -#define DEBUG_OPT_SET(name, type) \ - SET_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_OPT_ALL) +#define DEBUG_OPT_SET(name, opt, onoff) \ + do { \ + if (onoff) \ + SET_FLAG_ATOMIC(&(name)->flags, (opt)&DEBUG_OPT_ALL); \ + else \ + UNSET_FLAG_ATOMIC(&(name)->flags, \ + (opt)&DEBUG_OPT_ALL); \ + } while (0) -/* - * Unset options on a debug. - * - * MT-Safe - */ -#define DEBUG_OPT_UNSET(name, type) \ - UNSET_FLAG_ATOMIC(&(name)->flags, (type)&DEBUG_OPT_ALL) +/* Convenience macros for specific set operations. */ +#define DEBUG_OPT_ON(name, opt) DEBUG_OPT_SET(name, opt, true) +#define DEBUG_OPT_OFF(name, opt) DEBUG_OPT_SET(name, opt, true) /* * Set bits on a debug. * * MT-Safe */ -#define DEBUG_FLAGS_SET(name, type) SET_FLAG_ATOMIC(&(name)->flags, (type)) +#define DEBUG_FLAGS_SET(name, fl, onoff) \ + do { \ + if (onoff) \ + SET_FLAG_ATOMIC(&(name)->flags, (fl)); \ + else \ + UNSET_FLAG_ATOMIC(&(name)->flags, (fl)); \ + } while (0) -/* - * Unset bits on a debug. - * - * MT-Safe - */ -#define DEBUG_FLAGS_UNSET(name, type) UNSET_FLAG_ATOMIC(&(name)->flags, (type)) +/* Convenience macros for specific set operations. */ +#define DEBUG_FLAGS_ON(name, fl) DEBUG_FLAGS_SET(&(name)->flags, (type), true) +#define DEBUG_FLAGS_OFF(name, fl) DEBUG_FLAGS_SET(&(name)->flags, (type), false) /* * Unset all modes and options on a debug. @@ -201,6 +202,23 @@ struct debug_callbacks { #define DEBUG_NODE2MODE(vtynode) \ (((vtynode) == CONFIG_NODE) ? DEBUG_MODE_ALL : DEBUG_MODE_TERM) +/* + * Debug at the given level to the default logging destination. + * + * MT-Safe + */ +#define DEBUG(level, name, fmt, ...) \ + do { \ + if (DEBUG_MODE_CHECK(name, DEBUG_MODE_ALL)) \ + zlog_##level(fmt, ##__VA_ARGS__); \ + } while (0) + +/* Convenience macros for the various levels. */ +#define DEBUGE(name, fmt, ...) DEBUG(err, name, fmt, ##__VA_ARGS__) +#define DEBUGW(name, fmt, ...) DEBUG(warn, name, fmt, ##__VA_ARGS__) +#define DEBUGI(name, fmt, ...) DEBUG(info, name, fmt, ##__VA_ARGS__) +#define DEBUGN(name, fmt, ...) DEBUG(notice, name, fmt, ##__VA_ARGS__) +#define DEBUGD(name, fmt, ...) DEBUG(debug, name, fmt, ##__VA_ARGS__) /* * Optional initializer for debugging. Highly recommended. diff --git a/lib/frr_pthread.c b/lib/frr_pthread.c index 72b47ae5c..36a89168c 100644 --- a/lib/frr_pthread.c +++ b/lib/frr_pthread.c @@ -1,6 +1,6 @@ /* * Utilities and interfaces for managing POSIX threads within FRR. - * Copyright (C) 2017 Cumulus Networks + * Copyright (C) 2017 Cumulus Networks, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ DEFINE_MTYPE(LIB, FRR_PTHREAD, "FRR POSIX Thread"); DEFINE_MTYPE(LIB, PTHREAD_PRIM, "POSIX synchronization primitives"); /* id for next created pthread */ -static unsigned int next_id = 0; +static _Atomic uint32_t next_id = 0; /* default frr_pthread start/stop routine prototypes */ static void *fpt_run(void *arg); @@ -40,7 +40,6 @@ struct frr_pthread_attr frr_pthread_attr_default = { .id = 0, .start = fpt_run, .stop = fpt_halt, - .name = "Anonymous", }; /* hash table to keep track of all frr_pthreads */ @@ -85,9 +84,10 @@ void frr_pthread_finish() pthread_mutex_unlock(&frr_pthread_hash_mtx); } -struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr) +struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr, + const char *name) { - static struct frr_pthread holder = {0}; + static struct frr_pthread holder = {}; struct frr_pthread *fpt = NULL; attr = attr ? attr : &frr_pthread_attr_default; @@ -99,10 +99,14 @@ struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr) if (!hash_lookup(frr_pthread_hash, &holder)) { fpt = XCALLOC(MTYPE_FRR_PTHREAD, sizeof(struct frr_pthread)); + /* initialize mutex */ + pthread_mutex_init(&fpt->mtx, NULL); /* create new thread master */ - fpt->master = thread_master_create(attr->name); + fpt->master = thread_master_create(name); /* set attributes */ fpt->attr = *attr; + name = (name ? name : "Anonymous thread"); + fpt->name = XSTRDUP(MTYPE_FRR_PTHREAD, name); if (attr == &frr_pthread_attr_default) fpt->attr.id = frr_pthread_get_id(); /* initialize startup synchronization primitives */ @@ -126,16 +130,31 @@ void frr_pthread_destroy(struct frr_pthread *fpt) { thread_master_free(fpt->master); + pthread_mutex_destroy(&fpt->mtx); pthread_mutex_destroy(fpt->running_cond_mtx); pthread_cond_destroy(fpt->running_cond); + if (fpt->name) + XFREE(MTYPE_FRR_PTHREAD, fpt->name); XFREE(MTYPE_PTHREAD_PRIM, fpt->running_cond_mtx); XFREE(MTYPE_PTHREAD_PRIM, fpt->running_cond); XFREE(MTYPE_FRR_PTHREAD, fpt); } -struct frr_pthread *frr_pthread_get(unsigned int id) +void frr_pthread_set_name(struct frr_pthread *fpt, const char *name) { - static struct frr_pthread holder = {0}; + pthread_mutex_lock(&fpt->mtx); + { + if (fpt->name) + XFREE(MTYPE_FRR_PTHREAD, fpt->name); + fpt->name = XSTRDUP(MTYPE_FRR_PTHREAD, name); + } + pthread_mutex_unlock(&fpt->mtx); + thread_master_set_name(fpt->master, name); +} + +struct frr_pthread *frr_pthread_get(uint32_t id) +{ + static struct frr_pthread holder = {}; struct frr_pthread *fpt; pthread_mutex_lock(&frr_pthread_hash_mtx); @@ -210,11 +229,13 @@ void frr_pthread_stop_all() pthread_mutex_unlock(&frr_pthread_hash_mtx); } -unsigned int frr_pthread_get_id() +uint32_t frr_pthread_get_id(void) { + _Atomic uint32_t nxid; + nxid = atomic_fetch_add_explicit(&next_id, 1, memory_order_seq_cst); /* just a sanity check, this should never happen */ - assert(next_id <= INT_MAX - 1); - return next_id++; + assert(nxid <= (UINT32_MAX - 1)); + return nxid; } void frr_pthread_yield(void) @@ -238,6 +259,7 @@ static int fpt_dummy(struct thread *thread) static int fpt_finish(struct thread *thread) { struct frr_pthread *fpt = THREAD_ARG(thread); + atomic_store_explicit(&fpt->running, false, memory_order_relaxed); return 0; } diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index 2cc50196a..91002dd8e 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -1,6 +1,6 @@ /* * Utilities and interfaces for managing POSIX threads within FRR. - * Copyright (C) 2017 Cumulus Networks + * Copyright (C) 2017 Cumulus Networks, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,14 +32,19 @@ struct frr_pthread; struct frr_pthread_attr; struct frr_pthread_attr { - int id; + _Atomic uint32_t id; void *(*start)(void *); int (*stop)(struct frr_pthread *, void **); - const char *name; }; struct frr_pthread { + /* + * Mutex protecting this structure. Must be taken for reading some + * fields, denoted by a 'Requires: mtx'. + */ + pthread_mutex_t mtx; + /* pthread id */ pthread_t thread; @@ -73,8 +78,17 @@ struct frr_pthread { * Fake thread-specific storage. No constraints on usage. Helpful when * creating reentrant pthread implementations. Can be used to pass * argument to pthread entry function. + * + * Requires: mtx */ void *data; + + /* + * Human-readable thread name. + * + * Requires: mtx + */ + char *name; }; extern struct frr_pthread_attr frr_pthread_attr_default; @@ -107,9 +121,19 @@ void frr_pthread_finish(void); * frr_pthread will cause them to run on that pthread. * * @param attr - the thread attributes + * @param name - Human-readable name * @return the created frr_pthread upon success, or NULL upon failure */ -struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr); +struct frr_pthread *frr_pthread_new(struct frr_pthread_attr *attr, + const char *name); + +/* + * Changes the name of the frr_pthread. + * + * @param fpt - the frr_pthread to operate on + * @param name - Human-readable name + */ +void frr_pthread_set_name(struct frr_pthread *fpt, const char *name); /* * Destroys an frr_pthread. @@ -125,7 +149,7 @@ void frr_pthread_destroy(struct frr_pthread *fpt); * * @return frr_thread associated with the provided id, or NULL on error */ -struct frr_pthread *frr_pthread_get(unsigned int id); +struct frr_pthread *frr_pthread_get(uint32_t id); /* * Creates a new pthread and binds it to a frr_pthread. @@ -198,6 +222,6 @@ void frr_pthread_yield(void); * * @return unique identifier */ -unsigned int frr_pthread_get_id(void); +uint32_t frr_pthread_get_id(void); #endif /* _FRR_PTHREAD_H */ diff --git a/lib/ipaddr.h b/lib/ipaddr.h index 98c28008d..44bde45ad 100644 --- a/lib/ipaddr.h +++ b/lib/ipaddr.h @@ -85,4 +85,21 @@ static inline char *ipaddr2str(struct ipaddr *ip, char *buf, int size) } return buf; } + +/* + * Convert IPv4 address to IPv4-mapped IPv6 address which is of the + * form ::FFFF:<IPv4 address> (RFC 4291). This IPv6 address can then + * be used to represent the IPv4 address, wherever only an IPv6 address + * is required. + */ +static inline void ipv4_to_ipv4_mapped_ipv6(struct in6_addr *in6, + struct in_addr in) +{ + u_int32_t addr_type = htonl(0xFFFF); + + memset(in6, 0, sizeof(struct in6_addr)); + memcpy((char *)in6 + 8, &addr_type, sizeof(addr_type)); + memcpy((char *)in6 + 12, &in, sizeof(struct in_addr)); +} + #endif /* __IPADDR_H__ */ @@ -1096,41 +1096,52 @@ void zlog_hexdump(const void *mem, unsigned int len) unsigned long i = 0; unsigned int j = 0; unsigned int columns = 8; - char buf[(len * 4) + ((len / 4) * 20) + 30]; + /* + * 19 bytes for 0xADDRESS: + * 24 bytes for data; 2 chars plus a space per data byte + * 1 byte for space + * 8 bytes for ASCII representation + * 1 byte for a newline + * ===================== + * 53 bytes per 8 bytes of data + * 1 byte for null term + */ + size_t bs = ((len / 8) + 1) * 53 + 1; + char buf[bs]; char *s = buf; + memset(buf, 0, sizeof(buf)); + for (i = 0; i < len + ((len % columns) ? (columns - len % columns) : 0); i++) { /* print offset */ if (i % columns == 0) - s += sprintf(s, "0x%016lx: ", (unsigned long)mem + i); + s += snprintf(s, bs - (s - buf), + "0x%016lx: ", (unsigned long)mem + i); /* print hex data */ if (i < len) - s += sprintf(s, "%02x ", 0xFF & ((const char *)mem)[i]); + s += snprintf(s, bs - (s - buf), "%02x ", + 0xFF & ((const char *)mem)[i]); /* end of block, just aligning for ASCII dump */ else - s += sprintf(s, " "); + s += snprintf(s, bs - (s - buf), " "); /* print ASCII dump */ if (i % columns == (columns - 1)) { for (j = i - (columns - 1); j <= i; j++) { - if (j >= len) /* end of block, not really - printing */ - s += sprintf(s, " "); - - else if (isprint((int)((const char *)mem) - [j])) /* printable char - */ - s += sprintf( - s, "%c", + /* end of block not really printing */ + if (j >= len) + s += snprintf(s, bs - (s - buf), " "); + else if (isprint((int)((const char *)mem)[j])) + s += snprintf( + s, bs - (s - buf), "%c", 0xFF & ((const char *)mem)[j]); - else /* other char */ - s += sprintf(s, "."); + s += snprintf(s, bs - (s - buf), "."); } - s += sprintf(s, "\n"); + s += snprintf(s, bs - (s - buf), "\n"); } } zlog_debug("\n%s", buf); diff --git a/lib/nexthop.c b/lib/nexthop.c index cee34e85c..fb7ccc169 100644 --- a/lib/nexthop.c +++ b/lib/nexthop.c @@ -163,6 +163,57 @@ void nexthops_free(struct nexthop *nexthop) } } +bool nexthop_same(const struct nexthop *nh1, const struct nexthop *nh2) +{ + if (nh1 && !nh2) + return false; + + if (!nh1 && nh2) + return false; + + if (nh1 == nh2) + return true; + + if (nh1->vrf_id != nh2->vrf_id) + return false; + + if (nh1->type != nh2->type) + return false; + + switch (nh1->type) { + case NEXTHOP_TYPE_IFINDEX: + if (nh1->ifindex != nh2->ifindex) + return false; + break; + case NEXTHOP_TYPE_IPV4: + if (nh1->gate.ipv4.s_addr != nh2->gate.ipv4.s_addr) + return false; + break; + case NEXTHOP_TYPE_IPV4_IFINDEX: + if (nh1->gate.ipv4.s_addr != nh2->gate.ipv4.s_addr) + return false; + if (nh1->ifindex != nh2->ifindex) + return false; + break; + case NEXTHOP_TYPE_IPV6: + if (memcmp(&nh1->gate.ipv6, &nh2->gate.ipv6, 16)) + return false; + break; + case NEXTHOP_TYPE_IPV6_IFINDEX: + if (memcmp(&nh1->gate.ipv6, &nh2->gate.ipv6, 16)) + return false; + if (nh1->ifindex != nh2->ifindex) + return false; + break; + case NEXTHOP_TYPE_BLACKHOLE: + if (nh1->bh_type != nh2->bh_type) + return false; + break; + } + + return true; +} + /* Update nexthop with label information. */ void nexthop_add_labels(struct nexthop *nexthop, enum lsp_types_t type, u_int8_t num_labels, mpls_label_t *label) diff --git a/lib/nexthop.h b/lib/nexthop.h index 0ca8a0063..568243d3a 100644 --- a/lib/nexthop.h +++ b/lib/nexthop.h @@ -118,6 +118,8 @@ void nexthop_add_labels(struct nexthop *, enum lsp_types_t, u_int8_t, mpls_label_t *); void nexthop_del_labels(struct nexthop *); +extern bool nexthop_same(const struct nexthop *nh1, const struct nexthop *nh2); + extern const char *nexthop_type_to_str(enum nexthop_types_t nh_type); extern int nexthop_same_no_recurse(const struct nexthop *next1, const struct nexthop *next2); diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index e7f10487d..e48624724 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -19,6 +19,7 @@ */ #include <zebra.h> +#include <vrf.h> #include <nexthop.h> #include <nexthop_group.h> #include <vty.h> @@ -28,6 +29,56 @@ #include "lib/nexthop_group_clippy.c" #endif +DEFINE_MTYPE_STATIC(LIB, NEXTHOP_GROUP, "Nexthop Group") + +struct nexthop_group_hooks { + void (*new)(const char *name); + void (*add_nexthop)(const struct nexthop_group_cmd *nhg, + const struct nexthop *nhop); + void (*del_nexthop)(const struct nexthop_group_cmd *nhg, + const struct nexthop *nhop); + void (*delete)(const char *name); +}; + +static struct nexthop_group_hooks nhg_hooks; + +static inline int +nexthop_group_cmd_compare(const struct nexthop_group_cmd *nhgc1, + const struct nexthop_group_cmd *nhgc2); +RB_GENERATE(nhgc_entry_head, nexthop_group_cmd, nhgc_entry, + nexthop_group_cmd_compare) + +struct nhgc_entry_head nhgc_entries; + +static inline int +nexthop_group_cmd_compare(const struct nexthop_group_cmd *nhgc1, + const struct nexthop_group_cmd *nhgc2) +{ + return strcmp(nhgc1->name, nhgc2->name); +} + +struct nexthop *nexthop_exists(struct nexthop_group *nhg, struct nexthop *nh) +{ + struct nexthop *nexthop; + + for (nexthop = nhg->nexthop; nexthop; nexthop = nexthop->next) { + if (nexthop_same(nh, nexthop)) + return nexthop; + } + + return NULL; +} + +struct nexthop_group *nexthop_group_new(void) +{ + return XCALLOC(MTYPE_NEXTHOP_GROUP, sizeof(struct nexthop_group)); +} + +void nexthop_group_delete(struct nexthop_group **nhg) +{ + XFREE(MTYPE_NEXTHOP_GROUP, *nhg); +} + /* Add nexthop to the end of a nexthop list. */ void nexthop_add(struct nexthop **target, struct nexthop *nexthop) { @@ -42,6 +93,27 @@ void nexthop_add(struct nexthop **target, struct nexthop *nexthop) nexthop->prev = last; } +/* Delete nexthop from a nexthop list. */ +void nexthop_del(struct nexthop_group *nhg, struct nexthop *nh) +{ + struct nexthop *nexthop; + + for (nexthop = nhg->nexthop; nexthop; nexthop = nexthop->next) { + if (nexthop_same(nh, nexthop)) + break; + } + + assert(nexthop); + + if (nexthop->prev) + nexthop->prev->next = nexthop->next; + else + nhg->nexthop = nexthop->next; + + if (nexthop->next) + nexthop->next->prev = nexthop->prev; +} + void copy_nexthops(struct nexthop **tnh, struct nexthop *nh, struct nexthop *rparent) { @@ -71,12 +143,169 @@ void copy_nexthops(struct nexthop **tnh, struct nexthop *nh, } } -DEFPY (nexthop_group, - nexthop_group_cmd, - "nexthop-group NAME", - "Enter into the nexthop-group submode\n" - "Specify the NAME of the nexthop-group\n") +static void nhgc_delete_nexthops(struct nexthop_group_cmd *nhgc) +{ + struct nexthop *nexthop; + + nexthop = nhgc->nhg.nexthop; + while (nexthop) { + struct nexthop *next = nexthop_next(nexthop); + + if (nhg_hooks.del_nexthop) + nhg_hooks.del_nexthop(nhgc, nexthop); + + nexthop_free(nexthop); + + nexthop = next; + } +} + +struct nexthop_group_cmd *nhgc_find(const char *name) +{ + struct nexthop_group_cmd find; + + strlcpy(find.name, name, sizeof(find.name)); + + return RB_FIND(nhgc_entry_head, &nhgc_entries, &find); +} + +static struct nexthop_group_cmd *nhgc_get(const char *name) { + struct nexthop_group_cmd *nhgc; + + nhgc = nhgc_find(name); + if (!nhgc) { + nhgc = XCALLOC(MTYPE_TMP, sizeof(*nhgc)); + strlcpy(nhgc->name, name, sizeof(nhgc->name)); + + QOBJ_REG(nhgc, nexthop_group_cmd); + RB_INSERT(nhgc_entry_head, &nhgc_entries, nhgc); + + if (nhg_hooks.new) + nhg_hooks.new(name); + } + + return nhgc; +} + +static void nhgc_delete(struct nexthop_group_cmd *nhgc) +{ + nhgc_delete_nexthops(nhgc); + + if (nhg_hooks.delete) + nhg_hooks.delete(nhgc->name); + + RB_REMOVE(nhgc_entry_head, &nhgc_entries, nhgc); +} + +DEFINE_QOBJ_TYPE(nexthop_group_cmd) + +DEFUN_NOSH(nexthop_group, nexthop_group_cmd, "nexthop-group NAME", + "Enter into the nexthop-group submode\n" + "Specify the NAME of the nexthop-group\n") +{ + const char *nhg_name = argv[1]->arg; + struct nexthop_group_cmd *nhgc = NULL; + + nhgc = nhgc_get(nhg_name); + VTY_PUSH_CONTEXT(NH_GROUP_NODE, nhgc); + + return CMD_SUCCESS; +} + +DEFUN_NOSH(no_nexthop_group, no_nexthop_group_cmd, "no nexthop-group NAME", + NO_STR + "Delete the nexthop-group\n" + "Specify the NAME of the nexthop-group\n") +{ + const char *nhg_name = argv[2]->arg; + struct nexthop_group_cmd *nhgc = NULL; + + nhgc = nhgc_find(nhg_name); + if (nhgc) + nhgc_delete(nhgc); + + return CMD_SUCCESS; +} + +DEFPY(ecmp_nexthops, ecmp_nexthops_cmd, + "[no] nexthop <A.B.C.D|X:X::X:X>$addr [INTERFACE]$intf [nexthop-vrf NAME$name]", + NO_STR + "Specify one of the nexthops in this ECMP group\n" + "v4 Address\n" + "v6 Address\n" + "Interface to use\n" + "If the nexthop is in a different vrf tell us\n" + "The nexthop-vrf Name\n") +{ + VTY_DECLVAR_CONTEXT(nexthop_group_cmd, nhgc); + struct vrf *vrf; + struct nexthop nhop; + struct nexthop *nh; + + if (name) + vrf = vrf_lookup_by_name(name); + else + vrf = vrf_lookup_by_id(VRF_DEFAULT); + + if (!vrf) { + vty_out(vty, "Specified: %s is non-existent\n", name); + return CMD_WARNING; + } + + memset(&nhop, 0, sizeof(nhop)); + nhop.vrf_id = vrf->vrf_id; + + if (addr->sa.sa_family == AF_INET) { + nhop.gate.ipv4.s_addr = addr->sin.sin_addr.s_addr; + if (intf) { + nhop.type = NEXTHOP_TYPE_IPV4_IFINDEX; + nhop.ifindex = ifname2ifindex(intf, vrf->vrf_id); + if (nhop.ifindex == IFINDEX_INTERNAL) { + vty_out(vty, + "Specified Intf %s does not exist in vrf: %s\n", + intf, vrf->name); + return CMD_WARNING; + } + } else + nhop.type = NEXTHOP_TYPE_IPV4; + } else { + memcpy(&nhop.gate.ipv6, &addr->sin6.sin6_addr, 16); + if (intf) { + nhop.type = NEXTHOP_TYPE_IPV6_IFINDEX; + nhop.ifindex = ifname2ifindex(intf, vrf->vrf_id); + if (nhop.ifindex == IFINDEX_INTERNAL) { + vty_out(vty, + "Specified Intf %s does not exist in vrf: %s\n", + intf, vrf->name); + return CMD_WARNING; + } + } else + nhop.type = NEXTHOP_TYPE_IPV6; + } + + nh = nexthop_exists(&nhgc->nhg, &nhop); + + if (no) { + if (nh) { + nexthop_del(&nhgc->nhg, nh); + + if (nhg_hooks.del_nexthop) + nhg_hooks.del_nexthop(nhgc, nh); + + nexthop_free(nh); + } + } else if (!nh) { + /* must be adding new nexthop since !no and !nexthop_exists */ + nh = nexthop_new(); + + memcpy(nh, &nhop, sizeof(nhop)); + nexthop_add(&nhgc->nhg.nexthop, nh); + + if (nhg_hooks.add_nexthop) + nhg_hooks.add_nexthop(nhgc, nh); + } + return CMD_SUCCESS; } @@ -86,15 +315,85 @@ struct cmd_node nexthop_group_node = { 1 }; +void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh) +{ + char buf[100]; + struct vrf *vrf; + + vty_out(vty, " nexthop "); + + switch (nh->type) { + case NEXTHOP_TYPE_IFINDEX: + vty_out(vty, "%s", ifindex2ifname(nh->ifindex, nh->vrf_id)); + break; + case NEXTHOP_TYPE_IPV4: + vty_out(vty, "%s", inet_ntoa(nh->gate.ipv4)); + break; + case NEXTHOP_TYPE_IPV4_IFINDEX: + vty_out(vty, "%s %s", inet_ntoa(nh->gate.ipv4), + ifindex2ifname(nh->ifindex, nh->vrf_id)); + break; + case NEXTHOP_TYPE_IPV6: + vty_out(vty, "%s", + inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf))); + break; + case NEXTHOP_TYPE_IPV6_IFINDEX: + vty_out(vty, "%s %s", + inet_ntop(AF_INET6, &nh->gate.ipv6, buf, sizeof(buf)), + ifindex2ifname(nh->ifindex, nh->vrf_id)); + break; + case NEXTHOP_TYPE_BLACKHOLE: + break; + } + + if (nh->vrf_id != VRF_DEFAULT) { + vrf = vrf_lookup_by_id(nh->vrf_id); + vty_out(vty, " nexthop-vrf %s", vrf->name); + } + vty_out(vty, "\n"); +} + static int nexthop_group_write(struct vty *vty) { - vty_out(vty, "!\n"); + struct nexthop_group_cmd *nhgc; + struct nexthop *nh; + + RB_FOREACH (nhgc, nhgc_entry_head, &nhgc_entries) { + vty_out(vty, "nexthop-group %s\n", nhgc->name); + + for (nh = nhgc->nhg.nexthop; nh; nh = nh->next) + nexthop_group_write_nexthop(vty, nh); + + vty_out(vty, "!\n"); + } return 1; } -void nexthop_group_init(void) +void nexthop_group_init(void (*new)(const char *name), + void (*add_nexthop)(const struct nexthop_group_cmd *nhg, + const struct nexthop *nhop), + void (*del_nexthop)(const struct nexthop_group_cmd *nhg, + const struct nexthop *nhop), + void (*delete)(const char *name)) { + RB_INIT(nhgc_entry_head, &nhgc_entries); + install_node(&nexthop_group_node, nexthop_group_write); install_element(CONFIG_NODE, &nexthop_group_cmd); + install_element(CONFIG_NODE, &no_nexthop_group_cmd); + + install_default(NH_GROUP_NODE); + install_element(NH_GROUP_NODE, &ecmp_nexthops_cmd); + + memset(&nhg_hooks, 0, sizeof(nhg_hooks)); + + if (new) + nhg_hooks.new = new; + if (add_nexthop) + nhg_hooks.add_nexthop = add_nexthop; + if (del_nexthop) + nhg_hooks.del_nexthop = del_nexthop; + if (delete) + nhg_hooks.delete = delete; } diff --git a/lib/nexthop_group.h b/lib/nexthop_group.h index 561fe9642..c2e4c4d75 100644 --- a/lib/nexthop_group.h +++ b/lib/nexthop_group.h @@ -21,6 +21,8 @@ #ifndef __NEXTHOP_GROUP__ #define __NEXTHOP_GROUP__ +#include <vty.h> + /* * What is a nexthop group? * @@ -33,9 +35,11 @@ struct nexthop_group { struct nexthop *nexthop; }; -void nexthop_group_init(void); +struct nexthop_group *nexthop_group_new(void); +void nexthop_group_delete(struct nexthop_group **nhg); void nexthop_add(struct nexthop **target, struct nexthop *nexthop); +void nexthop_del(struct nexthop_group *nhg, struct nexthop *nexthop); void copy_nexthops(struct nexthop **tnh, struct nexthop *nh, struct nexthop *rparent); @@ -51,4 +55,40 @@ void copy_nexthops(struct nexthop **tnh, struct nexthop *nh, (nhop) = (head.nexthop); \ (nhop); \ (nhop) = nexthop_next(nhop) + +struct nexthop_group_cmd { + + RB_ENTRY(nexthop_group_cmd) nhgc_entry; + + char name[80]; + + struct nexthop_group nhg; + + QOBJ_FIELDS +}; +RB_HEAD(nhgc_entry_head, nexthp_group_cmd); +RB_PROTOTYPE(nhgc_entry_head, nexthop_group_cmd, nhgc_entry, + nexthop_group_cmd_compare) +DECLARE_QOBJ_TYPE(nexthop_group_cmd) + +/* + * Initialize nexthop_groups. If you are interested in when + * a nexthop_group is added/deleted/modified, then set the + * appropriate callback functions to handle it in your + * code + */ +void nexthop_group_init( + void (*new)(const char *name), + void (*add_nexthop)(const struct nexthop_group_cmd *nhgc, + const struct nexthop *nhop), + void (*del_nexthop)(const struct nexthop_group_cmd *nhgc, + const struct nexthop *nhop), + void (*delete)(const char *name)); + +extern struct nexthop *nexthop_exists(struct nexthop_group *nhg, + struct nexthop *nh); + +extern struct nexthop_group_cmd *nhgc_find(const char *name); + +extern void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh); #endif diff --git a/lib/strlcat.c b/lib/strlcat.c index 818630443..be211f82a 100644 --- a/lib/strlcat.c +++ b/lib/strlcat.c @@ -28,23 +28,25 @@ #ifndef HAVE_STRLCAT #undef strlcat -size_t strlcat(char *__restrict dest, const char *__restrict src, size_t size); +size_t strlcat(char *__restrict dest, + const char *__restrict src, size_t destsize); -size_t strlcat(char *__restrict dest, const char *__restrict src, size_t size) +size_t strlcat(char *__restrict dest, + const char *__restrict src, size_t destsize) { size_t src_length = strlen(src); /* Our implementation strlcat supports dest == NULL if size == 0 (for consistency with snprintf and strlcpy), but strnlen does not, so we have to cover this case explicitly. */ - if (size == 0) + if (destsize == 0) return src_length; - size_t dest_length = strnlen(dest, size); - if (dest_length != size) { + size_t dest_length = strnlen(dest, destsize); + if (dest_length != destsize) { /* Copy at most the remaining number of characters in the destination buffer. Leave for the NUL terminator. */ - size_t to_copy = size - dest_length - 1; + size_t to_copy = destsize - dest_length - 1; /* But not more than what is available in the source string. */ if (to_copy > src_length) to_copy = src_length; diff --git a/lib/strlcpy.c b/lib/strlcpy.c index b7681754a..b0c33ca7f 100644 --- a/lib/strlcpy.c +++ b/lib/strlcpy.c @@ -27,23 +27,26 @@ #ifndef HAVE_STRLCPY #undef strlcpy -size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t size); +size_t strlcpy(char *__restrict dest, + const char *__restrict src, size_t destsize); -size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t size) +size_t strlcpy(char *__restrict dest, + const char *__restrict src, size_t destsize) { size_t src_length = strlen(src); - if (__builtin_expect(src_length >= size, 0)) { - if (size > 0) { - /* Copy the leading portion of the string. The last - character is subsequently overwritten with the NUL - terminator, but the destination size is usually a - multiple of a small power of two, so writing it twice - should be more efficient than copying an odd number - of - bytes. */ - memcpy(dest, src, size); - dest[size - 1] = '\0'; + if (__builtin_expect(src_length >= destsize, 0)) { + if (destsize > 0) { + /* + * Copy the leading portion of the string. The last + * character is subsequently overwritten with the NUL + * terminator, but the destination destsize is usually + * a multiple of a small power of two, so writing it + * twice should be more efficient than copying an odd + * number of bytes. + */ + memcpy(dest, src, destsize); + dest[destsize - 1] = '\0'; } } else /* Copy the string and its terminating NUL character. */ diff --git a/lib/thread.c b/lib/thread.c index a221c7762..d26be1541 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -343,7 +343,6 @@ static void initializer() pthread_key_create(&thread_current, NULL); } -/* Allocate new thread master. */ struct thread_master *thread_master_create(const char *name) { struct thread_master *rv; @@ -426,6 +425,17 @@ struct thread_master *thread_master_create(const char *name) return rv; } +void thread_master_set_name(struct thread_master *master, const char *name) +{ + pthread_mutex_lock(&master->mtx); + { + if (master->name) + XFREE(MTYPE_THREAD_MASTER, master->name); + master->name = XSTRDUP(MTYPE_THREAD_MASTER, name); + } + pthread_mutex_unlock(&master->mtx); +} + /* Add a new thread to the list. */ static void thread_list_add(struct thread_list *list, struct thread *thread) { diff --git a/lib/thread.h b/lib/thread.h index c830446e1..f7c110914 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -174,6 +174,7 @@ struct cpu_thread_history { /* Prototypes. */ extern struct thread_master *thread_master_create(const char *); +void thread_master_set_name(struct thread_master *master, const char *name); extern void thread_master_free(struct thread_master *); extern void thread_master_free_unused(struct thread_master *); @@ -33,6 +33,7 @@ #include "memory.h" #include "command.h" #include "ns.h" +#include "privs.h" /* default VRF ID value used when VRF backend is not NETNS */ #define VRF_DEFAULT_INTERNAL 0 @@ -52,6 +53,7 @@ struct vrf_id_head vrfs_by_id = RB_INITIALIZER(&vrfs_by_id); struct vrf_name_head vrfs_by_name = RB_INITIALIZER(&vrfs_by_name); static int vrf_backend; +static struct zebra_privs_t *vrf_daemon_privs; /* * Turn on/off debug code @@ -690,14 +692,24 @@ DEFUN_NOSH (vrf_netns, "Attach VRF to a Namespace\n" "The file name in " NS_RUN_DIR ", or a full pathname\n") { - int idx_name = 1; + int idx_name = 1, ret; char *pathname = ns_netns_pathname(vty, argv[idx_name]->arg); VTY_DECLVAR_CONTEXT(vrf, vrf); if (!pathname) return CMD_WARNING_CONFIG_FAILED; - return vrf_netns_handler_create(vty, vrf, pathname, NS_UNKNOWN); + + if (vrf_daemon_privs && + vrf_daemon_privs->change(ZPRIVS_RAISE)) + zlog_err("%s: Can't raise privileges", __func__); + + ret = vrf_netns_handler_create(vty, vrf, pathname, NS_UNKNOWN); + + if (vrf_daemon_privs && + vrf_daemon_privs->change(ZPRIVS_LOWER)) + zlog_err("%s: Can't lower privileges", __func__); + return ret; } DEFUN (no_vrf_netns, @@ -779,7 +791,8 @@ void vrf_install_commands(void) install_element(ENABLE_NODE, &no_vrf_debug_cmd); } -void vrf_cmd_init(int (*writefunc)(struct vty *vty)) +void vrf_cmd_init(int (*writefunc)(struct vty *vty), + struct zebra_privs_t *daemon_privs) { install_element(CONFIG_NODE, &vrf_cmd); install_element(CONFIG_NODE, &no_vrf_cmd); @@ -787,6 +800,7 @@ void vrf_cmd_init(int (*writefunc)(struct vty *vty)) install_default(VRF_NODE); if (vrf_is_backend_netns() && ns_have_netns()) { /* Install NS commands. */ + vrf_daemon_privs = daemon_privs; install_element(VRF_NODE, &vrf_netns_cmd); install_element(VRF_NODE, &no_vrf_netns_cmd); } @@ -242,7 +242,8 @@ extern int vrf_switchback_to_initial(void); /* VRF vty command initialisation */ -extern void vrf_cmd_init(int (*writefunc)(struct vty *vty)); +extern void vrf_cmd_init(int (*writefunc)(struct vty *vty), + struct zebra_privs_t *daemon_priv); /* VRF vty debugging */ diff --git a/lib/zclient.c b/lib/zclient.c index 3ad4d9c6e..777f6fcf9 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -322,6 +322,18 @@ stream_failure: return 0; } +bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr) +{ + STREAM_GETW(zmsg, hdr->length); + STREAM_GETC(zmsg, hdr->marker); + STREAM_GETC(zmsg, hdr->version); + STREAM_GETL(zmsg, hdr->vrf_id); + STREAM_GETW(zmsg, hdr->command); + return true; +stream_failure: + return false; +} + /* Send simple Zebra message. */ static int zebra_message_send(struct zclient *zclient, int command, vrf_id_t vrf_id) diff --git a/lib/zclient.h b/lib/zclient.h index 1aa94b641..803348844 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -237,14 +237,13 @@ struct zclient { */ #define ZAPI_MESSAGE_TABLEID 0x80 +#define ZSERV_VERSION 5 /* Zserv protocol message header */ -struct zserv_header { +struct zmsghdr { uint16_t length; - uint8_t marker; /* corresponds to command field in old zserv - * always set to 255 in new zserv. - */ + /* Always set to 255 in new zserv */ + uint8_t marker; uint8_t version; -#define ZSERV_VERSION 5 vrf_id_t vrf_id; uint16_t command; }; @@ -380,9 +379,11 @@ struct zclient_options { /* Prototypes of zebra client service functions. */ extern struct zclient *zclient_new(struct thread_master *); +/* clang-format off */ #if CONFDATE > 20181101 CPP_NOTICE("zclient_new_notify can take over or zclient_new now"); #endif +/* clang-format on */ extern struct zclient_options zclient_options_default; @@ -449,9 +450,58 @@ extern int zclient_send_message(struct zclient *); /* create header for command, length to be filled in by user later */ extern void zclient_create_header(struct stream *, uint16_t, vrf_id_t); +/* + * Read sizeof(struct zmsghdr) bytes from the provided socket and parse the + * received data into the specified fields. If this is successful, read the + * rest of the packet into the provided stream. + * + * s + * The stream to read into + * + * sock + * The socket to read from + * + * size + * Parsed message size will be placed in the pointed-at integer + * + * marker + * Parsed marker will be placed in the pointed-at byte + * + * version + * Parsed version will be placed in the pointed-at byte + * + * vrf_id + * Parsed VRF ID will be placed in the pointed-at vrf_id_t + * + * cmd + * Parsed command number will be placed in the pointed-at integer + * + * Returns: + * -1 if: + * - insufficient data for header was read + * - a version mismatch was detected + * - a marker mismatch was detected + * - header size field specified more data than could be read + */ extern int zclient_read_header(struct stream *s, int sock, u_int16_t *size, u_char *marker, u_char *version, vrf_id_t *vrf_id, u_int16_t *cmd); +/* + * Parse header from ZAPI message stream into struct zmsghdr. + * This function assumes the stream getp points at the first byte of the header. + * If the function is successful then the stream getp will point to the byte + * immediately after the last byte of the header. + * + * zmsg + * The stream containing the header + * + * hdr + * The header struct to parse into. + * + * Returns: + * true if parsing succeeded, false otherwise + */ +extern bool zapi_parse_header(struct stream *zmsg, struct zmsghdr *hdr); extern void zclient_interface_set_master(struct zclient *client, struct interface *master, @@ -468,10 +518,11 @@ extern struct interface *zebra_interface_vrf_update_read(struct stream *s, extern void zebra_interface_if_set_value(struct stream *, struct interface *); extern void zebra_router_id_update_read(struct stream *s, struct prefix *rid); +/* clang-format off */ #if CONFDATE > 20180823 -CPP_NOTICE( - "zapi_ipv4_route, zapi_ipv6_route, zapi_ipv4_route_ipv6_nexthop as well as the zapi_ipv4 and zapi_ipv6 data structures should be removed now"); +CPP_NOTICE("zapi_ipv4_route, zapi_ipv6_route, zapi_ipv4_route_ipv6_nexthop as well as the zapi_ipv4 and zapi_ipv6 data structures should be removed now"); #endif +/* clang-format on */ extern int zapi_ipv4_route(u_char, struct zclient *, struct prefix_ipv4 *, struct zapi_ipv4 *) __attribute__((deprecated)); diff --git a/lib/zebra.h b/lib/zebra.h index 262ad2e43..923f6f77c 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -232,10 +232,12 @@ typedef unsigned char u_int8_t; #include "zassert.h" #ifndef HAVE_STRLCAT -size_t strlcat(char *__restrict dest, const char *__restrict src, size_t size); +size_t strlcat(char *__restrict dest, + const char *__restrict src, size_t destsize); #endif #ifndef HAVE_STRLCPY -size_t strlcpy(char *__restrict dest, const char *__restrict src, size_t size); +size_t strlcpy(char *__restrict dest, + const char *__restrict src, size_t destsize); #endif #ifdef HAVE_BROKEN_CMSG_FIRSTHDR diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c index b75d5b70f..f32cd6e7e 100644 --- a/ospf6d/ospf6_message.c +++ b/ospf6d/ospf6_message.c @@ -1573,7 +1573,8 @@ int ospf6_receive(struct thread *thread) oi = ospf6_interface_lookup_by_ifindex(ifindex); if (oi == NULL || oi->area == NULL || CHECK_FLAG(oi->flag, OSPF6_INTERFACE_DISABLE)) { - zlog_debug("Message received on disabled interface"); + if (IS_OSPF6_DEBUG_MESSAGE(OSPF6_MESSAGE_TYPE_UNKNOWN, RECV)) + zlog_debug("Message received on disabled interface"); return 0; } if (CHECK_FLAG(oi->flag, OSPF6_INTERFACE_PASSIVE)) { diff --git a/ospfd/.gitignore b/ospfd/.gitignore index f0d800efb..752c875a6 100644 --- a/ospfd/.gitignore +++ b/ospfd/.gitignore @@ -15,4 +15,3 @@ TAGS *~ *.loT *.a -*clippy.c diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 600279465..803e7bb01 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -604,11 +604,18 @@ static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty, json_object_object_add(json, ifp->name, json_row); + if (igmp->mtrace_only) { + json_object_boolean_true_add( + json_row, "mtraceOnly"); + } } else { vty_out(vty, "%-9s %5s %15s %d %7s %11s %8s\n", ifp->name, - if_is_up(ifp) ? "up" : "down", + if_is_up(ifp) + ? (igmp->mtrace_only ? "mtrc" + : "up") + : "down", inet_ntoa(igmp->ifaddr), pim_ifp->igmp_version, igmp->t_igmp_query_timer ? "local" @@ -758,10 +765,17 @@ static void igmp_show_interfaces_single(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); + if (igmp->mtrace_only) { + json_object_boolean_true_add( + json_row, "mtraceOnly"); + } } else { vty_out(vty, "Interface : %s\n", ifp->name); vty_out(vty, "State : %s\n", - if_is_up(ifp) ? "up" : "down"); + if_is_up(ifp) + ? (igmp->mtrace_only ? "mtrace" + : "up") + : "down"); vty_out(vty, "Address : %s\n", inet_ntoa(pim_ifp->primary_address)); vty_out(vty, "Uptime : %s\n", uptime); diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 998f8fc2c..ff7238ae9 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -574,7 +574,11 @@ void pim_if_addr_add(struct connected *ifc) /* if addr new, add IGMP socket */ if (ifc->address->family == AF_INET) pim_igmp_sock_add(pim_ifp->igmp_socket_list, - ifaddr, ifp); + ifaddr, ifp, false); + } else if (igmp->mtrace_only) { + igmp_sock_delete(igmp); + pim_igmp_sock_add(pim_ifp->igmp_socket_list, ifaddr, + ifp, false); } /* Replay Static IGMP groups */ @@ -611,6 +615,20 @@ void pim_if_addr_add(struct connected *ifc) } } } /* igmp */ + else { + struct igmp_sock *igmp; + + /* lookup IGMP socket */ + igmp = pim_igmp_sock_lookup_ifaddr(pim_ifp->igmp_socket_list, + ifaddr); + if (ifc->address->family == AF_INET) { + if (igmp) + igmp_sock_delete(igmp); + /* if addr new, add IGMP socket */ + pim_igmp_sock_add(pim_ifp->igmp_socket_list, ifaddr, + ifp, true); + } + } /* igmp mtrace only */ if (PIM_IF_TEST_PIM(pim_ifp->options)) { diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index c0a58516d..5e1aecc3a 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -281,6 +281,9 @@ static int igmp_recv_query(struct igmp_sock *igmp, int query_version, uint16_t recv_checksum; uint16_t checksum; + if (igmp->mtrace_only) + return 0; + memcpy(&group_addr, igmp_msg + 4, sizeof(struct in_addr)); ifp = igmp->interface; @@ -387,6 +390,9 @@ static int igmp_v1_recv_report(struct igmp_sock *igmp, struct in_addr from, on_trace(__PRETTY_FUNCTION__, igmp->interface, from); + if (igmp->mtrace_only) + return 0; + if (igmp_msg_len != IGMP_V12_MSG_SIZE) { zlog_warn( "Recv IGMP report v1 from %s on %s: size=%d other than correct=%d", @@ -510,7 +516,6 @@ int pim_igmp_packet(struct igmp_sock *igmp, char *buf, size_t len) return igmp_mtrace_recv_response(igmp, ip_hdr, ip_hdr->ip_src, from_str, igmp_msg, igmp_msg_len); - break; case PIM_IGMP_MTRACE_QUERY_REQUEST: return igmp_mtrace_recv_qry_req(igmp, ip_hdr, ip_hdr->ip_src, from_str, igmp_msg, @@ -819,7 +824,7 @@ static int igmp_group_hash_equal(const void *arg1, const void *arg2) } static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr, - struct interface *ifp) + struct interface *ifp, int mtrace_only) { struct pim_interface *pim_ifp; struct igmp_sock *igmp; @@ -862,6 +867,13 @@ static struct igmp_sock *igmp_sock_new(int fd, struct in_addr ifaddr, pim_ifp->igmp_default_robustness_variable; igmp->sock_creation = pim_time_monotonic_sec(); + if (mtrace_only) { + igmp->mtrace_only = mtrace_only; + return igmp; + } + + igmp->mtrace_only = false; + /* igmp_startup_mode_on() will reset QQI: @@ -919,7 +931,8 @@ static void igmp_read_on(struct igmp_sock *igmp) struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list, struct in_addr ifaddr, - struct interface *ifp) + struct interface *ifp, + bool mtrace_only) { struct pim_interface *pim_ifp; struct igmp_sock *igmp; @@ -934,7 +947,7 @@ struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list, return 0; } - igmp = igmp_sock_new(fd, ifaddr, ifp); + igmp = igmp_sock_new(fd, ifaddr, ifp, mtrace_only); if (!igmp) { zlog_err("%s %s: igmp_sock_new() failure", __FILE__, __PRETTY_FUNCTION__); diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h index 962c50e76..561a127d0 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -90,6 +90,8 @@ struct igmp_sock { int querier_robustness_variable; /* QRV */ int startup_query_count; + bool mtrace_only; + struct list *igmp_group_list; /* list of struct igmp_group */ struct hash *igmp_group_hash; }; @@ -99,7 +101,8 @@ struct igmp_sock *pim_igmp_sock_lookup_ifaddr(struct list *igmp_sock_list, struct igmp_sock *igmp_sock_lookup_by_fd(struct list *igmp_sock_list, int fd); struct igmp_sock *pim_igmp_sock_add(struct list *igmp_sock_list, struct in_addr ifaddr, - struct interface *ifp); + struct interface *ifp, + bool mtrace_only); void igmp_sock_delete(struct igmp_sock *igmp); void igmp_sock_free(struct igmp_sock *igmp); void igmp_sock_delete_all(struct interface *ifp); diff --git a/pimd/pim_igmpv2.c b/pimd/pim_igmpv2.c index efa36e618..dbbe83a96 100644 --- a/pimd/pim_igmpv2.c +++ b/pimd/pim_igmpv2.c @@ -111,6 +111,9 @@ int igmp_v2_recv_report(struct igmp_sock *igmp, struct in_addr from, on_trace(__PRETTY_FUNCTION__, igmp->interface, from); + if (igmp->mtrace_only) + return 0; + if (igmp_msg_len != IGMP_V12_MSG_SIZE) { zlog_warn( "Recv IGMPv2 REPORT from %s on %s: size=%d other than correct=%d", @@ -154,6 +157,9 @@ int igmp_v2_recv_leave(struct igmp_sock *igmp, struct in_addr from, on_trace(__PRETTY_FUNCTION__, igmp->interface, from); + if (igmp->mtrace_only) + return 0; + if (igmp_msg_len != IGMP_V12_MSG_SIZE) { zlog_warn( "Recv IGMPv2 LEAVE from %s on %s: size=%d other than correct=%d", diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c index ecde546c0..3360e36b4 100644 --- a/pimd/pim_igmpv3.c +++ b/pimd/pim_igmpv3.c @@ -1874,6 +1874,9 @@ int igmp_v3_recv_report(struct igmp_sock *igmp, struct in_addr from, int local_ncb = 0; struct pim_interface *pim_ifp; + if (igmp->mtrace_only) + return 0; + pim_ifp = igmp->interface->info; if (igmp_msg_len < IGMP_V3_MSG_MIN_SIZE) { diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c index f92da7fe7..60a3308a0 100644 --- a/pimd/pim_instance.c +++ b/pimd/pim_instance.c @@ -214,7 +214,7 @@ void pim_vrf_init(void) { vrf_init(pim_vrf_new, pim_vrf_enable, pim_vrf_disable, pim_vrf_delete); - vrf_cmd_init(pim_vrf_config_write); + vrf_cmd_init(pim_vrf_config_write, &pimd_privs); } void pim_vrf_terminate(void) diff --git a/redhat/README.rpm_build.md b/redhat/README.rpm_build.md index 2de64b8f4..7deea54de 100644 --- a/redhat/README.rpm_build.md +++ b/redhat/README.rpm_build.md @@ -29,7 +29,7 @@ Building your own FRRouting RPM cd frr ./bootstrap.sh ./configure --with-pkg-extra-version=-MyRPMVersion - make dist + make SPHINXBUILD=sphinx-build2.7 dist Note: configure parameters are not important for the RPM building - except the `with-pkg-extra-version` if you want to give the RPM a specific name to mark your own unoffical build diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index 20b96bb76..b4073f94f 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -37,6 +37,13 @@ # defines for configure %define _localstatedir /var/run/frr + +# define for sphinx-build binary +%if 0%{?rhel} && 0%{?rhel} < 7 +%define sphinx sphinx-build2.7 +%else +%define sphinx sphinx-build +%endif ############################################################################ #### Version String tweak @@ -135,14 +142,14 @@ URL: http://www.frrouting.org Requires(pre): /sbin/install-info Requires(preun): /sbin/install-info Requires(post): /sbin/install-info -BuildRequires: gcc texi2html texinfo patch libcap-devel groff +BuildRequires: gcc patch libcap-devel BuildRequires: readline readline-devel ncurses ncurses-devel BuildRequires: json-c-devel bison >= 2.7 flex make %if 0%{?rhel} && 0%{?rhel} < 7 #python27-devel is available from ius community repo for RedHat/CentOS 6 -BuildRequires: python27-devel +BuildRequires: python27-devel python27-sphinx %else -BuildRequires: python-devel >= 2.7 +BuildRequires: python-devel >= 2.7 python-sphinx %endif Requires: ncurses json-c initscripts %if %{with_pam} @@ -169,7 +176,7 @@ protocol. It takes multi-server and multi-thread approach to resolve the current complexity of the Internet. FRRouting supports BGP4, OSPFv2, OSPFv3, ISIS, RIP, RIPng, PIM, LDP -NHRP and EIGRP. +NHRP, Babel and EIGRP. FRRouting is a fork of Quagga. @@ -299,20 +306,16 @@ developing OSPF-API and frr applications. %endif --enable-poll=yes -make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" +make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" SPHINXBUILD=%{sphinx} pushd doc -if [ $(texi2html --version | cut -d. -f1) -lt 5 ]; then -texi2html --number-sections frr.texi -else -texi2html --number-footnotes --number-sections frr.texi -fi +make SPHINXBUILD=%{sphinx} info popd %install mkdir -p %{buildroot}/etc/{frr,sysconfig,logrotate.d,pam.d,default} \ %{buildroot}/var/log/frr %{buildroot}%{_infodir} -make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install +make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" SPHINXBUILD=%{sphinx} install # Remove this file, as it is uninstalled and causes errors when building on RH9 rm -rf %{buildroot}/usr/share/info/dir @@ -506,7 +509,6 @@ rm -rf %{buildroot} %files %defattr(-,root,root) %doc */*.sample* AUTHORS COPYING -%doc doc/frr.html %doc doc/mpls %doc ChangeLog INSTALL NEWS README REPORTING-BUGS SERVICES %if 0%{?frr_user:1} @@ -602,7 +604,10 @@ rm -rf %{buildroot} %endif %changelog -* Fri Oct 20 2017 Martin Winter <mwinter@opensourcerouting.org> - %{version} +* Tue Feb 20 2018 Martin Winter <mwinter@opensourcerouting.org> - %{version} +- Adapt to new documentation structure based on Sphinx + +* Fri Oct 20 2017 Martin Winter <mwinter@opensourcerouting.org> - Fix script location for watchfrr restart functions in daemon config - Fix postun script to restart frr during upgrade diff --git a/sharpd/.gitignore b/sharpd/.gitignore index c396f3ef9..cc33cfc18 100644 --- a/sharpd/.gitignore +++ b/sharpd/.gitignore @@ -13,6 +13,5 @@ TAGS .arch-ids *~ *.loT -*clippy.c sharpd sharpd.conf diff --git a/tests/Makefile.am b/tests/Makefile.am index f4ab2a126..0c9a5684d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,6 +73,7 @@ check_PROGRAMS = \ lib/test_timer_correctness \ lib/test_timer_performance \ lib/test_ttable \ + lib/test_zlog \ lib/cli/test_cli \ lib/cli/test_commands \ $(TESTS_BGPD) \ @@ -115,9 +116,9 @@ lib_test_heavy_SOURCES = lib/test_heavy.c helpers/c/main.c lib_test_memory_SOURCES = lib/test_memory.c lib_test_nexthop_iter_SOURCES = lib/test_nexthop_iter.c helpers/c/prng.c lib_test_privs_SOURCES = lib/test_privs.c +lib_test_ringbuf_SOURCES = lib/test_ringbuf.c lib_test_srcdest_table_SOURCES = lib/test_srcdest_table.c \ helpers/c/prng.c -lib_test_ringbuf_SOURCES = lib/test_ringbuf.c lib_test_segv_SOURCES = lib/test_segv.c lib_test_sig_SOURCES = lib/test_sig.c lib_test_stream_SOURCES = lib/test_stream.c @@ -127,6 +128,7 @@ lib_test_timer_correctness_SOURCES = lib/test_timer_correctness.c \ lib_test_timer_performance_SOURCES = lib/test_timer_performance.c \ helpers/c/prng.c lib_test_ttable_SOURCES = lib/test_ttable.c +lib_test_zlog_SOURCES = lib/test_zlog.c lib_test_zmq_SOURCES = lib/test_zmq.c lib_test_zmq_CFLAGS = $(AM_CFLAGS) $(ZEROMQ_CFLAGS) lib_cli_test_cli_SOURCES = lib/cli/test_cli.c lib/cli/common_cli.c @@ -167,6 +169,7 @@ lib_test_table_LDADD = $(ALL_TESTS_LDADD) -lm lib_test_timer_correctness_LDADD = $(ALL_TESTS_LDADD) lib_test_timer_performance_LDADD = $(ALL_TESTS_LDADD) lib_test_ttable_LDADD = $(ALL_TESTS_LDADD) +lib_test_zlog_LDADD = $(ALL_TESTS_LDADD) lib_test_zmq_LDADD = ../lib/libfrrzmq.la $(ALL_TESTS_LDADD) $(ZEROMQ_LIBS) lib_cli_test_cli_LDADD = $(ALL_TESTS_LDADD) lib_cli_test_commands_LDADD = $(ALL_TESTS_LDADD) @@ -207,6 +210,7 @@ EXTRA_DIST = \ lib/test_timer_correctness.py \ lib/test_ttable.py \ lib/test_ttable.refout \ + lib/test_zlog.py \ ospf6d/test_lsdb.py \ ospf6d/test_lsdb.in \ ospf6d/test_lsdb.refout \ diff --git a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz Binary files differindex 3eb0205a5..cca702b13 100644 --- a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz +++ b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz diff --git a/tests/lib/test_zlog.c b/tests/lib/test_zlog.c new file mode 100644 index 000000000..790e65cfe --- /dev/null +++ b/tests/lib/test_zlog.c @@ -0,0 +1,61 @@ +/* + * Zlog tests. + * Copyright (C) 2018 Cumulus Networks, Inc. + * Quentin Young + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; see the file COPYING; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +#include <zebra.h> +#include <memory.h> +#include "log.h" + +/* maximum amount of data to hexdump */ +#define MAXDATA 16384 + +/* + * Test hexdump functionality. + * + * At the moment, not crashing is considered success. + */ +static bool test_zlog_hexdump(void) +{ + unsigned int nl = 1; + + do { + long d[nl]; + + for (unsigned int i = 0; i < nl; i++) + d[i] = random(); + zlog_hexdump(d, nl * sizeof(long)); + } while (++nl * sizeof(long) <= MAXDATA); + + return true; +} + +bool (*tests[])(void) = { + test_zlog_hexdump, +}; + +int main(int argc, char **argv) +{ + openzlog("testzlog", "NONE", 0, LOG_CONS | LOG_NDELAY | LOG_PID, + LOG_ERR); + zlog_set_file("test_zlog.log", LOG_DEBUG); + + for (unsigned int i = 0; i < array_size(tests); i++) + if (!tests[i]()) + return 1; + return 0; +} diff --git a/tests/lib/test_zlog.py b/tests/lib/test_zlog.py new file mode 100644 index 000000000..2ca258588 --- /dev/null +++ b/tests/lib/test_zlog.py @@ -0,0 +1,4 @@ +import frrtest + +class TestZlog(frrtest.TestMultiOut): + program = './test_zlog' diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 0b7e80962..208fb116e 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -413,7 +413,7 @@ end ctx_keys = [] current_context_lines = [] - elif line == "exit-address-family" or line == "exit" or line == "exit-vni": + elif line in ["exit-address-family", "exit", "exit-vnc", "exit-vni"]: # if this exit is for address-family ipv4 unicast, ignore the pop if main_ctx_key: self.save_contexts(ctx_keys, current_context_lines) @@ -433,26 +433,14 @@ end current_context_lines = [] new_ctx = False log.debug('LINE %-50s: entering new context, %-50s', line, ctx_keys) - - # The 'vni' keyword under 'router bgp X/address-family l2vpn evpn' creates - # a sub-context but the 'vni' keyword in other places (such as 'vrf BLUE') - # does not. - elif ("vni " in line and - len(ctx_keys) == 2 and - ctx_keys[0].startswith('router bgp') and - ctx_keys[1] == 'address-family l2vpn evpn'): - - main_ctx_key = [] - - # Save old context first - self.save_contexts(ctx_keys, current_context_lines) - current_context_lines = [] - main_ctx_key = copy.deepcopy(ctx_keys) - log.debug('LINE %-50s: entering sub-context, append to ctx_keys', line) - - ctx_keys.append(line) - - elif "address-family " in line: + elif (line.startswith("address-family ") or + line.startswith("vnc defaults") or + line.startswith("vnc l2-group") or + line.startswith("vnc nve-group") or + (line.startswith("vni ") and + len(ctx_keys) == 2 and + ctx_keys[0].startswith('router bgp') and + ctx_keys[1] == 'address-family l2vpn evpn')): main_ctx_key = [] # Save old context first diff --git a/tools/indent.py b/tools/indent.py index 91bb23f67..139049b67 100755 --- a/tools/indent.py +++ b/tools/indent.py @@ -6,7 +6,7 @@ import sys, re, subprocess, os # find all DEFUNs defun_re = re.compile( - r'^((DEF(UN(_NOSH|_HIDDEN)?|PY)|ALIAS)\s*\(.*?)^(?=\s*\{)', + r'^((DEF(UN(|_ATTR|_CMD_(ELEMENT|FUNC_(DECL|TEXT))|_DEPRECATED|_NOSH|_HIDDEN|SH(|_ATTR|_DEPRECATED|_HIDDEN))?|PY)|ALIAS)\s*\(.*?)^(?=\s*\{)', re.M | re.S) define_re = re.compile( r'((^#\s*define[^\n]+[^\\]\n)+)', diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 8384902c9..556ce2722 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1215,21 +1215,30 @@ DEFUNSH(VTYSH_BGPD, address_family_ipv6_labeled_unicast, } #if defined(HAVE_RPKI) -DEFUNSH(VTYSH_BGPD, rpki, rpki_cmd, "rpki", +DEFUNSH(VTYSH_BGPD, + rpki, + rpki_cmd, + "rpki", "Enable rpki and enter rpki configuration mode\n") { vty->node = RPKI_NODE; return CMD_SUCCESS; } -DEFUNSH(VTYSH_BGPD, rpki_exit, rpki_exit_cmd, "exit", +DEFUNSH(VTYSH_BGPD, + rpki_exit, + rpki_exit_cmd, + "exit", "Exit current mode and down to previous mode\n") { vty->node = CONFIG_NODE; return CMD_SUCCESS; } -DEFUNSH(VTYSH_BGPD, rpki_quit, rpki_quit_cmd, "quit", +DEFUNSH(VTYSH_BGPD, + rpki_quit, + rpki_quit_cmd, + "quit", "Exit current mode and down to previous mode\n") { return rpki_exit(self, vty, argc, argv); @@ -1350,7 +1359,8 @@ DEFUNSH(VTYSH_OSPFD, router_ospf, router_ospf_cmd, "router ospf [(1-65535)] [vrf NAME]", "Enable a routing process\n" "Start OSPF configuration\n" - "Instance ID\n" VRF_CMD_HELP_STR) + "Instance ID\n" + VRF_CMD_HELP_STR) { vty->node = OSPF_NODE; return CMD_SUCCESS; @@ -1828,14 +1838,16 @@ DEFSH(VTYSH_ZEBRA, vtysh_no_vrf_cmd, "no vrf NAME", NO_STR "Delete a pseudo vrf's configuration\n" "VRF's name\n") -DEFUNSH(VTYSH_NS, vtysh_exit_logicalrouter, vtysh_exit_logicalrouter_cmd, - "exit", "Exit current mode and down to previous mode\n") +DEFUNSH(VTYSH_NS, vtysh_exit_logicalrouter, + vtysh_exit_logicalrouter_cmd, "exit", + "Exit current mode and down to previous mode\n") { return vtysh_exit(vty); } -DEFUNSH(VTYSH_NS, vtysh_quit_logicalrouter, vtysh_quit_logicalrouter_cmd, - "quit", "Exit current mode and down to previous mode\n") +DEFUNSH(VTYSH_NS, vtysh_quit_logicalrouter, + vtysh_quit_logicalrouter_cmd, "quit", + "Exit current mode and down to previous mode\n") { return vtysh_exit_logicalrouter(self, vty, argc, argv); } diff --git a/zebra/.gitignore b/zebra/.gitignore index 7a1321e54..4a06756a2 100644 --- a/zebra/.gitignore +++ b/zebra/.gitignore @@ -13,4 +13,3 @@ TAGS .arch-ids *~ *.loT -zebra_vty_clippy.c diff --git a/zebra/if_netlink.c b/zebra/if_netlink.c index bb0a0e052..a37d74416 100644 --- a/zebra/if_netlink.c +++ b/zebra/if_netlink.c @@ -30,6 +30,7 @@ */ #define _LINUX_IN6_H +#include <netinet/if_ether.h> #include <linux/if_bridge.h> #include <linux/if_link.h> #include <net/if_arp.h> @@ -362,7 +363,7 @@ static int get_iflink_speed(struct interface *interface) /* initialize ethtool interface */ memset(&ecmd, 0, sizeof(ecmd)); ecmd.cmd = ETHTOOL_GSET; /* ETHTOOL_GLINK */ - ifdata.ifr_data = (__caddr_t)&ecmd; + ifdata.ifr_data = (caddr_t)&ecmd; /* use ioctl to get IP address of an interface */ if (zserv_privs.change(ZPRIVS_RAISE)) diff --git a/zebra/label_manager.c b/zebra/label_manager.c index 5bf0fce09..b58f0c9ff 100644 --- a/zebra/label_manager.c +++ b/zebra/label_manager.c @@ -50,6 +50,8 @@ DEFINE_MTYPE_STATIC(LBL_MGR, LM_CHUNK, "Label Manager Chunk"); * it will be a proxy to relay messages to external label manager * This zclient thus is to connect to it */ +static struct stream *ibuf; +static struct stream *obuf; static struct zclient *zclient; bool lm_is_external; @@ -69,7 +71,7 @@ static int relay_response_back(struct zserv *zserv) u_int16_t resp_cmd; src = zclient->ibuf; - dst = zserv->obuf; + dst = obuf; stream_reset(src); @@ -87,7 +89,7 @@ static int relay_response_back(struct zserv *zserv) /* send response back */ stream_copy(dst, src); - ret = writen(zserv->sock, dst->data, stream_get_endp(dst)); + ret = writen(zserv->sock, src->data, stream_get_endp(src)); if (ret <= 0) { zlog_err("%s: Error sending Label Manager response back: %s", __func__, strerror(errno)); @@ -116,10 +118,10 @@ static int lm_zclient_read(struct thread *t) static int reply_error(int cmd, struct zserv *zserv, vrf_id_t vrf_id) { + int ret; struct stream *s; - s = zserv->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, vrf_id); @@ -129,7 +131,10 @@ static int reply_error(int cmd, struct zserv *zserv, vrf_id_t vrf_id) /* Write packet size. */ stream_putw_at(s, 0, stream_get_endp(s)); - return writen(zserv->sock, s->data, stream_get_endp(s)); + ret = writen(zserv->sock, s->data, stream_get_endp(s)); + + stream_free(s); + return ret; } /** * Receive a request to get or release a label chunk and forward it to external @@ -161,7 +166,7 @@ int zread_relay_label_manager_request(int cmd, struct zserv *zserv, ret = relay_response_back(zserv); /* Send request to external label manager */ - src = zserv->ibuf; + src = ibuf; dst = zclient->obuf; stream_copy(dst, src); @@ -247,6 +252,9 @@ void label_manager_init(char *lm_zserv_path) lm_is_external = true; lm_zclient_init(lm_zserv_path); } + + ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ); + obuf = stream_new(ZEBRA_MAX_PACKET_SIZ); } /** @@ -379,4 +387,6 @@ int release_daemon_chunks(u_char proto, u_short instance) void label_manager_close() { list_delete_and_null(&lbl_mgr.lc_list); + stream_free(ibuf); + stream_free(obuf); } diff --git a/zebra/redistribute.c b/zebra/redistribute.c index 36168a5f2..3a66aea45 100644 --- a/zebra/redistribute.c +++ b/zebra/redistribute.c @@ -244,16 +244,15 @@ void redistribute_delete(struct prefix *p, struct prefix *src_p, } } -void zebra_redistribute_add(int command, struct zserv *client, int length, - struct zebra_vrf *zvrf) +void zebra_redistribute_add(ZAPI_HANDLER_ARGS) { afi_t afi = 0; int type = 0; u_short instance; - STREAM_GETC(client->ibuf, afi); - STREAM_GETC(client->ibuf, type); - STREAM_GETW(client->ibuf, instance); + STREAM_GETC(msg, afi); + STREAM_GETC(msg, type); + STREAM_GETW(msg, instance); if (IS_ZEBRA_DEBUG_EVENT) zlog_debug( @@ -297,16 +296,15 @@ stream_failure: return; } -void zebra_redistribute_delete(int command, struct zserv *client, int length, - struct zebra_vrf *zvrf) +void zebra_redistribute_delete(ZAPI_HANDLER_ARGS) { afi_t afi = 0; int type = 0; u_short instance; - STREAM_GETC(client->ibuf, afi); - STREAM_GETC(client->ibuf, type); - STREAM_GETW(client->ibuf, instance); + STREAM_GETC(msg, afi); + STREAM_GETC(msg, type); + STREAM_GETW(msg, instance); if (afi == 0 || afi > AFI_MAX) { zlog_warn("%s: Specified afi %d does not exist", @@ -335,15 +333,13 @@ stream_failure: return; } -void zebra_redistribute_default_add(int command, struct zserv *client, - int length, struct zebra_vrf *zvrf) +void zebra_redistribute_default_add(ZAPI_HANDLER_ARGS) { vrf_bitmap_set(client->redist_default, zvrf_id(zvrf)); zebra_redistribute_default(client, zvrf_id(zvrf)); } -void zebra_redistribute_default_delete(int command, struct zserv *client, - int length, struct zebra_vrf *zvrf) +void zebra_redistribute_default_delete(ZAPI_HANDLER_ARGS) { vrf_bitmap_unset(client->redist_default, zvrf_id(zvrf)); } diff --git a/zebra/redistribute.h b/zebra/redistribute.h index 5edb06c3d..e551f820c 100644 --- a/zebra/redistribute.h +++ b/zebra/redistribute.h @@ -27,15 +27,12 @@ #include "vty.h" #include "vrf.h" -extern void zebra_redistribute_add(int, struct zserv *, int, - struct zebra_vrf *zvrf); -extern void zebra_redistribute_delete(int, struct zserv *, int, - struct zebra_vrf *zvrf); - -extern void zebra_redistribute_default_add(int, struct zserv *, int, - struct zebra_vrf *zvrf); -extern void zebra_redistribute_default_delete(int, struct zserv *, int, - struct zebra_vrf *zvrf); +/* ZAPI command handlers */ +extern void zebra_redistribute_add(ZAPI_HANDLER_ARGS); +extern void zebra_redistribute_delete(ZAPI_HANDLER_ARGS); +extern void zebra_redistribute_default_add(ZAPI_HANDLER_ARGS); +extern void zebra_redistribute_default_delete(ZAPI_HANDLER_ARGS); +/* ----------------- */ extern void redistribute_update(struct prefix *, struct prefix *, struct route_entry *, struct route_entry *); diff --git a/zebra/rib.h b/zebra/rib.h index 5dd444dce..0ee89e015 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -447,6 +447,8 @@ DECLARE_HOOK(rib_update, (struct route_node * rn, const char *reason), extern void zebra_vty_init(void); extern int static_config(struct vty *vty, struct zebra_vrf *zvrf, afi_t afi, safi_t safi, const char *cmd); +extern void static_config_install_delayed_routes(struct zebra_vrf *zvrf); + extern pid_t pid; #endif /*_ZEBRA_RIB_H */ diff --git a/zebra/rtadv.c b/zebra/rtadv.c index 5eebca163..d0b821bfd 100644 --- a/zebra/rtadv.c +++ b/zebra/rtadv.c @@ -801,8 +801,7 @@ static void ipv6_nd_suppress_ra_set(struct interface *ifp, * if the operator has explicitly enabled RA. The enable request can also * specify a RA interval (in seconds). */ -void zebra_interface_radv_set(struct zserv *client, u_short length, - struct zebra_vrf *zvrf, int enable) +static void zebra_interface_radv_set(ZAPI_HANDLER_ARGS, int enable) { struct stream *s; ifindex_t ifindex; @@ -810,7 +809,7 @@ void zebra_interface_radv_set(struct zserv *client, u_short length, struct zebra_if *zif; int ra_interval; - s = client->ibuf; + s = msg; /* Get interface index and RA interval. */ STREAM_GETL(s, ifindex); @@ -859,6 +858,15 @@ stream_failure: return; } +void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS) +{ + zebra_interface_radv_set(client, hdr, msg, zvrf, 0); +} +void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS) +{ + zebra_interface_radv_set(client, hdr, msg, zvrf, 1); +} + DEFUN (ipv6_nd_suppress_ra, ipv6_nd_suppress_ra_cmd, "ipv6 nd suppress-ra", diff --git a/zebra/rtadv.h b/zebra/rtadv.h index 2cae6d06f..8fd67c8a6 100644 --- a/zebra/rtadv.h +++ b/zebra/rtadv.h @@ -103,7 +103,8 @@ typedef enum { extern void rtadv_init(struct zebra_ns *); extern void rtadv_terminate(struct zebra_ns *); extern void rtadv_cmd_init(void); -extern void zebra_interface_radv_set(struct zserv *client, u_short length, - struct zebra_vrf *zvrf, int enable); +extern void zebra_interface_radv_disable(ZAPI_HANDLER_ARGS); +extern void zebra_interface_radv_enable(ZAPI_HANDLER_ARGS); + #endif /* _ZEBRA_RTADV_H */ diff --git a/zebra/zebra_mpls.c b/zebra/zebra_mpls.c index 0af06806d..1868b4676 100644 --- a/zebra/zebra_mpls.c +++ b/zebra/zebra_mpls.c @@ -455,8 +455,7 @@ static int fec_send(zebra_fec_t *fec, struct zserv *client) rn = fec->rn; /* Get output stream. */ - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_FEC_UPDATE, VRF_DEFAULT); @@ -464,7 +463,7 @@ static int fec_send(zebra_fec_t *fec, struct zserv *client) stream_put_prefix(s, &rn->p); stream_putl(s, fec->label); stream_putw_at(s, 0, stream_get_endp(s)); - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* diff --git a/zebra/zebra_mroute.c b/zebra/zebra_mroute.c index e9cd19ebe..042bd3769 100644 --- a/zebra/zebra_mroute.c +++ b/zebra/zebra_mroute.c @@ -32,17 +32,16 @@ #include "zebra/rt.h" #include "zebra/debug.h" -int zebra_ipmr_route_stats(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS) { struct mcast_route_data mroute; struct stream *s; int suc = -1; memset(&mroute, 0, sizeof(mroute)); - STREAM_GET(&mroute.sg.src, client->ibuf, 4); - STREAM_GET(&mroute.sg.grp, client->ibuf, 4); - STREAM_GETL(client->ibuf, mroute.ifindex); + STREAM_GET(&mroute.sg.src, msg, 4); + STREAM_GET(&mroute.sg.grp, msg, 4); + STREAM_GETL(msg, mroute.ifindex); if (IS_ZEBRA_DEBUG_KERNEL) { char sbuf[40]; @@ -57,7 +56,7 @@ int zebra_ipmr_route_stats(struct zserv *client, u_short length, suc = kernel_get_ipmr_sg_stats(zvrf, &mroute); stream_failure: - s = client->obuf; + s = stream_new(ZEBRA_MAX_PACKET_SIZ); stream_reset(s); @@ -68,6 +67,5 @@ stream_failure: stream_putl(s, suc); stream_putw_at(s, 0, stream_get_endp(s)); - zebra_server_send_message(client); - return 0; + zebra_server_send_message(client, s); } diff --git a/zebra/zebra_mroute.h b/zebra/zebra_mroute.h index 616c3a83a..338515360 100644 --- a/zebra/zebra_mroute.h +++ b/zebra/zebra_mroute.h @@ -22,13 +22,14 @@ #ifndef __ZEBRA_MROUTE_H__ #define __ZEBRA_MROUTE_H__ +#include "zebra/zserv.h" + struct mcast_route_data { struct prefix_sg sg; unsigned int ifindex; unsigned long long lastused; }; -int zebra_ipmr_route_stats(struct zserv *client, u_short length, - struct zebra_vrf *zvf); +void zebra_ipmr_route_stats(ZAPI_HANDLER_ARGS); #endif diff --git a/zebra/zebra_netns_notify.c b/zebra/zebra_netns_notify.c index 4f55be45b..98b36dd10 100644 --- a/zebra/zebra_netns_notify.c +++ b/zebra/zebra_netns_notify.c @@ -92,7 +92,11 @@ static void zebra_ns_notify_create_context_from_entry_name(const char *name) zlog_warn("NS notify : failed to create VRF %s", name); return; } + if (zserv_privs.change(ZPRIVS_RAISE)) + zlog_err("Can't raise privileges"); ret = vrf_netns_handler_create(NULL, vrf, netnspath, ns_id); + if (zserv_privs.change(ZPRIVS_LOWER)) + zlog_err("Can't lower privileges"); if (ret != CMD_SUCCESS) { zlog_warn("NS notify : failed to create NS %s", netnspath); return; diff --git a/zebra/zebra_ptm.c b/zebra/zebra_ptm.c index f6775fa0b..67c7220b6 100644 --- a/zebra/zebra_ptm.c +++ b/zebra/zebra_ptm.c @@ -661,8 +661,7 @@ int zebra_ptm_sock_read(struct thread *thread) } /* BFD peer/dst register/update */ -int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length, - int command, struct zebra_vrf *zvrf) +void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS) { struct stream *s; struct prefix src_p; @@ -680,20 +679,20 @@ int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length, int data_len = ZEBRA_PTM_SEND_MAX_SOCKBUF; unsigned int pid; - if (command == ZEBRA_BFD_DEST_UPDATE) + if (hdr->command == ZEBRA_BFD_DEST_UPDATE) client->bfd_peer_upd8_cnt++; else client->bfd_peer_add_cnt++; if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("bfd_dst_register msg from client %s: length=%d", - zebra_route_string(client->proto), length); + zebra_route_string(client->proto), hdr->length); if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time, &ptm_cb.t_timer); - return -1; + return; } ptm_lib_init_msg(ptm_hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL, &out_ctxt); @@ -703,7 +702,7 @@ int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length, ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_CLIENT_FIELD, tmp_buf); - s = client->ibuf; + s = msg; STREAM_GETL(s, pid); sprintf(tmp_buf, "%d", pid); @@ -816,16 +815,14 @@ int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length, ptm_cb.out_data); zebra_ptm_send_message(ptm_cb.out_data, data_len); - return 0; + return; stream_failure: ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); - return 0; } /* BFD peer/dst deregister */ -int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS) { struct stream *s; struct prefix src_p; @@ -843,13 +840,13 @@ int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length, if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("bfd_dst_deregister msg from client %s: length=%d", - zebra_route_string(client->proto), length); + zebra_route_string(client->proto), hdr->length); if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time, &ptm_cb.t_timer); - return -1; + return; } ptm_lib_init_msg(ptm_hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL, &out_ctxt); @@ -861,7 +858,7 @@ int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length, ptm_lib_append_msg(ptm_hdl, out_ctxt, ZEBRA_PTM_BFD_CLIENT_FIELD, tmp_buf); - s = client->ibuf; + s = msg; STREAM_GETL(s, pid); sprintf(tmp_buf, "%d", pid); @@ -948,15 +945,14 @@ int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length, zebra_ptm_send_message(ptm_cb.out_data, data_len); - return 0; + return; stream_failure: ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); - return 0; } /* BFD client register */ -int zebra_ptm_bfd_client_register(struct zserv *client, u_short length) +void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS) { struct stream *s; unsigned int pid; @@ -968,16 +964,16 @@ int zebra_ptm_bfd_client_register(struct zserv *client, u_short length) if (IS_ZEBRA_DEBUG_EVENT) zlog_debug("bfd_client_register msg from client %s: length=%d", - zebra_route_string(client->proto), length); + zebra_route_string(client->proto), hdr->length); - s = client->ibuf; + s = msg; STREAM_GETL(s, pid); if (ptm_cb.ptm_sock == -1) { ptm_cb.t_timer = NULL; thread_add_timer(zebrad.master, zebra_ptm_connect, NULL, ptm_cb.reconnect_time, &ptm_cb.t_timer); - return -1; + return; } ptm_lib_init_msg(ptm_hdl, 0, PTMLIB_MSG_TYPE_CMD, NULL, &out_ctxt); @@ -1003,7 +999,7 @@ int zebra_ptm_bfd_client_register(struct zserv *client, u_short length) SET_FLAG(ptm_cb.client_flags[client->proto], ZEBRA_PTM_BFD_CLIENT_FLAG_REG); - return 0; + return; stream_failure: /* @@ -1013,7 +1009,7 @@ stream_failure: * if (out_ctxt) * ptm_lib_cleanup_msg(ptm_hdl, out_ctxt); */ - return 0; + return; } /* BFD client deregister */ diff --git a/zebra/zebra_ptm.h b/zebra/zebra_ptm.h index 392853b59..0b41410be 100644 --- a/zebra/zebra_ptm.h +++ b/zebra/zebra_ptm.h @@ -28,6 +28,8 @@ extern const char ZEBRA_PTM_SOCK_NAME[]; #define ZEBRA_PTM_BFD_CLIENT_FLAG_REG (1 << 1) /* client registered with BFD */ +#include "zebra/zserv.h" + /* Zebra ptm context block */ struct zebra_ptm_cb { int ptm_sock; /* ptm file descriptor. */ @@ -62,12 +64,12 @@ int zebra_ptm_connect(struct thread *t); void zebra_ptm_write(struct vty *vty); int zebra_ptm_get_enable_state(void); -int zebra_ptm_bfd_dst_register(struct zserv *client, u_short length, - int command, struct zebra_vrf *zvrf); -int zebra_ptm_bfd_dst_deregister(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); +/* ZAPI message handlers */ +void zebra_ptm_bfd_dst_register(ZAPI_HANDLER_ARGS); +void zebra_ptm_bfd_dst_deregister(ZAPI_HANDLER_ARGS); +void zebra_ptm_bfd_client_register(ZAPI_HANDLER_ARGS); + void zebra_ptm_show_status(struct vty *vty, struct interface *ifp); -int zebra_ptm_bfd_client_register(struct zserv *client, u_short length); void zebra_ptm_if_init(struct zebra_if *zebra_ifp); void zebra_ptm_if_set_ptm_state(struct interface *ifp, struct zebra_if *zebra_ifp); diff --git a/zebra/zebra_ptm_redistribute.c b/zebra/zebra_ptm_redistribute.c index 8fddd400c..fe788ac4d 100644 --- a/zebra/zebra_ptm_redistribute.c +++ b/zebra/zebra_ptm_redistribute.c @@ -38,8 +38,7 @@ static int zsend_interface_bfd_update(int cmd, struct zserv *client, if (!client->ifinfo) return 0; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, vrf_id); if (ifp) @@ -66,7 +65,7 @@ static int zsend_interface_bfd_update(int cmd, struct zserv *client, stream_putw_at(s, 0, stream_get_endp(s)); client->if_bfd_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } void zebra_interface_bfd_update(struct interface *ifp, struct prefix *dp, @@ -93,8 +92,7 @@ static int zsend_bfd_peer_replay(int cmd, struct zserv *client) { struct stream *s; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, VRF_DEFAULT); @@ -102,7 +100,7 @@ static int zsend_bfd_peer_replay(int cmd, struct zserv *client) stream_putw_at(s, 0, stream_get_endp(s)); client->bfd_peer_replay_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } void zebra_bfd_peer_replay_req(void) diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 45b07e003..b97903770 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -305,6 +305,8 @@ struct nexthop *route_entry_nexthop_ipv6_ifindex_add(struct route_entry *re, nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX; nexthop->gate.ipv6 = *ipv6; nexthop->ifindex = ifindex; + if (CHECK_FLAG(re->flags, ZEBRA_FLAG_EVPN_ROUTE)) + SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ONLINK); route_entry_nexthop_add(re, nexthop); @@ -421,6 +423,10 @@ static int nexthop_active(afi_t afi, struct route_entry *re, re->nexthop_mtu = 0; } + /* Next hops (remote VTEPs) for EVPN routes are fully resolved. */ + if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP)) + return 1; + /* Skip nexthops that have been filtered out due to route-map */ /* The nexthops are specific to this route and so the same */ /* nexthop for a different route may not have this flag set */ @@ -859,9 +865,7 @@ static unsigned nexthop_active_check(struct route_node *rn, case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4_IFINDEX: family = AFI_IP; - if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_EVPN_RVTEP)) - SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); - else if (nexthop_active(AFI_IP, re, nexthop, set, rn)) + if (nexthop_active(AFI_IP, re, nexthop, set, rn)) SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); else UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); @@ -2555,10 +2559,17 @@ void rib_delete(afi_t afi, safi_t safi, vrf_id_t vrf_id, int type, struct ipaddr vtep_ip; memset(&vtep_ip, 0, sizeof(struct ipaddr)); - vtep_ip.ipa_type = IPADDR_V4; - memcpy(&(vtep_ip.ipaddr_v4), - &(tmp_nh->gate.ipv4), - sizeof(struct in_addr)); + if (afi == AFI_IP) { + vtep_ip.ipa_type = IPADDR_V4; + memcpy(&(vtep_ip.ipaddr_v4), + &(tmp_nh->gate.ipv4), + sizeof(struct in_addr)); + } else { + vtep_ip.ipa_type = IPADDR_V6; + memcpy(&(vtep_ip.ipaddr_v6), + &(tmp_nh->gate.ipv6), + sizeof(struct in6_addr)); + } zebra_vxlan_evpn_vrf_route_del(re->vrf_id, rmac, &vtep_ip, p); } diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c index dd3fe1770..c9fb782ba 100644 --- a/zebra/zebra_rnh.c +++ b/zebra/zebra_rnh.c @@ -995,8 +995,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, re = rnh->state; /* Get output stream. */ - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, vrf_id); @@ -1063,7 +1062,7 @@ static int send_client(struct rnh *rnh, struct zserv *client, rnh_type_t type, client->nh_last_upd_time = monotime(NULL); client->last_write_cmd = cmd; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } static void print_nh(struct nexthop *nexthop, struct vty *vty) diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c index 9e13f4ed6..f7877f71b 100644 --- a/zebra/zebra_vrf.c +++ b/zebra/zebra_vrf.c @@ -39,6 +39,7 @@ #include "zebra/interface.h" #include "zebra/zebra_mpls.h" #include "zebra/zebra_vxlan.h" +#include "zebra/zebra_netns_notify.h" extern struct zebra_t zebrad; @@ -161,6 +162,12 @@ static int zebra_vrf_enable(struct vrf *vrf) } } + /* + * We may have static routes that are now possible to + * insert into the appropriate tables + */ + static_config_install_delayed_routes(zvrf); + /* Kick off any VxLAN-EVPN processing. */ zebra_vxlan_vrf_enable(zvrf); @@ -568,7 +575,6 @@ static int vrf_config_write(struct vty *vty) ? " prefix-routes-only" : ""); zebra_ns_config_write(vty, (struct ns *)vrf->ns_ctxt); - vty_out(vty, "!\n"); } static_config(vty, zvrf, AFI_IP, SAFI_UNICAST, "ip route"); @@ -587,5 +593,5 @@ void zebra_vrf_init(void) vrf_init(zebra_vrf_new, zebra_vrf_enable, zebra_vrf_disable, zebra_vrf_delete); - vrf_cmd_init(vrf_config_write); + vrf_cmd_init(vrf_config_write, &zserv_privs); } diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 9fe3c707b..32d5286d5 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -29,6 +29,7 @@ #include "rib.h" #include "nexthop.h" #include "vrf.h" +#include "linklist.h" #include "mpls.h" #include "routemap.h" #include "srcdest_table.h" @@ -76,7 +77,186 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty, /* VNI range as per RFC 7432 */ #define CMD_VNI_RANGE "(1-16777215)" +struct static_hold_route { + char *vrf_name; + char *nhvrf_name; + afi_t afi; + safi_t safi; + char *dest_str; + char *mask_str; + char *src_str; + char *gate_str; + char *ifname; + char *flag_str; + char *tag_str; + char *distance_str; + char *label_str; +}; + +static struct list *static_list; + +static int static_list_compare_helper(const char *s1, const char *s2) +{ + /* Are Both NULL */ + if (s1 == s2) + return 0; + + if (!s1 && s2) + return -1; + + if (s1 && !s2) + return 1; + + return strcmp(s1, s2); +} + +static void static_list_delete(struct static_hold_route *shr) +{ + if (shr->vrf_name) + XFREE(MTYPE_STATIC_ROUTE, shr->vrf_name); + if (shr->nhvrf_name) + XFREE(MTYPE_STATIC_ROUTE, shr->nhvrf_name); + if (shr->dest_str) + XFREE(MTYPE_STATIC_ROUTE, shr->dest_str); + if (shr->mask_str) + XFREE(MTYPE_STATIC_ROUTE, shr->mask_str); + if (shr->src_str) + XFREE(MTYPE_STATIC_ROUTE, shr->src_str); + if (shr->gate_str) + XFREE(MTYPE_STATIC_ROUTE, shr->gate_str); + if (shr->ifname) + XFREE(MTYPE_STATIC_ROUTE, shr->ifname); + if (shr->flag_str) + XFREE(MTYPE_STATIC_ROUTE, shr->flag_str); + if (shr->tag_str) + XFREE(MTYPE_STATIC_ROUTE, shr->tag_str); + if (shr->distance_str) + XFREE(MTYPE_STATIC_ROUTE, shr->distance_str); + if (shr->label_str) + XFREE(MTYPE_STATIC_ROUTE, shr->label_str); + + XFREE(MTYPE_STATIC_ROUTE, shr); +} + +static int static_list_compare(void *arg1, void *arg2) +{ + struct static_hold_route *shr1 = arg1; + struct static_hold_route *shr2 = arg2; + int ret; + + ret = strcmp(shr1->vrf_name, shr2->vrf_name); + if (ret) + return ret; + + ret = strcmp(shr2->nhvrf_name, shr2->nhvrf_name); + if (ret) + return ret; + + ret = shr1->afi - shr2->afi; + if (ret) + return ret; + + ret = shr1->safi - shr2->afi; + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->dest_str, shr2->dest_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->mask_str, shr2->mask_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->src_str, shr2->src_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->gate_str, shr2->gate_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->ifname, shr2->ifname); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->flag_str, shr2->flag_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->tag_str, shr2->tag_str); + if (ret) + return ret; + + ret = static_list_compare_helper(shr1->distance_str, + shr2->distance_str); + if (ret) + return ret; + + return static_list_compare_helper(shr1->label_str, shr2->label_str); +} + + /* General function for static route. */ +static int zebra_static_route_holdem(struct zebra_vrf *zvrf, + struct zebra_vrf *nh_zvrf, + afi_t afi, safi_t safi, + const char *negate, const char *dest_str, + const char *mask_str, const char *src_str, + const char *gate_str, const char *ifname, + const char *flag_str, const char *tag_str, + const char *distance_str, + const char *label_str) +{ + struct static_hold_route *shr, *lookup; + struct listnode *node; + + shr = XCALLOC(MTYPE_STATIC_ROUTE, sizeof(*shr)); + shr->vrf_name = XSTRDUP(MTYPE_STATIC_ROUTE, zvrf->vrf->name); + shr->nhvrf_name = XSTRDUP(MTYPE_STATIC_ROUTE, nh_zvrf->vrf->name); + shr->afi = afi; + shr->safi = safi; + if (dest_str) + shr->dest_str = XSTRDUP(MTYPE_STATIC_ROUTE, dest_str); + if (mask_str) + shr->mask_str = XSTRDUP(MTYPE_STATIC_ROUTE, mask_str); + if (src_str) + shr->src_str = XSTRDUP(MTYPE_STATIC_ROUTE, src_str); + if (gate_str) + shr->gate_str = XSTRDUP(MTYPE_STATIC_ROUTE, gate_str); + if (ifname) + shr->ifname = XSTRDUP(MTYPE_STATIC_ROUTE, ifname); + if (flag_str) + shr->flag_str = XSTRDUP(MTYPE_STATIC_ROUTE, flag_str); + if (tag_str) + shr->tag_str = XSTRDUP(MTYPE_STATIC_ROUTE, tag_str); + if (distance_str) + shr->distance_str = XSTRDUP(MTYPE_STATIC_ROUTE, distance_str); + if (label_str) + shr->label_str = XSTRDUP(MTYPE_STATIC_ROUTE, label_str); + + for (ALL_LIST_ELEMENTS_RO(static_list, node, lookup)) { + if (static_list_compare(shr, lookup) == 0) + break; + } + + if (lookup) { + if (negate) { + listnode_delete(static_list, lookup); + static_list_delete(shr); + static_list_delete(lookup); + + return CMD_SUCCESS; + } + + assert(!"We should not have found a duplicate and not remove it"); + } + + listnode_add_sort(static_list, shr); + + return CMD_SUCCESS; +} + static int zebra_static_route_leak( struct vty *vty, struct zebra_vrf *zvrf, struct zebra_vrf *nh_zvrf, afi_t afi, safi_t safi, const char *negate, const char *dest_str, @@ -98,17 +278,34 @@ static int zebra_static_route_leak( ret = str2prefix(dest_str, &p); if (ret <= 0) { - vty_out(vty, "%% Malformed address\n"); + if (vty) + vty_out(vty, "%% Malformed address\n"); + else + zlog_warn("%s: Malformed address: %s", + __PRETTY_FUNCTION__, dest_str); return CMD_WARNING_CONFIG_FAILED; } + if (zvrf->vrf->vrf_id == VRF_UNKNOWN + || nh_zvrf->vrf->vrf_id == VRF_UNKNOWN) { + vrf_set_user_cfged(zvrf->vrf); + return zebra_static_route_holdem( + zvrf, nh_zvrf, afi, safi, negate, dest_str, mask_str, + src_str, gate_str, ifname, flag_str, tag_str, + distance_str, label_str); + } switch (afi) { case AFI_IP: /* Cisco like mask notation. */ if (mask_str) { ret = inet_aton(mask_str, &mask); if (ret == 0) { - vty_out(vty, "%% Malformed address\n"); + if (vty) + vty_out(vty, "%% Malformed address\n"); + else + zlog_warn("%s: Malformed address: %s", + __PRETTY_FUNCTION__, + mask_str); return CMD_WARNING_CONFIG_FAILED; } p.prefixlen = ip_masklen(mask); @@ -119,7 +316,13 @@ static int zebra_static_route_leak( if (src_str) { ret = str2prefix(src_str, &src); if (ret <= 0 || src.family != AF_INET6) { - vty_out(vty, "%% Malformed source address\n"); + if (vty) + vty_out(vty, + "%% Malformed source address\n"); + else + zlog_warn( + "%s: Malformed Source address: %s", + __PRETTY_FUNCTION__, src_str); return CMD_WARNING_CONFIG_FAILED; } src_p = (struct prefix_ipv6 *)&src; @@ -146,8 +349,13 @@ static int zebra_static_route_leak( memset(&snh_label, 0, sizeof(struct static_nh_label)); if (label_str) { if (!mpls_enabled) { - vty_out(vty, - "%% MPLS not turned on in kernel, ignoring command\n"); + if (vty) + vty_out(vty, + "%% MPLS not turned on in kernel, ignoring command\n"); + else + zlog_warn( + "%s: MPLS not turned on in kernel ignoring static route to %s", + __PRETTY_FUNCTION__, dest_str); return CMD_WARNING_CONFIG_FAILED; } int rc = mpls_str2label(label_str, &snh_label.num_labels, @@ -155,18 +363,37 @@ static int zebra_static_route_leak( if (rc < 0) { switch (rc) { case -1: - vty_out(vty, "%% Malformed label(s)\n"); + if (vty) + vty_out(vty, "%% Malformed label(s)\n"); + else + zlog_warn( + "%s: Malformed labels specified for route %s", + __PRETTY_FUNCTION__, dest_str); break; case -2: - vty_out(vty, - "%% Cannot use reserved label(s) (%d-%d)\n", - MPLS_LABEL_RESERVED_MIN, - MPLS_LABEL_RESERVED_MAX); + if (vty) + vty_out(vty, + "%% Cannot use reserved label(s) (%d-%d)\n", + MPLS_LABEL_RESERVED_MIN, + MPLS_LABEL_RESERVED_MAX); + else + zlog_warn( + "%s: Cannot use reserved labels (%d-%d) for %s", + __PRETTY_FUNCTION__, + MPLS_LABEL_RESERVED_MIN, + MPLS_LABEL_RESERVED_MAX, + dest_str); break; case -3: - vty_out(vty, - "%% Too many labels. Enter %d or fewer\n", - MPLS_MAX_LABELS); + if (vty) + vty_out(vty, + "%% Too many labels. Enter %d or fewer\n", + MPLS_MAX_LABELS); + else + zlog_warn( + "%s: Too many labels, Enter %d or fewer for %s", + __PRETTY_FUNCTION__, + MPLS_MAX_LABELS, dest_str); break; } return CMD_WARNING_CONFIG_FAILED; @@ -178,8 +405,13 @@ static int zebra_static_route_leak( if (strncasecmp(ifname, "Null0", strlen(ifname)) == 0 || strncasecmp(ifname, "reject", strlen(ifname)) == 0 || strncasecmp(ifname, "blackhole", strlen(ifname)) == 0) { - vty_out(vty, - "%% Nexthop interface cannot be Null0, reject or blackhole\n"); + if (vty) + vty_out(vty, + "%% Nexthop interface cannot be Null0, reject or blackhole\n"); + else + zlog_warn( + "%s: Nexthop interface cannot be Null0, reject or blackhole for %s", + __PRETTY_FUNCTION__, dest_str); return CMD_WARNING_CONFIG_FAILED; } } @@ -197,15 +429,28 @@ static int zebra_static_route_leak( bh_type = STATIC_BLACKHOLE_NULL; break; default: - vty_out(vty, "%% Malformed flag %s \n", flag_str); + if (vty) + vty_out(vty, "%% Malformed flag %s \n", + flag_str); + else + zlog_warn("%s: Malformed flag %s for %s", + __PRETTY_FUNCTION__, flag_str, + dest_str); return CMD_WARNING_CONFIG_FAILED; } } if (gate_str) { if (inet_pton(afi2family(afi), gate_str, &gate) != 1) { - vty_out(vty, "%% Malformed nexthop address %s\n", - gate_str); + if (vty) + vty_out(vty, + "%% Malformed nexthop address %s\n", + gate_str); + else + zlog_warn( + "%s: Malformed nexthop address %s for %s", + __PRETTY_FUNCTION__, gate_str, + dest_str); return CMD_WARNING_CONFIG_FAILED; } gatep = &gate; @@ -287,7 +532,38 @@ static int zebra_static_route(struct vty *vty, afi_t afi, safi_t safi, gate_str, ifname, flag_str, tag_str, distance_str, label_str); } +void static_config_install_delayed_routes(struct zebra_vrf *zvrf) +{ + struct listnode *node, *nnode; + struct static_hold_route *shr; + struct zebra_vrf *ozvrf, *nh_zvrf; + int installed; + + for (ALL_LIST_ELEMENTS(static_list, node, nnode, shr)) { + ozvrf = zebra_vrf_lookup_by_name(shr->vrf_name); + nh_zvrf = zebra_vrf_lookup_by_name(shr->nhvrf_name); + + if (ozvrf != zvrf && nh_zvrf != zvrf) + continue; + + if (ozvrf->vrf->vrf_id == VRF_UNKNOWN + || nh_zvrf->vrf->vrf_id == VRF_UNKNOWN) + continue; + installed = zebra_static_route_leak( + NULL, ozvrf, nh_zvrf, shr->afi, shr->safi, NULL, + shr->dest_str, shr->mask_str, shr->src_str, + shr->gate_str, shr->ifname, shr->flag_str, shr->tag_str, + shr->distance_str, shr->label_str); + + if (installed != CMD_SUCCESS) + zlog_debug( + "%s: Attempt to install %s as a route and it was rejected", + __PRETTY_FUNCTION__, shr->dest_str); + listnode_delete(static_list, shr); + static_list_delete(shr); + } +} /* Static unicast routes for multicast RPF lookup. */ DEFPY (ip_mroute_dist, ip_mroute_dist_cmd, @@ -1894,6 +2170,8 @@ static void vty_show_ip_route_summary_prefix(struct vty *vty, int static_config(struct vty *vty, struct zebra_vrf *zvrf, afi_t afi, safi_t safi, const char *cmd) { + struct static_hold_route *shr; + struct listnode *node; char spacing[100]; struct route_node *rn; struct static_route *si; @@ -1907,6 +2185,40 @@ int static_config(struct vty *vty, struct zebra_vrf *zvrf, afi_t afi, sprintf(spacing, "%s%s", (zvrf->vrf->vrf_id == VRF_DEFAULT) ? "" : " ", cmd); + /* + * Static routes for vrfs not fully inited + */ + for (ALL_LIST_ELEMENTS_RO(static_list, node, shr)) { + if (shr->afi != afi || shr->safi != safi) + continue; + + if (strcmp(zvrf->vrf->name, shr->vrf_name) != 0) + continue; + + vty_out(vty, "%s ", spacing); + if (shr->dest_str) + vty_out(vty, "%s ", shr->dest_str); + if (shr->mask_str) + vty_out(vty, "%s ", shr->mask_str); + if (shr->src_str) + vty_out(vty, "from %s ", shr->src_str); + if (shr->gate_str) + vty_out(vty, "%s ", shr->gate_str); + if (shr->ifname) + vty_out(vty, "%s ", shr->ifname); + if (shr->flag_str) + vty_out(vty, "%s ", shr->flag_str); + if (shr->tag_str) + vty_out(vty, "tag %s", shr->tag_str); + if (shr->distance_str) + vty_out(vty, "%s ", shr->distance_str); + if (shr->label_str) + vty_out(vty, "label %s ", shr->label_str); + if (strcmp(shr->vrf_name, shr->nhvrf_name) != 0) + vty_out(vty, "nexthop-vrf %s", shr->nhvrf_name); + vty_out(vty, "\n"); + } + for (rn = route_top(stable); rn; rn = srcdest_route_next(rn)) for (si = rn->info; si; si = si->next) { vty_out(vty, "%s %s", spacing, @@ -3409,4 +3721,8 @@ void zebra_vty_init(void) install_element(CONFIG_NODE, &no_default_vrf_vni_mapping_cmd); install_element(VRF_NODE, &vrf_vni_mapping_cmd); install_element(VRF_NODE, &no_vrf_vni_mapping_cmd); + + static_list = list_new(); + static_list->cmp = (int (*)(void *, void *))static_list_compare; + static_list->del = (void (*)(void *))static_list_delete; } diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c index d3ede66fb..256fa9e4b 100644 --- a/zebra/zebra_vxlan.c +++ b/zebra/zebra_vxlan.c @@ -1157,8 +1157,7 @@ static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, if (!client) return 0; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, VRF_DEFAULT); stream_putl(s, vni); @@ -1195,7 +1194,7 @@ static int zvni_macip_send_msg_to_client(vni_t vni, struct ethaddr *macaddr, else client->macipdel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* @@ -2565,8 +2564,7 @@ static int zvni_send_add_to_client(zebra_vni_t *zvni) if (!client) return 0; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_VNI_ADD, VRF_DEFAULT); stream_putl(s, zvni->vni); @@ -2583,7 +2581,7 @@ static int zvni_send_add_to_client(zebra_vni_t *zvni) zebra_route_string(client->proto)); client->vniadd_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* @@ -2599,7 +2597,7 @@ static int zvni_send_del_to_client(vni_t vni) if (!client) return 0; - s = client->obuf; + s = stream_new(ZEBRA_MAX_PACKET_SIZ); stream_reset(s); zclient_create_header(s, ZEBRA_VNI_DEL, VRF_DEFAULT); @@ -2613,7 +2611,7 @@ static int zvni_send_del_to_client(vni_t vni) zebra_route_string(client->proto)); client->vnidel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* @@ -3550,8 +3548,7 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) memset(&rmac, 0, sizeof(struct ethaddr)); zl3vni_get_rmac(zl3vni, &rmac); - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_L3VNI_ADD, zl3vni_vrf_id(zl3vni)); stream_putl(s, zl3vni->vni); @@ -3574,7 +3571,7 @@ static int zl3vni_send_add_to_client(zebra_l3vni_t *zl3vni) zebra_route_string(client->proto)); client->l3vniadd_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* @@ -3590,8 +3587,7 @@ static int zl3vni_send_del_to_client(zebra_l3vni_t *zl3vni) if (!client) return 0; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_L3VNI_DEL, zl3vni_vrf_id(zl3vni)); stream_putl(s, zl3vni->vni); @@ -3605,7 +3601,7 @@ static int zl3vni_send_del_to_client(zebra_l3vni_t *zl3vni) zebra_route_string(client->proto)); client->l3vnidel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } static void zebra_vxlan_process_l3vni_oper_up(zebra_l3vni_t *zl3vni) @@ -3723,8 +3719,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p, if (!client) return 0; - s = client->obuf; - stream_reset(s); + s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, vrf_id); stream_put(s, p, sizeof(struct prefix)); @@ -3743,7 +3738,7 @@ static int ip_prefix_send_to_client(vrf_id_t vrf_id, struct prefix *p, else client->prefixdel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* re-add remote rmac if needed */ @@ -4863,8 +4858,7 @@ int zebra_vxlan_local_neigh_add_update(struct interface *ifp, /* * Handle message from client to delete a remote MACIP for a VNI. */ -int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS) { struct stream *s; vni_t vni; @@ -4884,9 +4878,9 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length, memset(&ip, 0, sizeof(struct ipaddr)); memset(&vtep_ip, 0, sizeof(struct in_addr)); - s = client->ibuf; + s = msg; - while (l < length) { + while (l < hdr->length) { /* Obtain each remote MACIP and process. */ /* Message contains VNI, followed by MAC followed by IP (if any) * followed by remote VTEP IP. @@ -5008,7 +5002,7 @@ int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* @@ -5016,8 +5010,7 @@ stream_failure: * could be just the add of a MAC address or the add of a neighbor * (IP+MAC). */ -int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS) { struct stream *s; vni_t vni; @@ -5045,12 +5038,12 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, zlog_warn( "%s: EVPN Not turned on yet we have received a remote_macip add zapi callback", __PRETTY_FUNCTION__); - return -1; + return; } - s = client->ibuf; + s = msg; - while (l < length) { + while (l < hdr->length) { /* Obtain each remote MACIP and process. */ /* Message contains VNI, followed by MAC followed by IP (if any) * followed by remote VTEP IP. @@ -5159,7 +5152,7 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, prefix_mac2str(&macaddr, buf, sizeof(buf)), vni, inet_ntoa(vtep_ip)); - return -1; + return; } /* Is this MAC created for a MACIP? */ @@ -5212,7 +5205,7 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, prefix_mac2str(&macaddr, buf, sizeof(buf)), vni, inet_ntoa(vtep_ip)); - return -1; + return; } } else if (memcmp(&n->emac, &macaddr, sizeof(macaddr)) @@ -5240,7 +5233,7 @@ int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* @@ -5543,8 +5536,7 @@ int zebra_vxlan_local_mac_add_update(struct interface *ifp, /* * Handle message from client to delete a remote VTEP for a VNI. */ -int zebra_vxlan_remote_vtep_del(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS) { struct stream *s; u_short l = 0; @@ -5559,18 +5551,18 @@ int zebra_vxlan_remote_vtep_del(struct zserv *client, u_short length, zlog_warn( "%s: EVPN is not enabled yet we have received a vtep del command", __PRETTY_FUNCTION__); - return -1; + return; } if (zvrf_id(zvrf) != VRF_DEFAULT) { zlog_err("Recv MACIP DEL for non-default VRF %u", zvrf_id(zvrf)); - return -1; + return; } - s = client->ibuf; + s = msg; - while (l < length) { + while (l < hdr->length) { /* Obtain each remote VTEP and process. */ STREAM_GETL(s, vni); l += 4; @@ -5623,14 +5615,13 @@ int zebra_vxlan_remote_vtep_del(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* * Handle message from client to add a remote VTEP for a VNI. */ -int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS) { struct stream *s; u_short l = 0; @@ -5644,18 +5635,18 @@ int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length, zlog_warn( "%s: EVPN not enabled yet we received a vtep_add zapi call", __PRETTY_FUNCTION__); - return -1; + return; } if (zvrf_id(zvrf) != VRF_DEFAULT) { zlog_err("Recv MACIP ADD for non-default VRF %u", zvrf_id(zvrf)); - return -1; + return; } - s = client->ibuf; + s = msg; - while (l < length) { + while (l < hdr->length) { /* Obtain each remote VTEP and process. */ STREAM_GETL(s, vni); l += 4; @@ -5705,7 +5696,7 @@ int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* @@ -6512,8 +6503,7 @@ int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf) * Handle message from client to enable/disable advertisement of g/w macip * routes */ -int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS) { struct stream *s; int advertise; @@ -6527,19 +6517,19 @@ int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length, if (zvrf_id(zvrf) != VRF_DEFAULT) { zlog_err("EVPN GW-MACIP Adv for non-default VRF %u", zvrf_id(zvrf)); - return -1; + return; } - s = client->ibuf; + s = msg; advertise = stream_getc(s); vni = stream_get3(s); zvni = zvni_lookup(vni); if (!zvni) - return 0; + return; if (zvni->advertise_subnet == advertise) - return 0; + return; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug("EVPN subnet Adv %s on VNI %d , currently %s", @@ -6551,35 +6541,32 @@ int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length, ifp = zvni->vxlan_if; if (!ifp) - return 0; + return; zif = ifp->info; /* If down or not mapped to a bridge, we're done. */ if (!if_is_operative(ifp) || !zif->brslave_info.br_if) - return 0; + return; zl2_info = zif->l2info.vxl; vlan_if = zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if); if (!vlan_if) - return 0; + return; if (zvni->advertise_subnet) zvni_advertise_subnet(zvni, vlan_if, 1); else zvni_advertise_subnet(zvni, vlan_if, 0); - - return 0; } /* * Handle message from client to enable/disable advertisement of g/w macip * routes */ -int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS) { struct stream *s; int advertise; @@ -6590,10 +6577,10 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, if (zvrf_id(zvrf) != VRF_DEFAULT) { zlog_err("EVPN GW-MACIP Adv for non-default VRF %u", zvrf_id(zvrf)); - return -1; + return; } - s = client->ibuf; + s = msg; STREAM_GETC(s, advertise); STREAM_GET(&vni, s, 3); @@ -6606,7 +6593,7 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, : "disabled"); if (zvrf->advertise_gw_macip == advertise) - return 0; + return; zvrf->advertise_gw_macip = advertise; @@ -6625,7 +6612,7 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, zvni = zvni_lookup(vni); if (!zvni) - return 0; + return; if (IS_ZEBRA_DEBUG_VXLAN) zlog_debug( @@ -6635,26 +6622,26 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, : "disabled"); if (zvni->advertise_gw_macip == advertise) - return 0; + return; zvni->advertise_gw_macip = advertise; ifp = zvni->vxlan_if; if (!ifp) - return 0; + return; zif = ifp->info; /* If down or not mapped to a bridge, we're done. */ if (!if_is_operative(ifp) || !zif->brslave_info.br_if) - return 0; + return; zl2_info = zif->l2info.vxl; vlan_if = zvni_map_to_svi(zl2_info.access_vlan, zif->brslave_info.br_if); if (!vlan_if) - return 0; + return; if (advertise_gw_macip_enabled(zvni)) { /* Add primary SVI MAC-IP */ @@ -6676,7 +6663,7 @@ int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } @@ -6686,8 +6673,7 @@ stream_failure: * when disabled, the entries should be deleted and remote VTEPs and MACs * uninstalled from the kernel. */ -int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS) { struct stream *s = NULL; int advertise = 0; @@ -6695,10 +6681,10 @@ int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length, if (zvrf_id(zvrf) != VRF_DEFAULT) { zlog_err("EVPN VNI Adv for non-default VRF %u", zvrf_id(zvrf)); - return -1; + return; } - s = client->ibuf; + s = msg; STREAM_GETC(s, advertise); if (IS_ZEBRA_DEBUG_VXLAN) @@ -6707,7 +6693,7 @@ int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length, is_evpn_enabled() ? "enabled" : "disabled"); if (zvrf->advertise_all_vni == advertise) - return 0; + return; zvrf->advertise_all_vni = advertise; if (is_evpn_enabled()) { @@ -6732,13 +6718,13 @@ int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length, /* cleanup all l3vnis */ zns = zebra_ns_lookup(NS_DEFAULT); if (!zns) - return -1; + return; hash_iterate(zns->l3vni_table, zl3vni_cleanup_all, NULL); } stream_failure: - return 0; + return; } /* diff --git a/zebra/zebra_vxlan.h b/zebra/zebra_vxlan.h index 7abf0050f..6f25ad1e2 100644 --- a/zebra/zebra_vxlan.h +++ b/zebra/zebra_vxlan.h @@ -33,6 +33,7 @@ #include "lib/json.h" #include "zebra/zebra_vrf.h" +#include "zebra/zserv.h" /* Is EVPN enabled? */ #define EVPN_ENABLED(zvrf) (zvrf)->advertise_all_vni @@ -51,6 +52,15 @@ static inline int is_evpn_enabled() #define VNI_STR_LEN 32 +/* ZAPI message handlers */ +extern void zebra_vxlan_remote_macip_add(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_remote_macip_del(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_remote_vtep_add(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_remote_vtep_del(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_advertise_subnet(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_advertise_gw_macip(ZAPI_HANDLER_ARGS); +extern void zebra_vxlan_advertise_all_vni(ZAPI_HANDLER_ARGS); + extern int is_l3vni_for_prefix_routes_only(vni_t vni); extern ifindex_t get_l3vni_svi_ifindex(vrf_id_t vrf_id); extern int zebra_vxlan_vrf_delete(struct zebra_vrf *zvrf); @@ -117,10 +127,6 @@ extern int zebra_vxlan_local_neigh_add_update( extern int zebra_vxlan_local_neigh_del(struct interface *ifp, struct interface *link_if, struct ipaddr *ip); -extern int zebra_vxlan_remote_macip_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); -extern int zebra_vxlan_remote_macip_del(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); extern int zebra_vxlan_local_mac_add_update(struct interface *ifp, struct interface *br_if, struct ethaddr *mac, vlanid_t vid, @@ -140,16 +146,6 @@ extern int zebra_vxlan_if_down(struct interface *ifp); extern int zebra_vxlan_if_add(struct interface *ifp); extern int zebra_vxlan_if_update(struct interface *ifp, u_int16_t chgflags); extern int zebra_vxlan_if_del(struct interface *ifp); -extern int zebra_vxlan_remote_vtep_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); -extern int zebra_vxlan_remote_vtep_del(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); -extern int zebra_vxlan_advertise_subnet(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); -extern int zebra_vxlan_advertise_gw_macip(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); -extern int zebra_vxlan_advertise_all_vni(struct zserv *client, u_short length, - struct zebra_vrf *zvrf); extern int zebra_vxlan_process_vrf_vni_cmd(struct zebra_vrf *zvrf, vni_t vni, char *err, int err_str_sz, int filter, int add); diff --git a/zebra/zserv.c b/zebra/zserv.c index 54e688ebc..2f2c09112 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -63,94 +63,23 @@ #include "zebra/zebra_pbr.h" /* Event list of zebra. */ -enum event { ZEBRA_SERV, ZEBRA_READ, ZEBRA_WRITE }; - -static void zebra_event(enum event event, int sock, struct zserv *client); - +enum event { ZEBRA_READ, ZEBRA_WRITE }; +/* privileges */ extern struct zebra_privs_t zserv_privs; +/* post event into client */ +static void zebra_event(struct zserv *client, enum event event); -static void zebra_client_close(struct zserv *client); -static int zserv_delayed_close(struct thread *thread) -{ - struct zserv *client = THREAD_ARG(thread); +/* Public interface ======================================================== */ - client->t_suicide = NULL; - zebra_client_close(client); - return 0; -} - -static int zserv_flush_data(struct thread *thread) +int zebra_server_send_message(struct zserv *client, struct stream *msg) { - struct zserv *client = THREAD_ARG(thread); - - client->t_write = NULL; - if (client->t_suicide) { - zebra_client_close(client); - return -1; - } - switch (buffer_flush_available(client->wb, client->sock)) { - case BUFFER_ERROR: - zlog_warn( - "%s: buffer_flush_available failed on zserv client fd %d, " - "closing", - __func__, client->sock); - zebra_client_close(client); - client = NULL; - break; - case BUFFER_PENDING: - client->t_write = NULL; - thread_add_write(zebrad.master, zserv_flush_data, client, - client->sock, &client->t_write); - break; - case BUFFER_EMPTY: - break; - } - - if (client) - client->last_write_time = monotime(NULL); + stream_fifo_push(client->obuf_fifo, msg); + zebra_event(client, ZEBRA_WRITE); return 0; } -int zebra_server_send_message(struct zserv *client) -{ - if (client->t_suicide) - return -1; - - if (client->is_synchronous) - return 0; - - stream_set_getp(client->obuf, 0); - client->last_write_cmd = stream_getw_from(client->obuf, 6); - switch (buffer_write(client->wb, client->sock, - STREAM_DATA(client->obuf), - stream_get_endp(client->obuf))) { - case BUFFER_ERROR: - zlog_warn( - "%s: buffer_write failed to zserv client fd %d, closing", - __func__, client->sock); - /* Schedule a delayed close since many of the functions that - call this - one do not check the return code. They do not allow for the - possibility that an I/O error may have caused the client to - be - deleted. */ - client->t_suicide = NULL; - thread_add_event(zebrad.master, zserv_delayed_close, client, 0, - &client->t_suicide); - return -1; - case BUFFER_EMPTY: - THREAD_OFF(client->t_write); - break; - case BUFFER_PENDING: - thread_add_write(zebrad.master, zserv_flush_data, client, - client->sock, &client->t_write); - break; - } - - client->last_write_time = monotime(NULL); - return 0; -} +/* Encoding helpers -------------------------------------------------------- */ static void zserv_encode_interface(struct stream *s, struct interface *ifp) { @@ -202,6 +131,34 @@ static void zserv_encode_vrf(struct stream *s, struct zebra_vrf *zvrf) stream_putw_at(s, 0, stream_get_endp(s)); } +static int zserv_encode_nexthop(struct stream *s, struct nexthop *nexthop) +{ + stream_putc(s, nexthop->type); + switch (nexthop->type) { + case NEXTHOP_TYPE_IPV4: + case NEXTHOP_TYPE_IPV4_IFINDEX: + stream_put_in_addr(s, &nexthop->gate.ipv4); + stream_putl(s, nexthop->ifindex); + break; + case NEXTHOP_TYPE_IPV6: + stream_put(s, &nexthop->gate.ipv6, 16); + break; + case NEXTHOP_TYPE_IPV6_IFINDEX: + stream_put(s, &nexthop->gate.ipv6, 16); + stream_putl(s, nexthop->ifindex); + break; + case NEXTHOP_TYPE_IFINDEX: + stream_putl(s, nexthop->ifindex); + break; + default: + /* do nothing */ + break; + } + return 1; +} + +/* Send handlers ----------------------------------------------------------- */ + /* Interface is added. Send ZEBRA_INTERFACE_ADD to client. */ /* * This function is called in the following situations: @@ -215,65 +172,54 @@ static void zserv_encode_vrf(struct stream *s, struct zebra_vrf *zvrf) */ int zsend_interface_add(struct zserv *client, struct interface *ifp) { - struct stream *s; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf_id); zserv_encode_interface(s, ifp); client->ifadd_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* Interface deletion from zebra daemon. */ int zsend_interface_delete(struct zserv *client, struct interface *ifp) { - struct stream *s; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf_id); zserv_encode_interface(s, ifp); client->ifdel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } int zsend_vrf_add(struct zserv *client, struct zebra_vrf *zvrf) { - struct stream *s; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_VRF_ADD, zvrf_id(zvrf)); zserv_encode_vrf(s, zvrf); client->vrfadd_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* VRF deletion from zebra daemon. */ int zsend_vrf_delete(struct zserv *client, struct zebra_vrf *zvrf) -{ - struct stream *s; - s = client->obuf; - stream_reset(s); +{ + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_VRF_DELETE, zvrf_id(zvrf)); zserv_encode_vrf(s, zvrf); client->vrfdel_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } int zsend_interface_link_params(struct zserv *client, struct interface *ifp) { - struct stream *s; + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); /* Check this client need interface information. */ if (!client->ifinfo) @@ -281,8 +227,6 @@ int zsend_interface_link_params(struct zserv *client, struct interface *ifp) if (!ifp->link_params) return 0; - s = client->obuf; - stream_reset(s); zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf_id); @@ -296,7 +240,7 @@ int zsend_interface_link_params(struct zserv *client, struct interface *ifp) /* Write packet size. */ stream_putw_at(s, 0, stream_get_endp(s)); - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* Interface address is added/deleted. Send ZEBRA_INTERFACE_ADDRESS_ADD or @@ -341,11 +285,8 @@ int zsend_interface_address(int cmd, struct zserv *client, struct interface *ifp, struct connected *ifc) { int blen; - struct stream *s; struct prefix *p; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, ifp->vrf_id); stream_putl(s, ifp->ifindex); @@ -378,7 +319,7 @@ int zsend_interface_address(int cmd, struct zserv *client, stream_putw_at(s, 0, stream_get_endp(s)); client->connected_rt_add_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } static int zsend_interface_nbr_address(int cmd, struct zserv *client, @@ -386,12 +327,9 @@ static int zsend_interface_nbr_address(int cmd, struct zserv *client, struct nbr_connected *ifc) { int blen; - struct stream *s; + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); struct prefix *p; - s = client->obuf; - stream_reset(s); - zclient_create_header(s, cmd, ifp->vrf_id); stream_putl(s, ifp->ifindex); @@ -412,7 +350,7 @@ static int zsend_interface_nbr_address(int cmd, struct zserv *client, /* Write packet size. */ stream_putw_at(s, 0, stream_get_endp(s)); - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* Interface address addition. */ @@ -498,10 +436,7 @@ int zsend_interface_addresses(struct zserv *client, struct interface *ifp) int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp, vrf_id_t vrf_id) { - struct stream *s; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf_id); @@ -513,7 +448,7 @@ int zsend_interface_vrf_update(struct zserv *client, struct interface *ifp, stream_putw_at(s, 0, stream_get_endp(s)); client->if_vrfchg_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } /* Add new nbr connected IPv6 address */ @@ -575,10 +510,7 @@ void nbr_connected_delete_ipv6(struct interface *ifp, struct in6_addr *address) */ int zsend_interface_update(int cmd, struct zserv *client, struct interface *ifp) { - struct stream *s; - - s = client->obuf; - stream_reset(s); + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); zclient_create_header(s, cmd, ifp->vrf_id); zserv_encode_interface(s, ifp); @@ -588,7 +520,7 @@ int zsend_interface_update(int cmd, struct zserv *client, struct interface *ifp) else client->ifdown_cnt++; - return zebra_server_send_message(client); + return zebra_server_send_message(client, s); } int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p, @@ -660,8 +592,10 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p, SET_FLAG(api.message, ZAPI_MESSAGE_MTU); api.mtu = re->mtu; + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + /* Encode route and send. */ - if (zapi_route_encode(cmd, client->obuf, &api) < 0) + if (zapi_route_encode(cmd, s, &api) < 0) return -1; if (IS_ZEBRA_DEBUG_SEND) { @@ -703,27 +637,264 @@ static int zsend_write_nexthop(struct stream *s, struct nexthop *nexthop) return 1; } +/* + * Modified version of zsend_ipv4_nexthop_lookup(): Query unicast rib if + * nexthop is not found on mrib. Returns both route metric and protocol + * distance. + */ +static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, + struct in_addr addr, + struct route_entry *re, + struct zebra_vrf *zvrf) +{ + struct stream *s; + unsigned long nump; + u_char num; + struct nexthop *nexthop; + + /* Get output stream. */ + s = stream_new(ZEBRA_MAX_PACKET_SIZ); + stream_reset(s); + + /* Fill in result. */ + zclient_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, zvrf_id(zvrf)); + stream_put_in_addr(s, &addr); + + if (re) { + stream_putc(s, re->distance); + stream_putl(s, re->metric); + num = 0; + nump = stream_get_endp( + s); /* remember position for nexthop_num */ + stream_putc(s, 0); /* reserve room for nexthop_num */ + /* Only non-recursive routes are elegible to resolve the nexthop + * we + * are looking up. Therefore, we will just iterate over the top + * chain of nexthops. */ + for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) + if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)) + num += zserv_encode_nexthop(s, nexthop); + + stream_putc_at(s, nump, num); /* store nexthop_num */ + } else { + stream_putc(s, 0); /* distance */ + stream_putl(s, 0); /* metric */ + stream_putc(s, 0); /* nexthop_num */ + } + + stream_putw_at(s, 0, stream_get_endp(s)); + + return zebra_server_send_message(client, s); +} + +int zsend_route_notify_owner(struct route_entry *re, struct prefix *p, + enum zapi_route_notify_owner note) +{ + struct zserv *client; + struct stream *s; + uint8_t blen; + + client = zebra_find_client(re->type, re->instance); + if (!client || !client->notify_owner) { + if (IS_ZEBRA_DEBUG_PACKET) { + char buff[PREFIX_STRLEN]; + + zlog_debug( + "Not Notifying Owner: %u about prefix %s(%u) %d", + re->type, prefix2str(p, buff, sizeof(buff)), + re->table, note); + } + return 0; + } + + if (IS_ZEBRA_DEBUG_PACKET) { + char buff[PREFIX_STRLEN]; + + zlog_debug("Notifying Owner: %u about prefix %s(%u) %d", + re->type, prefix2str(p, buff, sizeof(buff)), + re->table, note); + } + + s = stream_new(ZEBRA_MAX_PACKET_SIZ); + stream_reset(s); + + zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, re->vrf_id); + + stream_put(s, ¬e, sizeof(note)); + + stream_putc(s, p->family); + + blen = prefix_blen(p); + stream_putc(s, p->prefixlen); + stream_put(s, &p->u.prefix, blen); + + stream_putl(s, re->table); + + stream_putw_at(s, 0, stream_get_endp(s)); + + return zebra_server_send_message(client, s); +} + +void zsend_rule_notify_owner(struct zebra_pbr_rule *rule, + enum zapi_rule_notify_owner note) +{ + struct listnode *node; + struct zserv *client; + struct stream *s; + + if (IS_ZEBRA_DEBUG_PACKET) { + zlog_debug("%s: Notifying %u", __PRETTY_FUNCTION__, + rule->unique); + } + + for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { + if (rule->sock == client->sock) + break; + } + + if (!client) + return; + + s = stream_new(ZEBRA_MAX_PACKET_SIZ); + stream_reset(s); + + zclient_create_header(s, ZEBRA_RULE_NOTIFY_OWNER, VRF_DEFAULT); + stream_put(s, ¬e, sizeof(note)); + stream_putl(s, rule->seq); + stream_putl(s, rule->priority); + stream_putl(s, rule->unique); + if (rule->ifp) + stream_putl(s, rule->ifp->ifindex); + else + stream_putl(s, 0); + + stream_putw_at(s, 0, stream_get_endp(s)); + + zebra_server_send_message(client, s); +} + +/* Router-id is updated. Send ZEBRA_ROUTER_ID_ADD to client. */ +int zsend_router_id_update(struct zserv *client, struct prefix *p, + vrf_id_t vrf_id) +{ + int blen; + + /* Check this client need interface information. */ + if (!vrf_bitmap_check(client->ridinfo, vrf_id)) + return 0; + + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + + /* Message type. */ + zclient_create_header(s, ZEBRA_ROUTER_ID_UPDATE, vrf_id); + + /* Prefix information. */ + stream_putc(s, p->family); + blen = prefix_blen(p); + stream_put(s, &p->u.prefix, blen); + stream_putc(s, p->prefixlen); + + /* Write packet size. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + return zebra_server_send_message(client, s); +} + +/* + * Function used by Zebra to send a PW status update to LDP daemon + */ +int zsend_pw_update(struct zserv *client, struct zebra_pw *pw) +{ + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + + zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); + stream_write(s, pw->ifname, IF_NAMESIZE); + stream_putl(s, pw->ifindex); + stream_putl(s, pw->status); + + /* Put length at the first point of the stream. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + return zebra_server_send_message(client, s); +} + +/* Send response to a get label chunk request to client */ +static int zsend_assign_label_chunk_response(struct zserv *client, + vrf_id_t vrf_id, + struct label_manager_chunk *lmc) +{ + int ret; + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + + zclient_create_header(s, ZEBRA_GET_LABEL_CHUNK, vrf_id); + + if (lmc) { + /* keep */ + stream_putc(s, lmc->keep); + /* start and end labels */ + stream_putl(s, lmc->start); + stream_putl(s, lmc->end); + } + + /* Write packet size. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + ret = writen(client->sock, s->data, stream_get_endp(s)); + stream_free(s); + return ret; +} + +/* Send response to a label manager connect request to client */ +static int zsend_label_manager_connect_response(struct zserv *client, + vrf_id_t vrf_id, u_short result) +{ + int ret; + struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ); + + zclient_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, vrf_id); + + /* result */ + stream_putc(s, result); + + /* Write packet size. */ + stream_putw_at(s, 0, stream_get_endp(s)); + + ret = writen(client->sock, s->data, stream_get_endp(s)); + stream_free(s); + + return ret; +} + +/* Inbound message handling ------------------------------------------------ */ + +int cmd2type[] = { + [ZEBRA_NEXTHOP_REGISTER] = RNH_NEXTHOP_TYPE, + [ZEBRA_NEXTHOP_UNREGISTER] = RNH_NEXTHOP_TYPE, + [ZEBRA_IMPORT_ROUTE_REGISTER] = RNH_IMPORT_CHECK_TYPE, + [ZEBRA_IMPORT_ROUTE_UNREGISTER] = RNH_IMPORT_CHECK_TYPE, +}; + /* Nexthop register */ -static int zserv_rnh_register(struct zserv *client, u_short length, - rnh_type_t type, struct zebra_vrf *zvrf) +static void zread_rnh_register(ZAPI_HANDLER_ARGS) { struct rnh *rnh; struct stream *s; struct prefix p; u_short l = 0; u_char flags = 0; + uint16_t type = cmd2type[hdr->command]; if (IS_ZEBRA_DEBUG_NHT) zlog_debug( - "rnh_register msg from client %s: length=%d, type=%s\n", - zebra_route_string(client->proto), length, + "rnh_register msg from client %s: hdr->length=%d, type=%s\n", + zebra_route_string(client->proto), hdr->length, (type == RNH_NEXTHOP_TYPE) ? "nexthop" : "route"); - s = client->ibuf; + s = msg; client->nh_reg_time = monotime(NULL); - while (l < length) { + while (l < hdr->length) { STREAM_GETC(s, flags); STREAM_GETW(s, p.family); STREAM_GETC(s, p.prefixlen); @@ -731,18 +902,18 @@ static int zserv_rnh_register(struct zserv *client, u_short length, if (p.family == AF_INET) { if (p.prefixlen > IPV4_MAX_BITLEN) { zlog_warn( - "%s: Specified prefix length %d is too large for a v4 address", + "%s: Specified prefix hdr->length %d is too large for a v4 address", __PRETTY_FUNCTION__, p.prefixlen); - return -1; + return; } STREAM_GET(&p.u.prefix4.s_addr, s, IPV4_MAX_BYTELEN); l += IPV4_MAX_BYTELEN; } else if (p.family == AF_INET6) { if (p.prefixlen > IPV6_MAX_BITLEN) { zlog_warn( - "%s: Specified prefix length %d is to large for a v6 address", + "%s: Specified prefix hdr->length %d is to large for a v6 address", __PRETTY_FUNCTION__, p.prefixlen); - return -1; + return; } STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN); l += IPV6_MAX_BYTELEN; @@ -750,7 +921,7 @@ static int zserv_rnh_register(struct zserv *client, u_short length, zlog_err( "rnh_register: Received unknown family type %d\n", p.family); - return -1; + return; } rnh = zebra_add_rnh(&p, zvrf_id(zvrf), type); if (type == RNH_NEXTHOP_TYPE) { @@ -764,8 +935,9 @@ static int zserv_rnh_register(struct zserv *client, u_short length, if (flags && !CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH)) SET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH); - else if (!flags && CHECK_FLAG(rnh->flags, - ZEBRA_NHT_EXACT_MATCH)) + else if (!flags + && CHECK_FLAG(rnh->flags, + ZEBRA_NHT_EXACT_MATCH)) UNSET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH); } @@ -775,25 +947,26 @@ static int zserv_rnh_register(struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* Nexthop register */ -static int zserv_rnh_unregister(struct zserv *client, u_short length, - rnh_type_t type, struct zebra_vrf *zvrf) +static void zread_rnh_unregister(ZAPI_HANDLER_ARGS) { struct rnh *rnh; struct stream *s; struct prefix p; u_short l = 0; + uint16_t type = cmd2type[hdr->command]; if (IS_ZEBRA_DEBUG_NHT) - zlog_debug("rnh_unregister msg from client %s: length=%d\n", - zebra_route_string(client->proto), length); + zlog_debug( + "rnh_unregister msg from client %s: hdr->length=%d\n", + zebra_route_string(client->proto), hdr->length); - s = client->ibuf; + s = msg; - while (l < length) { + while (l < hdr->length) { uint8_t flags; STREAM_GETC(s, flags); @@ -806,18 +979,18 @@ static int zserv_rnh_unregister(struct zserv *client, u_short length, if (p.family == AF_INET) { if (p.prefixlen > IPV4_MAX_BITLEN) { zlog_warn( - "%s: Specified prefix length %d is to large for a v4 address", + "%s: Specified prefix hdr->length %d is to large for a v4 address", __PRETTY_FUNCTION__, p.prefixlen); - return -1; + return; } STREAM_GET(&p.u.prefix4.s_addr, s, IPV4_MAX_BYTELEN); l += IPV4_MAX_BYTELEN; } else if (p.family == AF_INET6) { if (p.prefixlen > IPV6_MAX_BITLEN) { zlog_warn( - "%s: Specified prefix length %d is to large for a v6 address", + "%s: Specified prefix hdr->length %d is to large for a v6 address", __PRETTY_FUNCTION__, p.prefixlen); - return -1; + return; } STREAM_GET(&p.u.prefix6, s, IPV6_MAX_BYTELEN); l += IPV6_MAX_BYTELEN; @@ -825,7 +998,7 @@ static int zserv_rnh_unregister(struct zserv *client, u_short length, zlog_err( "rnh_register: Received unknown family type %d\n", p.family); - return -1; + return; } rnh = zebra_lookup_rnh(&p, zvrf_id(zvrf), type); if (rnh) { @@ -834,38 +1007,37 @@ static int zserv_rnh_unregister(struct zserv *client, u_short length, } } stream_failure: - return 0; + return; } #define ZEBRA_MIN_FEC_LENGTH 5 /* FEC register */ -static int zserv_fec_register(struct zserv *client, u_short length) +static void zread_fec_register(ZAPI_HANDLER_ARGS) { struct stream *s; - struct zebra_vrf *zvrf; u_short l = 0; struct prefix p; - u_int16_t flags; - u_int32_t label_index = MPLS_INVALID_LABEL_INDEX; + uint16_t flags; + uint32_t label_index = MPLS_INVALID_LABEL_INDEX; - s = client->ibuf; + s = msg; zvrf = vrf_info_lookup(VRF_DEFAULT); if (!zvrf) - return 0; // unexpected + return; // unexpected /* * The minimum amount of data that can be sent for one fec * registration */ - if (length < ZEBRA_MIN_FEC_LENGTH) { + if (hdr->length < ZEBRA_MIN_FEC_LENGTH) { zlog_err( - "fec_register: Received a fec register of length %d, it is of insufficient size to properly decode", - length); - return -1; + "fec_register: Received a fec register of hdr->length %d, it is of insufficient size to properly decode", + hdr->length); + return; } - while (l < length) { + while (l < hdr->length) { STREAM_GETW(s, flags); memset(&p, 0, sizeof(p)); STREAM_GETW(s, p.family); @@ -873,16 +1045,16 @@ static int zserv_fec_register(struct zserv *client, u_short length) zlog_err( "fec_register: Received unknown family type %d\n", p.family); - return -1; + return; } STREAM_GETC(s, p.prefixlen); if ((p.family == AF_INET && p.prefixlen > IPV4_MAX_BITLEN) || (p.family == AF_INET6 && p.prefixlen > IPV6_MAX_BITLEN)) { zlog_warn( - "%s: Specified prefix length: %d is to long for %d", + "%s: Specified prefix hdr->length: %d is to long for %d", __PRETTY_FUNCTION__, p.prefixlen, p.family); - return -1; + return; } l += 5; STREAM_GET(&p.u.prefix, s, PSIZE(p.prefixlen)); @@ -896,35 +1068,34 @@ static int zserv_fec_register(struct zserv *client, u_short length) } stream_failure: - return 0; + return; } /* FEC unregister */ -static int zserv_fec_unregister(struct zserv *client, u_short length) +static void zread_fec_unregister(ZAPI_HANDLER_ARGS) { struct stream *s; - struct zebra_vrf *zvrf; u_short l = 0; struct prefix p; uint16_t flags; - s = client->ibuf; + s = msg; zvrf = vrf_info_lookup(VRF_DEFAULT); if (!zvrf) - return 0; // unexpected + return; // unexpected /* * The minimum amount of data that can be sent for one * fec unregistration */ - if (length < ZEBRA_MIN_FEC_LENGTH) { + if (hdr->length < ZEBRA_MIN_FEC_LENGTH) { zlog_err( - "fec_unregister: Received a fec unregister of length %d, it is of insufficient size to properly decode", - length); - return -1; + "fec_unregister: Received a fec unregister of hdr->length %d, it is of insufficient size to properly decode", + hdr->length); + return; } - while (l < length) { + while (l < hdr->length) { STREAM_GETW(s, flags); if (flags != 0) goto stream_failure; @@ -935,16 +1106,16 @@ static int zserv_fec_unregister(struct zserv *client, u_short length) zlog_err( "fec_unregister: Received unknown family type %d\n", p.family); - return -1; + return; } STREAM_GETC(s, p.prefixlen); if ((p.family == AF_INET && p.prefixlen > IPV4_MAX_BITLEN) || (p.family == AF_INET6 && p.prefixlen > IPV6_MAX_BITLEN)) { zlog_warn( - "%s: Received prefix length %d which is greater than %d can support", + "%s: Received prefix hdr->length %d which is greater than %d can support", __PRETTY_FUNCTION__, p.prefixlen, p.family); - return -1; + return; } l += 5; STREAM_GET(&p.u.prefix, s, PSIZE(p.prefixlen)); @@ -953,199 +1124,15 @@ static int zserv_fec_unregister(struct zserv *client, u_short length) } stream_failure: - return 0; -} - -/* - Modified version of zsend_ipv4_nexthop_lookup(): - Query unicast rib if nexthop is not found on mrib. - Returns both route metric and protocol distance. -*/ -static int zsend_ipv4_nexthop_lookup_mrib(struct zserv *client, - struct in_addr addr, - struct route_entry *re, - struct zebra_vrf *zvrf) -{ - struct stream *s; - unsigned long nump; - u_char num; - struct nexthop *nexthop; - - /* Get output stream. */ - s = client->obuf; - stream_reset(s); - - /* Fill in result. */ - zclient_create_header(s, ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB, zvrf_id(zvrf)); - stream_put_in_addr(s, &addr); - - if (re) { - stream_putc(s, re->distance); - stream_putl(s, re->metric); - num = 0; - nump = stream_get_endp( - s); /* remember position for nexthop_num */ - stream_putc(s, 0); /* reserve room for nexthop_num */ - /* Only non-recursive routes are elegible to resolve the nexthop - * we - * are looking up. Therefore, we will just iterate over the top - * chain of nexthops. */ - for (nexthop = re->ng.nexthop; nexthop; nexthop = nexthop->next) - if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE)) - num += zsend_write_nexthop(s, nexthop); - - stream_putc_at(s, nump, num); /* store nexthop_num */ - } else { - stream_putc(s, 0); /* distance */ - stream_putl(s, 0); /* metric */ - stream_putc(s, 0); /* nexthop_num */ - } - - stream_putw_at(s, 0, stream_get_endp(s)); - - return zebra_server_send_message(client); -} - -int zsend_route_notify_owner(struct route_entry *re, struct prefix *p, - enum zapi_route_notify_owner note) -{ - struct zserv *client; - struct stream *s; - uint8_t blen; - - client = zebra_find_client(re->type, re->instance); - if (!client || !client->notify_owner) { - if (IS_ZEBRA_DEBUG_PACKET) { - char buff[PREFIX_STRLEN]; - - zlog_debug( - "Not Notifying Owner: %u about prefix %s(%u) %d", - re->type, prefix2str(p, buff, sizeof(buff)), - re->table, note); - } - return 0; - } - - if (IS_ZEBRA_DEBUG_PACKET) { - char buff[PREFIX_STRLEN]; - - zlog_debug("Notifying Owner: %u about prefix %s(%u) %d", - re->type, prefix2str(p, buff, sizeof(buff)), - re->table, note); - } - - s = client->obuf; - stream_reset(s); - - zclient_create_header(s, ZEBRA_ROUTE_NOTIFY_OWNER, re->vrf_id); - - stream_put(s, ¬e, sizeof(note)); - - stream_putc(s, p->family); - - blen = prefix_blen(p); - stream_putc(s, p->prefixlen); - stream_put(s, &p->u.prefix, blen); - - stream_putl(s, re->table); - - stream_putw_at(s, 0, stream_get_endp(s)); - - return zebra_server_send_message(client); -} - -void zsend_rule_notify_owner(struct zebra_pbr_rule *rule, - enum zapi_rule_notify_owner note) -{ - struct listnode *node; - struct zserv *client; - struct stream *s; - - if (IS_ZEBRA_DEBUG_PACKET) { - zlog_debug("%s: Notifying %u", - __PRETTY_FUNCTION__, rule->unique); - } - - for (ALL_LIST_ELEMENTS_RO(zebrad.client_list, node, client)) { - if (rule->sock == client->sock) - break; - } - - if (!client) - return; - - s = client->obuf; - stream_reset(s); - - zclient_create_header(s, ZEBRA_RULE_NOTIFY_OWNER, VRF_DEFAULT); - stream_put(s, ¬e, sizeof(note)); - stream_putl(s, rule->seq); - stream_putl(s, rule->priority); - stream_putl(s, rule->unique); - if (rule->ifp) - stream_putl(s, rule->ifp->ifindex); - else - stream_putl(s, 0); - - stream_putw_at(s, 0, stream_get_endp(s)); - - zebra_server_send_message(client); + return; } -/* Router-id is updated. Send ZEBRA_ROUTER_ID_ADD to client. */ -int zsend_router_id_update(struct zserv *client, struct prefix *p, - vrf_id_t vrf_id) -{ - struct stream *s; - int blen; - - /* Check this client need interface information. */ - if (!vrf_bitmap_check(client->ridinfo, vrf_id)) - return 0; - - s = client->obuf; - stream_reset(s); - - /* Message type. */ - zclient_create_header(s, ZEBRA_ROUTER_ID_UPDATE, vrf_id); - - /* Prefix information. */ - stream_putc(s, p->family); - blen = prefix_blen(p); - stream_put(s, &p->u.prefix, blen); - stream_putc(s, p->prefixlen); - - /* Write packet size. */ - stream_putw_at(s, 0, stream_get_endp(s)); - - return zebra_server_send_message(client); -} /* - * Function used by Zebra to send a PW status update to LDP daemon + * Register zebra server interface information. + * Send current all interface and address information. */ -int zsend_pw_update(struct zserv *client, struct zebra_pw *pw) -{ - struct stream *s; - - s = client->obuf; - stream_reset(s); - - zclient_create_header(s, ZEBRA_PW_STATUS_UPDATE, pw->vrf_id); - stream_write(s, pw->ifname, IF_NAMESIZE); - stream_putl(s, pw->ifindex); - stream_putl(s, pw->status); - - /* Put length at the first point of the stream. */ - stream_putw_at(s, 0, stream_get_endp(s)); - - return zebra_server_send_message(client); -} - -/* Register zebra server interface information. Send current all - interface and address information. */ -static int zread_interface_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_interface_add(ZAPI_HANDLER_ARGS) { struct vrf *vrf; struct interface *ifp; @@ -1159,22 +1146,16 @@ static int zread_interface_add(struct zserv *client, u_short length, if (!CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) continue; - if (zsend_interface_add(client, ifp) < 0) - return -1; - - if (zsend_interface_addresses(client, ifp) < 0) - return -1; + zsend_interface_add(client, ifp); + zsend_interface_addresses(client, ifp); } } - return 0; } /* Unregister zebra server interface information. */ -static int zread_interface_delete(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_interface_delete(ZAPI_HANDLER_ARGS) { vrf_bitmap_unset(client->ifinfo, zvrf_id(zvrf)); - return 0; } void zserv_nexthop_num_warn(const char *caller, const struct prefix *p, @@ -1189,8 +1170,7 @@ void zserv_nexthop_num_warn(const char *caller, const struct prefix *p, } } -static int zread_route_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_route_add(ZAPI_HANDLER_ARGS) { struct stream *s; struct zapi_route api; @@ -1201,10 +1181,10 @@ static int zread_route_add(struct zserv *client, u_short length, struct nexthop *nexthop = NULL; int i, ret; vrf_id_t vrf_id = 0; + struct ipaddr vtep_ip; - s = client->ibuf; - if (zapi_route_decode(s, &api) < 0) - return -1; + s = msg; + zapi_route_decode(s, &api); if (IS_ZEBRA_DEBUG_RECV) { char buf_prefix[PREFIX_STRLEN]; @@ -1261,9 +1241,7 @@ static int zread_route_add(struct zserv *client, u_short length, re, &api_nh->gate.ipv4, NULL, api_nh->vrf_id); break; - case NEXTHOP_TYPE_IPV4_IFINDEX: { - - struct ipaddr vtep_ip; + case NEXTHOP_TYPE_IPV4_IFINDEX: memset(&vtep_ip, 0, sizeof(struct ipaddr)); if (CHECK_FLAG(api.flags, @@ -1287,7 +1265,7 @@ static int zread_route_add(struct zserv *client, u_short length, api_nh->vrf_id); /* if this an EVPN route entry, - program the nh as neigh + * program the nh as neigh */ if (CHECK_FLAG(api.flags, ZEBRA_FLAG_EVPN_ROUTE)) { @@ -1302,15 +1280,41 @@ static int zread_route_add(struct zserv *client, u_short length, &api.prefix); } break; - } case NEXTHOP_TYPE_IPV6: nexthop = route_entry_nexthop_ipv6_add( re, &api_nh->gate.ipv6, api_nh->vrf_id); break; case NEXTHOP_TYPE_IPV6_IFINDEX: + memset(&vtep_ip, 0, sizeof(struct ipaddr)); + if (CHECK_FLAG(api.flags, + ZEBRA_FLAG_EVPN_ROUTE)) { + ifindex = + get_l3vni_svi_ifindex(vrf_id); + } else { + ifindex = api_nh->ifindex; + } + nexthop = route_entry_nexthop_ipv6_ifindex_add( - re, &api_nh->gate.ipv6, api_nh->ifindex, + re, &api_nh->gate.ipv6, ifindex, api_nh->vrf_id); + + /* if this an EVPN route entry, + * program the nh as neigh + */ + if (CHECK_FLAG(api.flags, + ZEBRA_FLAG_EVPN_ROUTE)) { + SET_FLAG(nexthop->flags, + NEXTHOP_FLAG_EVPN_RVTEP); + vtep_ip.ipa_type = IPADDR_V6; + memcpy(&vtep_ip.ipaddr_v6, + &(api_nh->gate.ipv6), + sizeof(struct in6_addr)); + zebra_vxlan_evpn_vrf_route_add( + vrf_id, + &api.rmac, + &vtep_ip, + &api.prefix); + } break; case NEXTHOP_TYPE_BLACKHOLE: nexthop = route_entry_nexthop_blackhole_add( @@ -1324,7 +1328,7 @@ static int zread_route_add(struct zserv *client, u_short length, __PRETTY_FUNCTION__, api.nexthop_num); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; } /* MPLS labels for BGP-LU or Segment Routing */ if (CHECK_FLAG(api.message, ZAPI_MESSAGE_LABEL) @@ -1364,7 +1368,7 @@ static int zread_route_add(struct zserv *client, u_short length, __PRETTY_FUNCTION__); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; } if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) src_p = &api.src_prefix; @@ -1386,27 +1390,24 @@ static int zread_route_add(struct zserv *client, u_short length, client->v6_route_upd8_cnt++; break; } - - return 0; } -static int zread_route_del(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_route_del(ZAPI_HANDLER_ARGS) { struct stream *s; struct zapi_route api; afi_t afi; struct prefix_ipv6 *src_p = NULL; - s = client->ibuf; + s = msg; if (zapi_route_decode(s, &api) < 0) - return -1; + return; afi = family2afi(api.prefix.family); if (afi != AFI_IP6 && CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) { zlog_warn("%s: Received a src prefix while afi is not v6", __PRETTY_FUNCTION__); - return -1; + return; } if (CHECK_FLAG(api.message, ZAPI_MESSAGE_SRCPFX)) src_p = &api.src_prefix; @@ -1424,8 +1425,6 @@ static int zread_route_del(struct zserv *client, u_short length, client->v6_route_del_cnt++; break; } - - return 0; } /* This function support multiple nexthop. */ @@ -1433,8 +1432,7 @@ static int zread_route_del(struct zserv *client, u_short length, * Parse the ZEBRA_IPV4_ROUTE_ADD sent from client. Update re and * add kernel route. */ -static int zread_ipv4_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv4_add(ZAPI_HANDLER_ARGS) { int i; struct route_entry *re; @@ -1453,7 +1451,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, enum blackhole_type bh_type = BLACKHOLE_NULL; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Allocate new re. */ re = XCALLOC(MTYPE_RE, sizeof(struct route_entry)); @@ -1464,7 +1462,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, zlog_warn("%s: Specified route type %d is not a legal value\n", __PRETTY_FUNCTION__, re->type); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GETW(s, re->instance); STREAM_GETL(s, re->flags); @@ -1481,7 +1479,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, "%s: Specified prefix length %d is greater than what v4 can be", __PRETTY_FUNCTION__, p.prefixlen); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GET(&p.u.prefix4, s, PSIZE(p.prefixlen)); @@ -1533,7 +1531,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, __PRETTY_FUNCTION__); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; break; case NEXTHOP_TYPE_BLACKHOLE: route_entry_nexthop_blackhole_add(re, bh_type); @@ -1544,7 +1542,7 @@ static int zread_ipv4_add(struct zserv *client, u_short length, __PRETTY_FUNCTION__, nexthop_type); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; } } } @@ -1579,24 +1577,22 @@ static int zread_ipv4_add(struct zserv *client, u_short length, else if (ret < 0) client->v4_route_upd8_cnt++; - return 0; + return; stream_failure: nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; } /* Zebra server IPv4 prefix delete function. */ -static int zread_ipv4_delete(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv4_delete(ZAPI_HANDLER_ARGS) { struct stream *s; struct zapi_ipv4 api; struct prefix p; u_int32_t table_id; - s = client->ibuf; + s = msg; /* Type, flags, message. */ STREAM_GETC(s, api.type); @@ -1612,7 +1608,7 @@ static int zread_ipv4_delete(struct zserv *client, u_short length, if (p.prefixlen > IPV4_MAX_BITLEN) { zlog_warn("%s: Passed in prefixlen %d is impossible", __PRETTY_FUNCTION__, p.prefixlen); - return -1; + return; } STREAM_GET(&p.u.prefix4, s, PSIZE(p.prefixlen)); @@ -1623,28 +1619,25 @@ static int zread_ipv4_delete(struct zserv *client, u_short length, client->v4_route_del_cnt++; stream_failure: - return 0; + return; } /* MRIB Nexthop lookup for IPv4. */ -static int zread_ipv4_nexthop_lookup_mrib(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv4_nexthop_lookup_mrib(ZAPI_HANDLER_ARGS) { struct in_addr addr; struct route_entry *re; - STREAM_GET(&addr.s_addr, client->ibuf, IPV4_MAX_BYTELEN); + STREAM_GET(&addr.s_addr, msg, IPV4_MAX_BYTELEN); re = rib_match_ipv4_multicast(zvrf_id(zvrf), addr, NULL); - return zsend_ipv4_nexthop_lookup_mrib(client, addr, re, zvrf); + zsend_ipv4_nexthop_lookup_mrib(client, addr, re, zvrf); stream_failure: - return -1; + return; } /* Zebra server IPv6 prefix add function. */ -static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, - u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv4_route_ipv6_nexthop_add(ZAPI_HANDLER_ARGS) { unsigned int i; struct stream *s; @@ -1665,7 +1658,7 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, enum blackhole_type bh_type = BLACKHOLE_NULL; /* Get input stream. */ - s = client->ibuf; + s = msg; memset(&nhop_addr, 0, sizeof(struct in6_addr)); @@ -1678,7 +1671,7 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, zlog_warn("%s: Specified route type: %d is not a legal value\n", __PRETTY_FUNCTION__, re->type); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GETW(s, re->instance); STREAM_GETL(s, re->flags); @@ -1695,7 +1688,7 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, "%s: Prefix Length %d is greater than what a v4 address can use", __PRETTY_FUNCTION__, p.prefixlen); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GET(&p.u.prefix4, s, PSIZE(p.prefixlen)); @@ -1750,7 +1743,7 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, __PRETTY_FUNCTION__); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; } } @@ -1808,16 +1801,14 @@ static int zread_ipv4_route_ipv6_nexthop_add(struct zserv *client, else if (ret < 0) client->v4_route_upd8_cnt++; - return 0; + return; stream_failure: nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; } -static int zread_ipv6_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv6_add(ZAPI_HANDLER_ARGS) { unsigned int i; struct stream *s; @@ -1840,7 +1831,7 @@ static int zread_ipv6_add(struct zserv *client, u_short length, enum blackhole_type bh_type = BLACKHOLE_NULL; /* Get input stream. */ - s = client->ibuf; + s = msg; memset(&nhop_addr, 0, sizeof(struct in6_addr)); @@ -1853,7 +1844,7 @@ static int zread_ipv6_add(struct zserv *client, u_short length, zlog_warn("%s: Specified route type: %d is not a legal value\n", __PRETTY_FUNCTION__, re->type); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GETW(s, re->instance); STREAM_GETL(s, re->flags); @@ -1870,7 +1861,7 @@ static int zread_ipv6_add(struct zserv *client, u_short length, "%s: Specified prefix length %d is to large for v6 prefix", __PRETTY_FUNCTION__, p.prefixlen); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GET(&p.u.prefix6, s, PSIZE(p.prefixlen)); @@ -1883,7 +1874,7 @@ static int zread_ipv6_add(struct zserv *client, u_short length, "%s: Specified src prefix length %d is to large for v6 prefix", __PRETTY_FUNCTION__, src_p.prefixlen); XFREE(MTYPE_RE, re); - return -1; + return; } STREAM_GET(&src_p.prefix, s, PSIZE(src_p.prefixlen)); src_pp = &src_p; @@ -1946,7 +1937,7 @@ static int zread_ipv6_add(struct zserv *client, u_short length, __PRETTY_FUNCTION__); nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - return -1; + return; } } @@ -2002,25 +1993,22 @@ static int zread_ipv6_add(struct zserv *client, u_short length, else if (ret < 0) client->v6_route_upd8_cnt++; - return 0; + return; stream_failure: nexthops_free(re->ng.nexthop); XFREE(MTYPE_RE, re); - - return -1; } /* Zebra server IPv6 prefix delete function. */ -static int zread_ipv6_delete(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_ipv6_delete(ZAPI_HANDLER_ARGS) { struct stream *s; struct zapi_ipv6 api; struct prefix p; struct prefix_ipv6 src_p, *src_pp; - s = client->ibuf; + s = msg; /* Type, flags, message. */ STREAM_GETC(s, api.type); @@ -2051,12 +2039,11 @@ static int zread_ipv6_delete(struct zserv *client, u_short length, client->v6_route_del_cnt++; stream_failure: - return 0; + return; } /* Register zebra server router-id information. Send current router-id */ -static int zread_router_id_add(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_router_id_add(ZAPI_HANDLER_ARGS) { struct prefix p; @@ -2065,28 +2052,26 @@ static int zread_router_id_add(struct zserv *client, u_short length, router_id_get(&p, zvrf_id(zvrf)); - return zsend_router_id_update(client, &p, zvrf_id(zvrf)); + zsend_router_id_update(client, &p, zvrf_id(zvrf)); } /* Unregister zebra server router-id information. */ -static int zread_router_id_delete(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_router_id_delete(ZAPI_HANDLER_ARGS) { vrf_bitmap_unset(client->ridinfo, zvrf_id(zvrf)); - return 0; } /* Tie up route-type and client->sock */ -static void zread_hello(struct zserv *client) +static void zread_hello(ZAPI_HANDLER_ARGS) { /* type of protocol (lib/zebra.h) */ u_char proto; u_short instance; u_char notify; - STREAM_GETC(client->ibuf, proto); - STREAM_GETW(client->ibuf, instance); - STREAM_GETC(client->ibuf, notify); + STREAM_GETC(msg, proto); + STREAM_GETW(msg, instance); + STREAM_GETC(msg, notify); if (notify) client->notify_owner = true; @@ -2107,8 +2092,7 @@ stream_failure: } /* Unregister all information in a VRF. */ -static int zread_vrf_unregister(struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_vrf_unregister(ZAPI_HANDLER_ARGS) { int i; afi_t afi; @@ -2119,12 +2103,9 @@ static int zread_vrf_unregister(struct zserv *client, u_short length, vrf_bitmap_unset(client->redist_default, zvrf_id(zvrf)); vrf_bitmap_unset(client->ifinfo, zvrf_id(zvrf)); vrf_bitmap_unset(client->ridinfo, zvrf_id(zvrf)); - - return 0; } -static void zread_mpls_labels(int command, struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_mpls_labels(ZAPI_HANDLER_ARGS) { struct stream *s; enum lsp_types_t type; @@ -2136,7 +2117,7 @@ static void zread_mpls_labels(int command, struct zserv *client, u_short length, u_int8_t distance; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Get data. */ STREAM_GETC(s, type); @@ -2194,12 +2175,12 @@ static void zread_mpls_labels(int command, struct zserv *client, u_short length, if (!mpls_enabled) return; - if (command == ZEBRA_MPLS_LABELS_ADD) { + if (hdr->command == ZEBRA_MPLS_LABELS_ADD) { mpls_lsp_install(zvrf, type, in_label, out_label, gtype, &gate, ifindex); mpls_ftn_update(1, zvrf, type, &prefix, gtype, &gate, ifindex, distance, out_label); - } else if (command == ZEBRA_MPLS_LABELS_DELETE) { + } else if (hdr->command == ZEBRA_MPLS_LABELS_DELETE) { mpls_lsp_uninstall(zvrf, type, in_label, gtype, &gate, ifindex); mpls_ftn_update(0, zvrf, type, &prefix, gtype, &gate, ifindex, distance, out_label); @@ -2207,27 +2188,9 @@ static void zread_mpls_labels(int command, struct zserv *client, u_short length, stream_failure: return; } -/* Send response to a label manager connect request to client */ -static int zsend_label_manager_connect_response(struct zserv *client, - vrf_id_t vrf_id, u_short result) -{ - struct stream *s; - - s = client->obuf; - stream_reset(s); - zclient_create_header(s, ZEBRA_LABEL_MANAGER_CONNECT, vrf_id); - - /* result */ - stream_putc(s, result); - - /* Write packet size. */ - stream_putw_at(s, 0, stream_get_endp(s)); - - return writen(client->sock, s->data, stream_get_endp(s)); -} - -static void zread_label_manager_connect(struct zserv *client, vrf_id_t vrf_id) +static void zread_label_manager_connect(struct zserv *client, + struct stream *msg, vrf_id_t vrf_id) { struct stream *s; /* type of protocol (lib/zebra.h) */ @@ -2235,7 +2198,7 @@ static void zread_label_manager_connect(struct zserv *client, vrf_id_t vrf_id) u_short instance; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Get data. */ STREAM_GETC(s, proto); @@ -2268,33 +2231,9 @@ static void zread_label_manager_connect(struct zserv *client, vrf_id_t vrf_id) stream_failure: return; } -/* Send response to a get label chunk request to client */ -static int zsend_assign_label_chunk_response(struct zserv *client, - vrf_id_t vrf_id, - struct label_manager_chunk *lmc) -{ - struct stream *s; - - s = client->obuf; - stream_reset(s); - - zclient_create_header(s, ZEBRA_GET_LABEL_CHUNK, vrf_id); - - if (lmc) { - /* keep */ - stream_putc(s, lmc->keep); - /* start and end labels */ - stream_putl(s, lmc->start); - stream_putl(s, lmc->end); - } - - /* Write packet size. */ - stream_putw_at(s, 0, stream_get_endp(s)); - - return writen(client->sock, s->data, stream_get_endp(s)); -} -static void zread_get_label_chunk(struct zserv *client, vrf_id_t vrf_id) +static void zread_get_label_chunk(struct zserv *client, struct stream *msg, + vrf_id_t vrf_id) { struct stream *s; u_char keep; @@ -2302,7 +2241,7 @@ static void zread_get_label_chunk(struct zserv *client, vrf_id_t vrf_id) struct label_manager_chunk *lmc; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Get data. */ STREAM_GETC(s, keep); @@ -2322,13 +2261,13 @@ stream_failure: return; } -static void zread_release_label_chunk(struct zserv *client) +static void zread_release_label_chunk(struct zserv *client, struct stream *msg) { struct stream *s; uint32_t start, end; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Get data. */ STREAM_GETL(s, start); @@ -2339,20 +2278,20 @@ static void zread_release_label_chunk(struct zserv *client) stream_failure: return; } -static void zread_label_manager_request(int cmd, struct zserv *client, - struct zebra_vrf *zvrf) +static void zread_label_manager_request(ZAPI_HANDLER_ARGS) { /* to avoid sending other messages like ZERBA_INTERFACE_UP */ - if (cmd == ZEBRA_LABEL_MANAGER_CONNECT) + if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT) client->is_synchronous = 1; /* external label manager */ if (lm_is_external) - zread_relay_label_manager_request(cmd, client, zvrf_id(zvrf)); + zread_relay_label_manager_request(hdr->command, client, + zvrf_id(zvrf)); /* this is a label manager */ else { - if (cmd == ZEBRA_LABEL_MANAGER_CONNECT) - zread_label_manager_connect(client, zvrf_id(zvrf)); + if (hdr->command == ZEBRA_LABEL_MANAGER_CONNECT) + zread_label_manager_connect(client, msg, zvrf_id(zvrf)); else { /* Sanity: don't allow 'unidentified' requests */ if (!client->proto) { @@ -2360,16 +2299,16 @@ static void zread_label_manager_request(int cmd, struct zserv *client, "Got label request from an unidentified client"); return; } - if (cmd == ZEBRA_GET_LABEL_CHUNK) - zread_get_label_chunk(client, zvrf_id(zvrf)); - else if (cmd == ZEBRA_RELEASE_LABEL_CHUNK) - zread_release_label_chunk(client); + if (hdr->command == ZEBRA_GET_LABEL_CHUNK) + zread_get_label_chunk(client, msg, + zvrf_id(zvrf)); + else if (hdr->command == ZEBRA_RELEASE_LABEL_CHUNK) + zread_release_label_chunk(client, msg); } } } -static int zread_pseudowire(int command, struct zserv *client, u_short length, - struct zebra_vrf *zvrf) +static void zread_pseudowire(ZAPI_HANDLER_ARGS) { struct stream *s; char ifname[IF_NAMESIZE]; @@ -2385,7 +2324,7 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, struct zebra_pw *pw; /* Get input stream. */ - s = client->ibuf; + s = msg; /* Get data. */ STREAM_GET(ifname, s, IF_NAMESIZE); @@ -2400,7 +2339,7 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, STREAM_GET(&nexthop.ipv6, s, 16); break; default: - return -1; + return; } STREAM_GETL(s, local_label); STREAM_GETL(s, remote_label); @@ -2409,13 +2348,13 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, protocol = client->proto; pw = zebra_pw_find(zvrf, ifname); - switch (command) { + switch (hdr->command) { case ZEBRA_PW_ADD: if (pw) { zlog_warn("%s: pseudowire %s already exists [%s]", __func__, ifname, - zserv_command_string(command)); - return -1; + zserv_command_string(hdr->command)); + return; } zebra_pw_add(zvrf, ifname, protocol, client); @@ -2423,8 +2362,8 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, case ZEBRA_PW_DELETE: if (!pw) { zlog_warn("%s: pseudowire %s not found [%s]", __func__, - ifname, zserv_command_string(command)); - return -1; + ifname, zserv_command_string(hdr->command)); + return; } zebra_pw_del(zvrf, pw); @@ -2433,11 +2372,11 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, case ZEBRA_PW_UNSET: if (!pw) { zlog_warn("%s: pseudowire %s not found [%s]", __func__, - ifname, zserv_command_string(command)); - return -1; + ifname, zserv_command_string(hdr->command)); + return; } - switch (command) { + switch (hdr->command) { case ZEBRA_PW_SET: pw->enabled = 1; break; @@ -2452,7 +2391,7 @@ static int zread_pseudowire(int command, struct zserv *client, u_short length, } stream_failure: - return 0; + return; } /* Cleanup registered nexthops (across VRFs) upon client disconnect. */ @@ -2482,116 +2421,11 @@ static void zebra_client_close_cleanup_rnh(struct zserv *client) } } -/* free zebra client information. */ -static void zebra_client_free(struct zserv *client) -{ - /* Send client de-registration to BFD */ - zebra_ptm_bfd_client_deregister(client->proto); - - /* Cleanup any registered nexthops - across all VRFs. */ - zebra_client_close_cleanup_rnh(client); - - /* Release Label Manager chunks */ - release_daemon_chunks(client->proto, client->instance); - - /* Cleanup any FECs registered by this client. */ - zebra_mpls_cleanup_fecs_for_client(vrf_info_lookup(VRF_DEFAULT), - client); - - /* Remove pseudowires associated with this client */ - zebra_pw_client_close(client); - - /* Close file descriptor. */ - if (client->sock) { - unsigned long nroutes; - - close(client->sock); - nroutes = rib_score_proto(client->proto, client->instance); - zlog_notice( - "client %d disconnected. %lu %s routes removed from the rib", - client->sock, nroutes, - zebra_route_string(client->proto)); - client->sock = -1; - } - - /* Free stream buffers. */ - if (client->ibuf) - stream_free(client->ibuf); - if (client->obuf) - stream_free(client->obuf); - if (client->wb) - buffer_free(client->wb); - - /* Release threads. */ - if (client->t_read) - thread_cancel(client->t_read); - if (client->t_write) - thread_cancel(client->t_write); - if (client->t_suicide) - thread_cancel(client->t_suicide); - - /* Free bitmaps. */ - for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) - for (int i = 0; i < ZEBRA_ROUTE_MAX; i++) - vrf_bitmap_free(client->redist[afi][i]); - - vrf_bitmap_free(client->redist_default); - vrf_bitmap_free(client->ifinfo); - vrf_bitmap_free(client->ridinfo); - - XFREE(MTYPE_TMP, client); -} - -static void zebra_client_close(struct zserv *client) -{ - listnode_delete(zebrad.client_list, client); - zebra_client_free(client); -} - -/* Make new client. */ -static void zebra_client_create(int sock) -{ - struct zserv *client; - int i; - afi_t afi; - - client = XCALLOC(MTYPE_TMP, sizeof(struct zserv)); - - /* Make client input/output buffer. */ - client->sock = sock; - client->ibuf = stream_new(ZEBRA_MAX_PACKET_SIZ); - client->obuf = stream_new(ZEBRA_MAX_PACKET_SIZ); - client->wb = buffer_new(0); - - /* Set table number. */ - client->rtm_table = zebrad.rtm_table_default; - - client->connect_time = monotime(NULL); - /* Initialize flags */ - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (i = 0; i < ZEBRA_ROUTE_MAX; i++) - client->redist[afi][i] = vrf_bitmap_init(); - client->redist_default = vrf_bitmap_init(); - client->ifinfo = vrf_bitmap_init(); - client->ridinfo = vrf_bitmap_init(); - - /* by default, it's not a synchronous client */ - client->is_synchronous = 0; - - /* Add this client to linked list. */ - listnode_add(zebrad.client_list, client); - - /* Make new read thread. */ - zebra_event(ZEBRA_READ, sock, client); - - zebra_vrf_update_all(client); -} - -static int zread_interface_set_master(struct zserv *client, u_short length) +static void zread_interface_set_master(ZAPI_HANDLER_ARGS) { struct interface *master; struct interface *slave; - struct stream *s = client->ibuf; + struct stream *s = msg; int ifindex; vrf_id_t vrf_id; @@ -2604,16 +2438,16 @@ static int zread_interface_set_master(struct zserv *client, u_short length) slave = if_lookup_by_index(ifindex, vrf_id); if (!master || !slave) - return 0; + return; kernel_interface_set_master(master, slave); stream_failure: - return 1; + return; } -static void zread_vrf_label(struct zserv *client, struct zebra_vrf *zvrf) +static void zread_vrf_label(ZAPI_HANDLER_ARGS) { struct interface *ifp; mpls_label_t nlabel; @@ -2622,7 +2456,7 @@ static void zread_vrf_label(struct zserv *client, struct zebra_vrf *zvrf) struct zebra_vrf *def_zvrf; enum lsp_types_t ltype; - s = client->ibuf; + s = msg; STREAM_GETL(s, nlabel); STREAM_GETC(s, afi); if (nlabel == zvrf->label[afi]) { @@ -2681,15 +2515,14 @@ stream_failure: return; } -static inline void zread_rule(uint16_t command, struct zserv *client, - uint16_t length, struct zebra_vrf *zvrf) +static inline void zread_rule(ZAPI_HANDLER_ARGS) { struct zebra_pbr_rule zpr; struct stream *s; uint32_t total, i; ifindex_t ifindex; - s = client->ibuf; + s = msg; STREAM_GETL(s, total); for (i = 0; i < total; i++) { @@ -2730,7 +2563,7 @@ static inline void zread_rule(uint16_t command, struct zserv *client, if (zpr.filter.dst_port) zpr.filter.filter_bm |= PBR_FILTER_DST_PORT; - if (command == ZEBRA_RULE_ADD) + if (hdr->command == ZEBRA_RULE_ADD) zebra_pbr_add_rule(zvrf->zns, &zpr); else zebra_pbr_del_rule(zvrf->zns, &zpr); @@ -2740,158 +2573,314 @@ stream_failure: return; } -static inline void zserv_handle_commands(struct zserv *client, uint16_t command, - uint16_t length, - struct zebra_vrf *zvrf) -{ - switch (command) { - case ZEBRA_ROUTER_ID_ADD: - zread_router_id_add(client, length, zvrf); - break; - case ZEBRA_ROUTER_ID_DELETE: - zread_router_id_delete(client, length, zvrf); - break; - case ZEBRA_INTERFACE_ADD: - zread_interface_add(client, length, zvrf); - break; - case ZEBRA_INTERFACE_DELETE: - zread_interface_delete(client, length, zvrf); - break; - case ZEBRA_ROUTE_ADD: - zread_route_add(client, length, zvrf); - break; - case ZEBRA_ROUTE_DELETE: - zread_route_del(client, length, zvrf); - break; - case ZEBRA_IPV4_ROUTE_ADD: - zread_ipv4_add(client, length, zvrf); - break; - case ZEBRA_IPV4_ROUTE_DELETE: - zread_ipv4_delete(client, length, zvrf); - break; - case ZEBRA_IPV4_ROUTE_IPV6_NEXTHOP_ADD: - zread_ipv4_route_ipv6_nexthop_add(client, length, zvrf); - break; - case ZEBRA_IPV6_ROUTE_ADD: - zread_ipv6_add(client, length, zvrf); - break; - case ZEBRA_IPV6_ROUTE_DELETE: - zread_ipv6_delete(client, length, zvrf); - break; - case ZEBRA_REDISTRIBUTE_ADD: - zebra_redistribute_add(command, client, length, zvrf); - break; - case ZEBRA_REDISTRIBUTE_DELETE: - zebra_redistribute_delete(command, client, length, zvrf); - break; - case ZEBRA_REDISTRIBUTE_DEFAULT_ADD: - zebra_redistribute_default_add(command, client, length, zvrf); - break; - case ZEBRA_REDISTRIBUTE_DEFAULT_DELETE: - zebra_redistribute_default_delete(command, client, length, - zvrf); - break; - case ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB: - zread_ipv4_nexthop_lookup_mrib(client, length, zvrf); - break; - case ZEBRA_HELLO: - zread_hello(client); - break; - case ZEBRA_NEXTHOP_REGISTER: - zserv_rnh_register(client, length, RNH_NEXTHOP_TYPE, zvrf); - break; - case ZEBRA_NEXTHOP_UNREGISTER: - zserv_rnh_unregister(client, length, RNH_NEXTHOP_TYPE, zvrf); - break; - case ZEBRA_IMPORT_ROUTE_REGISTER: - zserv_rnh_register(client, length, RNH_IMPORT_CHECK_TYPE, zvrf); - break; - case ZEBRA_IMPORT_ROUTE_UNREGISTER: - zserv_rnh_unregister(client, length, RNH_IMPORT_CHECK_TYPE, - zvrf); - break; - case ZEBRA_BFD_DEST_UPDATE: - case ZEBRA_BFD_DEST_REGISTER: - zebra_ptm_bfd_dst_register(client, length, command, zvrf); - break; - case ZEBRA_BFD_DEST_DEREGISTER: - zebra_ptm_bfd_dst_deregister(client, length, zvrf); - break; - case ZEBRA_VRF_UNREGISTER: - zread_vrf_unregister(client, length, zvrf); - break; - case ZEBRA_VRF_LABEL: - zread_vrf_label(client, zvrf); - break; - case ZEBRA_BFD_CLIENT_REGISTER: - zebra_ptm_bfd_client_register(client, length); - break; - case ZEBRA_INTERFACE_ENABLE_RADV: -#if defined(HAVE_RTADV) - zebra_interface_radv_set(client, length, zvrf, 1); -#endif - break; - case ZEBRA_INTERFACE_DISABLE_RADV: +void (*zserv_handlers[])(ZAPI_HANDLER_ARGS) = { + [ZEBRA_ROUTER_ID_ADD] = zread_router_id_add, + [ZEBRA_ROUTER_ID_DELETE] = zread_router_id_delete, + [ZEBRA_INTERFACE_ADD] = zread_interface_add, + [ZEBRA_INTERFACE_DELETE] = zread_interface_delete, + [ZEBRA_ROUTE_ADD] = zread_route_add, + [ZEBRA_ROUTE_DELETE] = zread_route_del, + [ZEBRA_IPV4_ROUTE_ADD] = zread_ipv4_add, + [ZEBRA_IPV4_ROUTE_DELETE] = zread_ipv4_delete, + [ZEBRA_IPV4_ROUTE_IPV6_NEXTHOP_ADD] = zread_ipv4_route_ipv6_nexthop_add, + [ZEBRA_IPV6_ROUTE_ADD] = zread_ipv6_add, + [ZEBRA_IPV6_ROUTE_DELETE] = zread_ipv6_delete, + [ZEBRA_REDISTRIBUTE_ADD] = zebra_redistribute_add, + [ZEBRA_REDISTRIBUTE_DELETE] = zebra_redistribute_delete, + [ZEBRA_REDISTRIBUTE_DEFAULT_ADD] = zebra_redistribute_default_add, + [ZEBRA_REDISTRIBUTE_DEFAULT_DELETE] = zebra_redistribute_default_delete, + [ZEBRA_IPV4_NEXTHOP_LOOKUP_MRIB] = zread_ipv4_nexthop_lookup_mrib, + [ZEBRA_HELLO] = zread_hello, + [ZEBRA_NEXTHOP_REGISTER] = zread_rnh_register, + [ZEBRA_NEXTHOP_UNREGISTER] = zread_rnh_unregister, + [ZEBRA_IMPORT_ROUTE_REGISTER] = zread_rnh_register, + [ZEBRA_IMPORT_ROUTE_UNREGISTER] = zread_rnh_unregister, + [ZEBRA_BFD_DEST_UPDATE] = zebra_ptm_bfd_dst_register, + [ZEBRA_BFD_DEST_REGISTER] = zebra_ptm_bfd_dst_register, + [ZEBRA_BFD_DEST_DEREGISTER] = zebra_ptm_bfd_dst_deregister, + [ZEBRA_VRF_UNREGISTER] = zread_vrf_unregister, + [ZEBRA_VRF_LABEL] = zread_vrf_label, + [ZEBRA_BFD_CLIENT_REGISTER] = zebra_ptm_bfd_client_register, #if defined(HAVE_RTADV) - zebra_interface_radv_set(client, length, zvrf, 0); + [ZEBRA_INTERFACE_ENABLE_RADV] = zebra_interface_radv_enable, + [ZEBRA_INTERFACE_DISABLE_RADV] = zebra_interface_radv_disable, +#else + [ZEBRA_INTERFACE_ENABLE_RADV] = NULL, + [ZEBRA_INTERFACE_DISABLE_RADV] = NULL, #endif + [ZEBRA_MPLS_LABELS_ADD] = zread_mpls_labels, + [ZEBRA_MPLS_LABELS_DELETE] = zread_mpls_labels, + [ZEBRA_IPMR_ROUTE_STATS] = zebra_ipmr_route_stats, + [ZEBRA_LABEL_MANAGER_CONNECT] = zread_label_manager_request, + [ZEBRA_GET_LABEL_CHUNK] = zread_label_manager_request, + [ZEBRA_RELEASE_LABEL_CHUNK] = zread_label_manager_request, + [ZEBRA_FEC_REGISTER] = zread_fec_register, + [ZEBRA_FEC_UNREGISTER] = zread_fec_unregister, + [ZEBRA_ADVERTISE_DEFAULT_GW] = zebra_vxlan_advertise_gw_macip, + [ZEBRA_ADVERTISE_SUBNET] = zebra_vxlan_advertise_subnet, + [ZEBRA_ADVERTISE_ALL_VNI] = zebra_vxlan_advertise_all_vni, + [ZEBRA_REMOTE_VTEP_ADD] = zebra_vxlan_remote_vtep_add, + [ZEBRA_REMOTE_VTEP_DEL] = zebra_vxlan_remote_vtep_del, + [ZEBRA_REMOTE_MACIP_ADD] = zebra_vxlan_remote_macip_add, + [ZEBRA_REMOTE_MACIP_DEL] = zebra_vxlan_remote_macip_del, + [ZEBRA_INTERFACE_SET_MASTER] = zread_interface_set_master, + [ZEBRA_PW_ADD] = zread_pseudowire, + [ZEBRA_PW_DELETE] = zread_pseudowire, + [ZEBRA_PW_SET] = zread_pseudowire, + [ZEBRA_PW_UNSET] = zread_pseudowire, + [ZEBRA_RULE_ADD] = zread_rule, + [ZEBRA_RULE_DELETE] = zread_rule, +}; + +static inline void zserv_handle_commands(struct zserv *client, + struct zmsghdr *hdr, + struct stream *msg, + struct zebra_vrf *zvrf) +{ + if (hdr->command > sizeof(zserv_handlers) + || zserv_handlers[hdr->command] == NULL) + zlog_info("Zebra received unknown command %d", hdr->command); + else + zserv_handlers[hdr->command](client, hdr, msg, zvrf); + + stream_free(msg); +} + +/* Lifecycle ---------------------------------------------------------------- */ + +/* free zebra client information. */ +static void zebra_client_free(struct zserv *client) +{ + /* Send client de-registration to BFD */ + zebra_ptm_bfd_client_deregister(client->proto); + + /* Cleanup any registered nexthops - across all VRFs. */ + zebra_client_close_cleanup_rnh(client); + + /* Release Label Manager chunks */ + release_daemon_chunks(client->proto, client->instance); + + /* Cleanup any FECs registered by this client. */ + zebra_mpls_cleanup_fecs_for_client(vrf_info_lookup(VRF_DEFAULT), + client); + + /* Remove pseudowires associated with this client */ + zebra_pw_client_close(client); + + /* Close file descriptor. */ + if (client->sock) { + unsigned long nroutes; + + close(client->sock); + nroutes = rib_score_proto(client->proto, client->instance); + zlog_notice( + "client %d disconnected. %lu %s routes removed from the rib", + client->sock, nroutes, + zebra_route_string(client->proto)); + client->sock = -1; + } + + /* Free stream buffers. */ + if (client->ibuf_work) + stream_free(client->ibuf_work); + if (client->obuf_work) + stream_free(client->obuf_work); + if (client->ibuf_fifo) + stream_fifo_free(client->ibuf_fifo); + if (client->obuf_fifo) + stream_fifo_free(client->obuf_fifo); + if (client->wb) + buffer_free(client->wb); + + /* Release threads. */ + if (client->t_read) + thread_cancel(client->t_read); + if (client->t_write) + thread_cancel(client->t_write); + if (client->t_suicide) + thread_cancel(client->t_suicide); + + /* Free bitmaps. */ + for (afi_t afi = AFI_IP; afi < AFI_MAX; afi++) + for (int i = 0; i < ZEBRA_ROUTE_MAX; i++) + vrf_bitmap_free(client->redist[afi][i]); + + vrf_bitmap_free(client->redist_default); + vrf_bitmap_free(client->ifinfo); + vrf_bitmap_free(client->ridinfo); + + XFREE(MTYPE_TMP, client); +} + +/* + * Called from client thread to terminate itself. + */ +static void zebra_client_close(struct zserv *client) +{ + listnode_delete(zebrad.client_list, client); + zebra_client_free(client); +} + +/* Make new client. */ +static void zebra_client_create(int sock) +{ + struct zserv *client; + int i; + afi_t afi; + + client = XCALLOC(MTYPE_TMP, sizeof(struct zserv)); + + /* Make client input/output buffer. */ + client->sock = sock; + client->ibuf_fifo = stream_fifo_new(); + client->obuf_fifo = stream_fifo_new(); + client->ibuf_work = stream_new(ZEBRA_MAX_PACKET_SIZ); + client->obuf_work = stream_new(ZEBRA_MAX_PACKET_SIZ); + client->wb = buffer_new(0); + + /* Set table number. */ + client->rtm_table = zebrad.rtm_table_default; + + client->connect_time = monotime(NULL); + /* Initialize flags */ + for (afi = AFI_IP; afi < AFI_MAX; afi++) + for (i = 0; i < ZEBRA_ROUTE_MAX; i++) + client->redist[afi][i] = vrf_bitmap_init(); + client->redist_default = vrf_bitmap_init(); + client->ifinfo = vrf_bitmap_init(); + client->ridinfo = vrf_bitmap_init(); + + /* by default, it's not a synchronous client */ + client->is_synchronous = 0; + + /* Add this client to linked list. */ + listnode_add(zebrad.client_list, client); + + zebra_vrf_update_all(client); + + /* start read loop */ + zebra_event(client, ZEBRA_READ); +} + +static int zserv_delayed_close(struct thread *thread) +{ + struct zserv *client = THREAD_ARG(thread); + + client->t_suicide = NULL; + zebra_client_close(client); + return 0; +} + +/* + * Log zapi message to zlog. + * + * errmsg (optional) + * Debugging message + * + * msg + * The message + * + * hdr (optional) + * The message header + */ +static void zserv_log_message(const char *errmsg, struct stream *msg, + struct zmsghdr *hdr) +{ + zlog_debug("Rx'd ZAPI message"); + if (errmsg) + zlog_debug("%s", errmsg); + if (hdr) { + zlog_debug(" Length: %d", hdr->length); + zlog_debug("Command: %s", zserv_command_string(hdr->command)); + zlog_debug(" VRF: %u", hdr->vrf_id); + } + zlog_hexdump(msg->data, STREAM_READABLE(msg)); +} + +static int zserv_flush_data(struct thread *thread) +{ + struct zserv *client = THREAD_ARG(thread); + + client->t_write = NULL; + if (client->t_suicide) { + zebra_client_close(client); + return -1; + } + switch (buffer_flush_available(client->wb, client->sock)) { + case BUFFER_ERROR: + zlog_warn( + "%s: buffer_flush_available failed on zserv client fd %d, closing", + __func__, client->sock); + zebra_client_close(client); + client = NULL; break; - case ZEBRA_MPLS_LABELS_ADD: - case ZEBRA_MPLS_LABELS_DELETE: - zread_mpls_labels(command, client, length, zvrf); - break; - case ZEBRA_IPMR_ROUTE_STATS: - zebra_ipmr_route_stats(client, length, zvrf); - break; - case ZEBRA_LABEL_MANAGER_CONNECT: - case ZEBRA_GET_LABEL_CHUNK: - case ZEBRA_RELEASE_LABEL_CHUNK: - zread_label_manager_request(command, client, zvrf); - break; - case ZEBRA_FEC_REGISTER: - zserv_fec_register(client, length); - break; - case ZEBRA_FEC_UNREGISTER: - zserv_fec_unregister(client, length); - break; - case ZEBRA_ADVERTISE_DEFAULT_GW: - zebra_vxlan_advertise_gw_macip(client, length, zvrf); - break; - case ZEBRA_ADVERTISE_SUBNET: - zebra_vxlan_advertise_subnet(client, length, zvrf); - break; - case ZEBRA_ADVERTISE_ALL_VNI: - zebra_vxlan_advertise_all_vni(client, length, zvrf); - break; - case ZEBRA_REMOTE_VTEP_ADD: - zebra_vxlan_remote_vtep_add(client, length, zvrf); - break; - case ZEBRA_REMOTE_VTEP_DEL: - zebra_vxlan_remote_vtep_del(client, length, zvrf); - break; - case ZEBRA_REMOTE_MACIP_ADD: - zebra_vxlan_remote_macip_add(client, length, zvrf); - break; - case ZEBRA_REMOTE_MACIP_DEL: - zebra_vxlan_remote_macip_del(client, length, zvrf); - break; - case ZEBRA_INTERFACE_SET_MASTER: - zread_interface_set_master(client, length); + case BUFFER_PENDING: + client->t_write = NULL; + thread_add_write(zebrad.master, zserv_flush_data, client, + client->sock, &client->t_write); break; - case ZEBRA_PW_ADD: - case ZEBRA_PW_DELETE: - case ZEBRA_PW_SET: - case ZEBRA_PW_UNSET: - zread_pseudowire(command, client, length, zvrf); + case BUFFER_EMPTY: break; - case ZEBRA_RULE_ADD: - case ZEBRA_RULE_DELETE: - zread_rule(command, client, length, zvrf); + } + + if (client) + client->last_write_time = monotime(NULL); + return 0; +} + +/* + * Write a single packet. + */ +static int zserv_write(struct thread *thread) +{ + struct zserv *client = THREAD_ARG(thread); + struct stream *msg; + int writerv; + + if (client->t_suicide) + return -1; + + if (client->is_synchronous) + return 0; + + msg = stream_fifo_pop(client->obuf_fifo); + stream_set_getp(msg, 0); + client->last_write_cmd = stream_getw_from(msg, 6); + + writerv = buffer_write(client->wb, client->sock, STREAM_DATA(msg), + stream_get_endp(msg)); + + stream_free(msg); + + switch (writerv) { + case BUFFER_ERROR: + zlog_warn( + "%s: buffer_write failed to zserv client fd %d, closing", + __func__, client->sock); + /* + * Schedule a delayed close since many of the functions that + * call this one do not check the return code. They do not + * allow for the possibility that an I/O error may have caused + * the client to be deleted. + */ + client->t_suicide = NULL; + thread_add_event(zebrad.master, zserv_delayed_close, client, 0, + &client->t_suicide); + return -1; + case BUFFER_EMPTY: + THREAD_OFF(client->t_write); break; - default: - zlog_info("Zebra received unknown command %d", command); + case BUFFER_PENDING: + thread_add_write(zebrad.master, zserv_flush_data, client, + client->sock, &client->t_write); break; } + + if (client->obuf_fifo->count) + zebra_event(client, ZEBRA_WRITE); + + client->last_write_time = monotime(NULL); + return 0; } #if defined(HANDLE_ZAPI_FUZZING) @@ -2914,26 +2903,61 @@ static void zserv_write_incoming(struct stream *orig, uint16_t command) } #endif +static int zserv_process_messages(struct thread *thread) +{ + struct zserv *client = THREAD_ARG(thread); + struct zebra_vrf *zvrf; + struct zmsghdr hdr; + struct stream *msg; + bool hdrvalid; + + do { + msg = stream_fifo_pop(client->ibuf_fifo); + + /* break if out of messages */ + if (!msg) + continue; + + /* read & check header */ + hdrvalid = zapi_parse_header(msg, &hdr); + if (!hdrvalid && IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV) { + const char *emsg = "Message has corrupt header"; + zserv_log_message(emsg, msg, NULL); + } + if (!hdrvalid) + continue; + + /* lookup vrf */ + zvrf = zebra_vrf_lookup_by_id(hdr.vrf_id); + if (!zvrf && IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV) { + const char *emsg = "Message specifies unknown VRF"; + zserv_log_message(emsg, msg, &hdr); + } + if (!zvrf) + continue; + + /* process commands */ + zserv_handle_commands(client, &hdr, msg, zvrf); + + } while (msg); + + return 0; +} + /* Handler of zebra service request. */ -static int zebra_client_read(struct thread *thread) +static int zserv_read(struct thread *thread) { int sock; struct zserv *client; size_t already; - uint16_t length, command; - uint8_t marker, version; - vrf_id_t vrf_id; - struct zebra_vrf *zvrf; #if defined(HANDLE_ZAPI_FUZZING) int packets = 1; #else int packets = zebrad.packets_to_process; #endif - /* Get thread data. Reset reading thread because I'm running. */ sock = THREAD_FD(thread); client = THREAD_ARG(thread); - client->t_read = NULL; if (client->t_suicide) { zebra_client_close(client); @@ -2941,88 +2965,89 @@ static int zebra_client_read(struct thread *thread) } while (packets) { + struct zmsghdr hdr; + ssize_t nb; + bool hdrvalid; + char errmsg[256]; + + already = stream_get_endp(client->ibuf_work); + /* Read length and command (if we don't have it already). */ - if ((already = stream_get_endp(client->ibuf)) - < ZEBRA_HEADER_SIZE) { - ssize_t nbyte; - if (((nbyte = stream_read_try(client->ibuf, sock, - ZEBRA_HEADER_SIZE - - already)) - == 0) - || (nbyte == -1)) { - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug( - "connection closed socket [%d]", - sock); - zebra_client_close(client); - return -1; - } - if (nbyte != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { + if (already < ZEBRA_HEADER_SIZE) { + nb = stream_read_try(client->ibuf_work, sock, + ZEBRA_HEADER_SIZE - already); + if ((nb == 0 || nb == -1) && IS_ZEBRA_DEBUG_EVENT) + zlog_debug("connection closed socket [%d]", + sock); + if ((nb == 0 || nb == -1)) + goto zread_fail; + if (nb != (ssize_t)(ZEBRA_HEADER_SIZE - already)) { /* Try again later. */ - zebra_event(ZEBRA_READ, sock, client); - return 0; + break; } already = ZEBRA_HEADER_SIZE; } /* Reset to read from the beginning of the incoming packet. */ - stream_set_getp(client->ibuf, 0); + stream_set_getp(client->ibuf_work, 0); /* Fetch header values */ - STREAM_GETW(client->ibuf, length); - STREAM_GETC(client->ibuf, marker); - STREAM_GETC(client->ibuf, version); - STREAM_GETL(client->ibuf, vrf_id); - STREAM_GETW(client->ibuf, command); + hdrvalid = zapi_parse_header(client->ibuf_work, &hdr); - if (marker != ZEBRA_HEADER_MARKER || version != ZSERV_VERSION) { - zlog_err( - "%s: socket %d version mismatch, marker %d, version %d", - __func__, sock, marker, version); - zebra_client_close(client); - return -1; + if (!hdrvalid) { + snprintf(errmsg, sizeof(errmsg), + "%s: Message has corrupt header", __func__); + zserv_log_message(errmsg, client->ibuf_work, NULL); + goto zread_fail; } - if (length < ZEBRA_HEADER_SIZE) { - zlog_warn( - "%s: socket %d message length %u is less than header size %d", - __func__, sock, length, ZEBRA_HEADER_SIZE); - zebra_client_close(client); - return -1; + + /* Validate header */ + if (hdr.marker != ZEBRA_HEADER_MARKER + || hdr.version != ZSERV_VERSION) { + snprintf( + errmsg, sizeof(errmsg), + "Message has corrupt header\n%s: socket %d version mismatch, marker %d, version %d", + __func__, sock, hdr.marker, hdr.version); + zserv_log_message(errmsg, client->ibuf_work, &hdr); + goto zread_fail; } - if (length > STREAM_SIZE(client->ibuf)) { - zlog_warn( - "%s: socket %d message length %u exceeds buffer size %lu", - __func__, sock, length, - (u_long)STREAM_SIZE(client->ibuf)); - zebra_client_close(client); - return -1; + if (hdr.length < ZEBRA_HEADER_SIZE) { + snprintf( + errmsg, sizeof(errmsg), + "Message has corrupt header\n%s: socket %d message length %u is less than header size %d", + __func__, sock, hdr.length, ZEBRA_HEADER_SIZE); + zserv_log_message(errmsg, client->ibuf_work, &hdr); + goto zread_fail; + } + if (hdr.length > STREAM_SIZE(client->ibuf_work)) { + snprintf( + errmsg, sizeof(errmsg), + "Message has corrupt header\n%s: socket %d message length %u exceeds buffer size %lu", + __func__, sock, hdr.length, + (unsigned long)STREAM_SIZE(client->ibuf_work)); + goto zread_fail; } /* Read rest of data. */ - if (already < length) { - ssize_t nbyte; - if (((nbyte = stream_read_try(client->ibuf, sock, - length - already)) - == 0) - || (nbyte == -1)) { - if (IS_ZEBRA_DEBUG_EVENT) - zlog_debug( - "connection closed [%d] when reading zebra data", - sock); - zebra_client_close(client); - return -1; - } - if (nbyte != (ssize_t)(length - already)) { + if (already < hdr.length) { + nb = stream_read_try(client->ibuf_work, sock, + hdr.length - already); + if ((nb == 0 || nb == -1) && IS_ZEBRA_DEBUG_EVENT) + zlog_debug( + "connection closed [%d] when reading zebra data", + sock); + if ((nb == 0 || nb == -1)) + goto zread_fail; + if (nb != (ssize_t)(hdr.length - already)) { /* Try again later. */ - zebra_event(ZEBRA_READ, sock, client); - return 0; + break; } } #if defined(HANDLE_ZAPI_FUZZING) - zserv_write_incoming(client->ibuf, command); + zserv_write_incoming(client->ibuf_work, command); #endif - length -= ZEBRA_HEADER_SIZE; + hdr.length -= ZEBRA_HEADER_SIZE; /* Debug packet information. */ if (IS_ZEBRA_DEBUG_EVENT) @@ -3030,41 +3055,54 @@ static int zebra_client_read(struct thread *thread) sock); if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV) - zlog_debug("zebra message received [%s] %d in VRF %u", - zserv_command_string(command), length, - vrf_id); + zserv_log_message(NULL, client->ibuf_work, &hdr); client->last_read_time = monotime(NULL); - client->last_read_cmd = command; - - zvrf = zebra_vrf_lookup_by_id(vrf_id); - if (!zvrf) { - if (IS_ZEBRA_DEBUG_PACKET && IS_ZEBRA_DEBUG_RECV) - zlog_debug("zebra received unknown VRF[%u]", - vrf_id); - goto zclient_read_out; - } + client->last_read_cmd = hdr.command; - zserv_handle_commands(client, command, length, zvrf); + stream_set_getp(client->ibuf_work, 0); + struct stream *msg = stream_dup(client->ibuf_work); - if (client->t_suicide) { - /* No need to wait for thread callback, just kill - * immediately. - */ - zebra_client_close(client); - return -1; - } - packets -= 1; - stream_reset(client->ibuf); + stream_fifo_push(client->ibuf_fifo, msg); + + if (client->t_suicide) + goto zread_fail; + + --packets; + stream_reset(client->ibuf_work); } -stream_failure: -zclient_read_out: - stream_reset(client->ibuf); - zebra_event(ZEBRA_READ, sock, client); + if (IS_ZEBRA_DEBUG_PACKET) + zlog_debug("Read %d packets", + zebrad.packets_to_process - packets); + + /* Schedule job to process those packets */ + thread_add_event(zebrad.master, &zserv_process_messages, client, 0, + NULL); + + /* Reschedule ourselves */ + zebra_event(client, ZEBRA_READ); + return 0; + +zread_fail: + zebra_client_close(client); + return -1; } +static void zebra_event(struct zserv *client, enum event event) +{ + switch (event) { + case ZEBRA_READ: + thread_add_read(zebrad.master, zserv_read, client, client->sock, + &client->t_read); + break; + case ZEBRA_WRITE: + thread_add_write(zebrad.master, zserv_write, client, + client->sock, &client->t_write); + break; + } +} /* Accept code of zebra server socket. */ static int zebra_accept(struct thread *thread) @@ -3077,7 +3115,7 @@ static int zebra_accept(struct thread *thread) accept_sock = THREAD_FD(thread); /* Reregister myself. */ - zebra_event(ZEBRA_SERV, accept_sock, NULL); + thread_add_read(zebrad.master, zebra_accept, NULL, accept_sock, NULL); len = sizeof(struct sockaddr_in); client_sock = accept(accept_sock, (struct sockaddr *)&client, &len); @@ -3164,26 +3202,7 @@ void zebra_zserv_socket_init(char *path) umask(old_mask); - zebra_event(ZEBRA_SERV, sock, NULL); -} - - -static void zebra_event(enum event event, int sock, struct zserv *client) -{ - switch (event) { - case ZEBRA_SERV: - thread_add_read(zebrad.master, zebra_accept, client, sock, - NULL); - break; - case ZEBRA_READ: - client->t_read = NULL; - thread_add_read(zebrad.master, zebra_client_read, client, sock, - &client->t_read); - break; - case ZEBRA_WRITE: - /**/ - break; - } + thread_add_read(zebrad.master, zebra_accept, NULL, sock, NULL); } #define ZEBRA_TIME_BUF 32 diff --git a/zebra/zserv.h b/zebra/zserv.h index 851969372..62707510c 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -47,8 +47,12 @@ struct zserv { int sock; /* Input/output buffer to the client. */ - struct stream *ibuf; - struct stream *obuf; + struct stream_fifo *ibuf_fifo; + struct stream_fifo *obuf_fifo; + + /* Private I/O buffers */ + struct stream *ibuf_work; + struct stream *obuf_work; /* Buffer of data waiting to be written to client. */ struct buffer *wb; @@ -129,6 +133,10 @@ struct zserv { int last_write_cmd; }; +#define ZAPI_HANDLER_ARGS \ + struct zserv *client, struct zmsghdr *hdr, struct stream *msg, \ + struct zebra_vrf *zvrf + /* Zebra instance */ struct zebra_t { /* Thread master */ @@ -185,7 +193,7 @@ extern void zsend_rule_notify_owner(struct zebra_pbr_rule *rule, extern void zserv_nexthop_num_warn(const char *, const struct prefix *, const unsigned int); -extern int zebra_server_send_message(struct zserv *client); +extern int zebra_server_send_message(struct zserv *client, struct stream *msg); extern struct zserv *zebra_find_client(u_char proto, u_short instance); |