 Donald Sharp | 9487b4fcfc0watchquagga.c does not compile without warnings
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | watchquagga.c does not compile without warningsSigned-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Donald Sharp | cd557c3d766 | pim: 'show debugging' collisionThe 'show debugging' cli as setup by pim collided with 'show debugging isis'.
Fix that and clean up cli help commands to actually display correctly.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Donald Sharp | 08d95905acd | Fixup of redhat control files to properly start pimd | | |
 Joakim Tjernlund | 4de398e3b67 | ospfd: ospf_nbr_nbma_set()/ospf_snmp_vl_add() add unlockSigned-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com> | | |
 Joakim Tjernlund | 4eaecdc4034 | ospfd: ospf_ls_upd_send() add missing unlock.Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com> | | |
 Joakim Tjernlund | fc363cd8a02 | ospfd: ospf_ase.c, external_lsa locking fixes.Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com> | | |
 Joakim Tjernlund | d5643f5a477 | ospfd: Move route_unlock_node() in ospf_ase_incremental_update()Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com> | | |
 Joakim Tjernlund | fbb6c865034 | ospfd: add missing unlock for ospf_interface_address_delete()Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Feng Lu <lu.feng@6wind.com> | | |
 Joakim Tjernlund | 94266fa822b | ospfd: Self nbrs needs to be rebuilt when router ID changes.Some self nbrs are identified by router_id, these needs
to be rebuilt instead of just resetting router ID.
Possibly one could optimize for !(virtual | ptop) links
by doing oi->nbr_self->router_id = router_id instead.
Router ID will change once after startup config has been
read and zebra reports router ID, unless router ID has
been configured in ospf. | | |
 Donald Sharp | 7f56743f7d4 | pimd assert when no route to source from a new igmp joinWhen pim_upstream_new is called the code looks up the nexthop.
If there is no route to the source, the code silently ignored
the error returned. When the nexthop lookup fails don't create
the 'struct pim_stream *' to return.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Donald Sharp | b1891fb9705 | Add code to extract.pl.in to prevent further cli function overwritesCurrently extract.pl.in is used to build the vtysh cli. When two
different cli's collide with the same command name, the original
cli is never called, because it is dropped. This code notes the
silent drop and tracks the number of drops. If they change then
the code will fail the build. The current number of drops was
figured out by running extract.pl and counting up the drops
then adding c... | | |
 Donald Sharp | 1934e7895de | pim_mroute.h has a different version of code than linux/mroute.h provideslinux/mroutes.h and pim_mroute.h both have copies of the same structures.
This is causing failures in setsockopt(..., MRT_ADD_MFC,...) because
of data structure incompatibilities between the kernel and what
pim_mroute.h was providing. Modify the code to check for mroute.h
and include it if necessary. I did not modify the non linux/mroute.h
path because I do not have other systems to test on e... | | |
 Donald Sharp | f31bab4fbf3 | Quagga: Fix code to use srandom/randomQuagga was using a mix of srand/rand and srandom/random.
Consolidate to use srandom/random which are the POSIX
versions of random number generators
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Donald Sharp | 771626860ad | PIMD: Fix code to use srandom/randompimd rolled it's own solution to random #'s, that was not
terribly random. Rely on the underlying system to generate
random #'s for us
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Wenjian Ma | 1ed8ce47b92 | lib, stream: fix stream sanity checksBecause operator "!" has higher priority than "&&",
So we put the "&&" expression in "()" to check both getp and endp.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
Paul Jakma | 84c3840c715 | bgpd: peer_uptime overflows after 1 year* bgpd.c: (peer_uptime) Wraps after 1 year, and doesn't indicate years.
Fix. Assume a year is 365 days, for an easy life.
Fixes: Bug #836
Reported-by: Rolf Hanßen
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com> | | |
 Feng Lu | 55cfa2f1906 | lib, vtysh: support multiple VRFs by using linux netnsWe realize VRFs with linux netns by default. The main job is
to associate a VRF with a netns. Currently this is done by
the configuration:
[no] vrf N netns <netns-name>
This command is also available in vtysh and goes to only
zebra, because presently only zebra supports multiple VRF.
A file descriptor is added to "struct vrf". This is for the
associated netns file. Once the command "vrf N ... | | |
 Feng Lu | c99f3481a59 | *: add VRF ID in the API message headerThe API messages are used by zebra to exchange the interfaces, addresses,
routes and router-id information with its clients. To distinguish which
VRF the information belongs to, a new field "VRF ID" is added in the
message header. And hence the message version is increased to 3.
* The new field "VRF ID" in the message header:
Length (2 bytes)
Marker (1 byte)
Version (1 byt... | | |
 Feng Lu | 758fb8f99a7 | zebra, lib/memtypes.c: the netlink sockets work per VRFThis patch lets the netlink sockets work per VRF.
* The definition of "struct nlsock" is moved into zebra/rib.h.
* The previous global variables "netlink" and "netlink_cmd" now
become the members of "struct zebra_vrf", and are initialized
in zebra_vrf_alloc().
* All relative functions now work for a specific VRF, by adding
a new parameter which specifies the working VRF, except those
... | | |
David Lamparter | d6cf5134c05 | zebra: fix VRF code for *BSDThere seems to be no rtm_table in struct rt_msghdr, at least on the
systems I have access to...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Feng Lu | 49f76097fc1 | zebra: maintain RTADV per VRFThis moves the global variable "rtadv" into the "struct zebra_vrf",
so that RTADV feature can work per VRF.
* rtadv.c/rtadv.h:
Add a proper parameter to the functions so that the entity of the
"struct zebra_vrf" and interfaces can be obtained from the specified
VRF.
The old rtadv_init() is splitted into:
- rtadv_cmd_init(): it installs the RTADV commands; is called from
... | | |
 Feng Lu | 267ceb2ce3a | zebra: add hooks upon enabling / disabling a VRFzebra_vrf_enable() is the callback for VRF_ENABLE_HOOK.
It presently needs do nothing.
zebra_vrf_disable() is the callback for VRF_DISABLE_HOOK.
It presently withdraws routes, shuts down interfaces, and
clears the router-id candidates in that VRF.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind... | | |
 Feng Lu | fb2bfc1ba24 | lib/vrf: enable / disable a VRFA new API vrf_is_enabled() is defined to check whether a VRF is ready
to use, that is, to allocate resources in that VRF. Currently there's
only one type of resource: socket.
Two new hooks VRF_ENABLE_HOOK/VRF_DISABLE_HOOK are introduced to tell
the user when a VRF gets ready or to be unavailable.
The VRF_ENABLE_HOOK callback is called in the new function vrf_enable(),
which is used to let the... | | |
 Feng Lu | ac19a449261 | zebra: maintain the router-id per VRFA router may need different identifier among the VRFs. So move the
maintenance of router-id per VRF.
* rib.h:
Move the previous global variables in router-id.c into the
"struct zebra_vrf":
- struct list _rid_all_sorted_list/*rid_all_sorted_list
- struct list _rid_lo_sorted_list/*rid_lo_sorted_list
- struct prefix rid_user_assigned
* router-id.c/router-id.h:
A new parameter "vrf_... | | |
 Feng Lu | 7aaf4ea9903 | zebra: configure static routes in any VRFIntroduce new commands to configure static routes in any VRF, by
appending the old static route commands with a new parameter
"vrf N".
A new parameter "const char *vrf_id_str" is added to the functions
zebra_static_ipv4() and static_ipv6_func() to get the configured
VRF ID.
A new member "vrf_id" is added to the "struct static_ipv4" and
"struct static_ipv6", indicating which VRF this static ro... | | |
 Feng Lu | 8970f74ec77 | zebra: lookup the address in all VRFs when set the route-map rule "set src"When configuring the route-map rule "set src A.B.C.D", it checked
whether the source address exists on some interface.
Now it checks the source address throughout all VRFs.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: Da... | | |
 Feng Lu | 1885d0a5274 | zebra: let the route-map rule "match interface" work for VRFsIntroduce a new "struct nexthop_vrfid" to specify a nexthop together
with the VRF ID it belongs to.
Thus in route_match_interface(), we can lookup the interface from
the correct VRF.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-... | | |
 Feng Lu | 4364ee5b6f6 | zebra: show routes in a specified VRF or all VRFsThe present "show ip[v6] [m]route [xxx]" and "show ip rpf [xxx]"
commands now show routes only in the default VRF.
A new option is introduced to show routes in a specified VRF:
show ip[v6] [m]route [xxx] vrf N
show ip rpf [xxx] vrf N
and a new option is used to show routes through all VRFs:
show ip[v6] [m]route [xxx] vrf all
show ip rpf [xxx] vrf all
Signed-off-by: Feng Lu <l... | | |
 Feng Lu | 0d0686f98e6 | zebra: let FIB stand for its respective VRFA new member "vrf_id" is added to "struct rib", reflecting the VRF
which it belongs to.
A new parameter "vrf_id" is added to the relative functions where
need, except those:
- which already have the parameter "vrf_id"; or
- which have a parameter in type of "struct rib"; or
- which have a parameter in type of "struct interface".
All incoming routes are set to default VRF.
In fact, all routes... | | |
 Feng Lu | a2854770ff8 | zebra: show interfaces in a specified VRF or all VRFsThe following commands only show interfaces in the default VRF:
show interface
show interface IFNAME
show interface description
New options are introduced to show interfaces in a specified VRF:
show interface vrf N
show interface IFNAME vrf N
show interface description vrf N
or all VRFs:
show interface vrf all
show interface IFNAME vrf all
show interface de... | | |
 Feng Lu | 471ea39ce54 | lib, zebra, vtysh: configure an interface in non-default VRFIntroduce a new command "interface IFNAME vrf N" to configure an
interface in the non-default VRF.
Till now, only zebra uses this command. Other daemons will install
the command when they support multiple VRFs.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vince... | | |
 Feng Lu | 5a5702fac54 | lib: move the interface list into "struct vrf"An interface belongs to a specific VRF. So move the interface list
into the "struct vrf".
* vrf.c/vrf.h:
- add a new member "struct list *iflist" to the the "struct vrf";
- call if_init() in vrf_new();
- call if_terminate() in vrf_delete();
- add utilities to access the interface list and VRF ID in the
specified VRF.
* if.c/if.h:
- the global "iflist" now only exists for the def... | | |
 Feng Lu | 126215c1238 | *: call if_init()/if_terminate() from vrf_init()/vrf_terminate()Later, an interface will belong to a specific VRF, and the interface
initialization will be a part of the VRF initialization. So now call
if_init() from vrf_init(), and if_terminate() from vrf_terminate().
Daemons have the according changes:
- if if_init() was called or "iflist" was initialized, now call
vrf_init() instead;
- if if_terminate() was called or "iflist" was destroyed, now call
... | | |
 Feng Lu | 2fc97f6335d | lib, zebra: add "vrf_id" into the "struct interface"Later, an interface will belong to a specific VRF. Now we add a
property "vrf_id" to the "struct interface", and keep it as the
default value 0.
This property is shown when displaying interfaces information.
It is also added in some logs.
This is just the preparation to move the interace list into the
"struct vrf". The main logic is not changed.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Rev... | | |
 Feng Lu | 41f44a23e86 | lib, zebra: move "struct vrf" to be a lib modulePreviously "struct vrf" is defined locally in zebra. Now it is moved
to be a lib module.
This is the first step to support multi-VRF in quagga. The
implementation is splitted into small patches for the purpose of
easy review.
* lib:
"struct vrf" with basic members is defined in vrf.c. The member
"void *info" is for user data.
Some basic functions are defined in vrf.c for adding/d... | | |
 Feng Lu | 395828eea80 | ospf6d, bgpd: avoid calling if_nametoindexAs the comments in if.h, it is better to call ifname2ifindex()
instead of if_nametoindex().
And ifname2ifindex() can work for VRF by appending a parameter
while if_nametoindex() can not.
Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Sig... | | |
 Timo Teräs | be6335d682c | zebra: use prefix2str for logging where possibleThis makes code more robust, consice and readable.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 53a5c39c705 | zebra/vty: use prefix2str and unify show ip/ipv6 route codeUse prefix2str where possible. As now ip/ipv6 are practically
identical, they are merged removing unneeded code duplication.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 41eb9a4305f | lib: make prefix2str simpler to use, and use it in zclientReturning the buffer allows using it in the logging functions
in easier way. This also makes the API consistent with sockunion.
Add also PREFIX_STRLEN to be the generic buffer length required
for any prefix string representation.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 53009d387a6 | lib: make sockunion2str safer to useIt's mostly used for logging, and the return value is never
checked, so try to make it valid.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 3293bc280f1 | route table: constify some APIsSigned-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | f85592e05ae | zebra: simplify redistribution codeMerge the conditionals as one to avoid code duplication.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 483abc037b0 | sockunion: add accessors for sockunion addressUpcoming nhrp code will use this, and it can be used to remove
the sockunion2ip(X) macro.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | c1c69e43cda | lib: allow caller to provide prefix storage in sockunion2hostprefixAvoids a dynamic allocation which is usually freed immediate afterwards.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Timo Teräs | 80c9354835b | privs: fix privilege dropping to use system defined groupsIt may be requred for quagga process to belong to additional
groups. E.g. nhrp module will need to talk to strongSwan using
vici and may require additional permissions. Initialize groups
from the system group database.
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
David Lamparter | d79668fb440 | tests: add testcli reference in/out & do DejaGNUThis adds reference in & output for the previously added testcli tool,
to check basic CLI parsing/help functions. Unlike "testcommands", this
one doesn't depend on compile-time system details.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
David Lamparter | db93eec18d8 | tests: add CLI dummy command-exec toolThis adds some common CLI testtool code as well as a tool that has a
bunch of commands to be poked for their correct processing.
The tool doesn't work correctly from a script at stdin at this point
because the vty code will throw away all buffered when it sees EOF, so
the tail end of the input file is lost.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
David Lamparter | 05a69d2f383 | Revert "lib: wrong #define used for IPV6_MINHOPCOUNT"This reverts commit 54b88cac24f335414caa875b390d2d78ff4bf9e0.
Unfortunately, this breaks the build on systems where linux/in6.h and
netinet/in.h can't both be included, such as Ubuntu 14.04 and Debian
Jessie.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> | | |
 Feng Lu | 72855b16b72 | ripngd: allow to enable/disable the ECMP featureIntroduce a new command "[no] allow-ecmp" to enable/disable the
ECMP feature in RIPng. By default, ECMP is not allowed.
Once ECMP is disabled, only one route entry can exist in the list.
* ripng_zebra.c: adjust a debugging information, which shows the number
of nexthops according to whether ECMP is enabled.
* ripngd.c: ripng_ecmp_add() will reject the new route if ECMP is not... | | |
 Feng Lu | e97c31aafc0 | ripngd: add ECMP support* Each node in the routing table is changed into a list, holding
the multiple equal-cost paths.
* If one of the multiple entries gets less-preferred (greater
metric or greater distance), it will be directly deleted instead
of starting a garbage-collection timer for it.
The garbage-collection timer is started only when the last entry
in the list gets INFINITY.
* Some new functions ar... | | |