Commit Graph

404 Commits

Author SHA1 Message Date
David Lamparter
a8b828f3c3 *: remove empty "interface XYZ" config blocks
Using the previously-added vty_frame() support, this gets rid of all the
pointless empty "interface XYZ" blocks that get added for any interface
that shows up in the system (e.g. dummys, tunnels, etc.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-29 08:36:03 +02:00
Mitesh Kanjariya
09fdc88c8c Merge branch 'master' into dev-master 2017-08-28 18:19:03 -07:00
David Lamparter
a07df329e9 zebra: add '[no] ip address A.B.C.D peer A.B.C.D/M'
introduce a new command to configure a Point-to-Point address on an
interface.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-27 23:40:34 +02:00
David Lamparter
a3008857cb zebra: fix interface deletion bug introduced by ptp address support
meh. forgot to even look at the interface deletion path. this doesn't
really work well when looking for the local address in the subnet list
which has the connected prefix in it... loop ensues.

fix by using the connected prefix when looking at the list of connected
prefixes. duh.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-27 23:40:23 +02:00
David Lamparter
abffde07a3 zebra: add connected_check_ptp infrastructure
add a connected_check_ptp function which does the same as
connected_check, but takes an additional peer prefix argument.

also fix related prefixlen mixup in PtP addresses (the local part of a
PtP address always is /32, but previously the peer mask got copied.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-27 23:31:02 +02:00
Renato Westphal
0af35d90a1 *: fix assorted issues detected by Coverity Scan
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-24 21:49:39 -03:00
Mitesh Kanjariya
71349e0358 zebra: lookup link by ifindex
Frr has an assumption that when interface A links to B,
we already know about B. But that might be true always.
It is probably purely depends on the configuration
and how the interfaces are hashed in Kernel.
FRR seems to sometimes get "A is linked to B" before it knows about B,
in that case, the linkage between the data structure for A & B won't be proper.

Ticket: CM-17679
Review: ccr-6628
Testing: Manual

Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
2017-08-20 06:10:38 -07:00
David Lamparter
2eb27eecf0 zebra: start detangling rtadv & irdp
Replace some cross-dependencies with hooks & move bits to where they
belong.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-15 13:25:44 +02:00
David Lamparter
ce19a04aea lib: replace if_add_hook with hook_* logic
This allows modules to register their own additional hooks on interface
creation/deletion.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-15 13:25:44 +02:00
David Lamparter
6201e30b57 zebra: vrf: remove VRF-move static route updating
This was incorrectly implemented to begin with (it only re-added routes,
but didn't remove them) and is now covered in static_ifindex_update.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-06 07:50:18 +02:00
David Lamparter
c3c0406378 zebra: static: update on ifindex changes
Whenever an interface is created or deleted in the system, we need to
check whether we have static routes referencing that interface by name.
If so, we need to [un]install these routes.

This has the unfortunate side effect of making static routes with
non-existent interfaces disappear from "show ip route", but I think
that's acceptable (and I don't see a "good" fix for that).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-06 05:17:09 +02:00
David Lamparter
9d303b37d7 Revert "*: reindent pt. 2"
This reverts commit c14777c6bf.

clang 5 is not widely available enough for people to indent with.  This
is particularly problematic when rebasing/adjusting branches.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-22 14:52:33 +02:00
Quentin Young
8ed86a5d20 Merge pull request #828 from tigranmartirosyan/master
#752 ARP is not updating if mac address changed on remote side
2017-07-18 12:11:35 -04:00
tmartiro
f26bc77358 Add 1 more identation to correspond to kernel style multi-line comment 2017-07-18 19:06:57 +03:00
tmartiro
d1479ec895 replace space to tabs, add kernel styles multiline, remove trailing whitespaces. 2017-07-18 10:34:21 +03:00
whitespace / reindent
c14777c6bf
*: reindent pt. 2
w/ clang 5

* reflow comments
* struct members go 1 per line
* binpack algo was adjusted
2017-07-17 15:26:02 -04:00
tmartiro
a8a4fa8954 merge with upstream 2017-07-17 17:23:20 +03:00
whitespace / reindent
d62a17aede *: reindent
indent.py `git ls-files | pcregrep '\.[ch]$' | pcregrep -v '^(ldpd|babeld|nhrpd)/'`

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-17 14:04:07 +02:00
Donald Sharp
2850f0ea58 bgpd, zebra: Cleanup warnings from new code
1) Clean up VTY_NEWLINE -> \n
2) Remove usages of VTY_GET_INTEGER

Signed-off-by: Donald Sharp
2017-07-14 08:52:45 -04:00
Donald Sharp
1ea6b3f237 Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:24:46 -04:00
Donald Sharp
da571b7a6c Merge remote-tracking branch 'origin/master' into evpn_plus_struct_attr 2017-07-14 08:11:05 -04:00
David Lamparter
2d8270596a Merge remote-tracking branch 'frr/master' into newline-redux
Lots of conflicts from CMD_WARNING_CONFIG_FAILED...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 13:07:30 +02:00
David Lamparter
55f70b671f *: remove VTYNL, part 4 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
61b7d449bd *: remove VTYNL, part 3 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:03 +02:00
David Lamparter
6d3c2ed4ed *: remove VTYNL, part 1 of 6
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:20:02 +02:00
David Lamparter
181039f3d7 *: ditch vty_outln(), part 2 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-14 10:19:58 +02:00
Daniel Walton
f1a05de982 vtysh: return non-zero for configuration failures
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>

This allows frr-reload.py (or anything else that scripts via vtysh)
to know if the vtysh command worked or hit an error.
2017-07-13 19:56:08 +00:00
David Lamparter
5c7571d43f *: ditch vty_outln(), part 1 of 2
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-07-13 20:29:22 +02:00
vivek
2232a77c2b zebra: MAC and Neighbor (ARP/ND) handling
Implement handling of MACs and Neighbors (ARP/ND entries) in zebra:
- MAC and Neighbor database handlers
- Read MACs and Neighbors from the kernel, when needed and create
entries in zebra's MAC and Neighbor databases.
- Handle add/update/delete notifications from the kernel for MACs and
Neighbors and update zebra's database appropriately
- Inform locally learnt MACs and Neighbors to client
- Handle MACIP add/delete from client and install appriporiate entries
into the kernel
- Since Neighbor entries will be installed on an SVI, implement the
needed mappings

NOTE: kernel interface is only implemented for Linux/netlink

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:29:25 -04:00
vivek
13d60d351c zebra: VNI and VTEP handling
Implement fundamental handling for VNIs and VTEPs:
- Handle EVPN enable/disable by client (advertise-all-vni)
- Create/update/delete VNIs based on VxLAN interface events and inform
client
- Handle VTEP add/delete from client and install into kernel
- New debug command for VxLAN/EVPN
- kernel interface (Linux/netlink only)

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:26:02 -04:00
vivek
6675513d00 zebra: Layer-2 interface handling
Define interface types of interest and recognize the types. Store layer-2
information (VLAN Id, VNI etc.) for interfaces, process bridge interfaces
and map bridge members to bridge. Display all the additional information
to user (through "show interface").

Note: Only implemented for the netlink interface.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
2017-07-12 12:22:19 -04:00
tigranmartirosyan
a08b8b0f17 fix #752 problem: ARP is not updating if mac address changed on remote side 2017-07-03 23:05:58 +04:00
Jafar Al-Gharaibeh
fd576f61bc Merge pull request #767 from donaldsharp/if_update
bgpd, lib, zebra: Fix if_update function to represent what it does
2017-06-29 23:42:21 -05:00
Quentin Young
e31b6333f4 *: vty_outln (vty, "") --> vty_out (vty, VTYNL)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:56 +00:00
Quentin Young
1318e7c841 *: s/VTY_NEWLINE/VTYNL/g
Should be able to fit more vty_out onto one line now

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:34:54 +00:00
Quentin Young
96ade3ed77 *: use vty_outln
Saves 400 lines

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-29 17:31:28 +00:00
Donald Sharp
16895dbf73 bgpd, lib, zebra: Fix if_update function to represent what it does
The if_update function was taking the interface name as
input and reapplying it, using strncpy to reapply the name.
This has several issues.  strncpy should not be used
to copy memory in place.  The second issue is that
the interface name is not actually changing when we
update interface to be in the new vrf.

Since every usage of if_update was just reapplying the same
name the interface actually had, just remove that part of
the function and rename it to if_update_to_new_vrf
to represent what it is actually doing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-29 09:09:23 -04:00
Quentin Young
facfee22f5 *: remove VTY_GET_*
CLI validates input tokens, so there's no need to do it in handler
functions anymore.

spatch follows
----------------

@getull@
expression v;
expression str;
@@
<...
- VTY_GET_ULL(..., v, str)
+ v = strtoull (str, NULL, 10)
...>

@getul@
expression v;
expression str;
@@
<...
- VTY_GET_ULONG(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getintrange@
expression name;
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER_RANGE(name, v, str, ...)
+ v = strtoul (str, NULL, 10)
...>

@getint@
expression v;
expression str;
@@
<...
- VTY_GET_INTEGER(..., v, str)
+ v = strtoul (str, NULL, 10)
...>

@getv4@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_ADDRESS(..., v, str)
+ inet_aton (str, &v)
...>

@getv4pfx@
expression v;
expression str;
@@
<...
- VTY_GET_IPV4_PREFIX(..., v, str)
+ str2prefix_ipv4 (str, &v)
...>

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2017-06-27 19:04:41 +00:00
Alex Couloumbis
9c3bf1cee7 zebra: Fix --disable-rtadv to actually compile
Signed-off-by: Alex Couloumbis <alex@ozo.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-06-08 07:57:25 -04:00
Donald Sharp
57282a31cf zebra: Add code to track kernel interactions
Allow zebra to track kernel interactions.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-18 13:14:18 -04:00
David Lamparter
57463530f3 Merge branch 'stable/3.0'
Conflicts:
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/interface.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:28:12 +02:00
David Lamparter
92eedda1fb Merge branch stable/2.0 into stable/3.0
Conflicts:
	bgpd/bgp_fsm.c
	ospf6d/ospf6_lsa.c
	ospfd/ospf_vty.c
	zebra/redistribute.c

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-18 12:23:13 +02:00
Don Slice
9c5cd62f08 zebra: Move interfaces to default before deleting
Encountered a crash in zebra due to getting a delete on an SVI with
VRR configured.  Since we don't actually do a delete but flag the interface
as inactive, slag VRR interfaces would remain on the vrf_iflist with a lock
count of zero, causing the crash.  Since all other interface types are moved
to the default table before deleting, doing the same thing for any interfaces
that were left in the vrf.

Testing includes manual testing, bgp-min, ospf-min, vrf-min, bgp-smoke, and ospf-smoke.
All passed (first time or on rerun) or match known failures.

Ticket: CM-13288
Signed-off-by: Don Slice
Reviewed-by: Donald Sharp
2017-05-17 08:18:14 -04:00
David Lamparter
896014f4bc *: make consistent & update GPLv2 file headers
The FSF's address changed, and we had a mixture of comment styles for
the GPL file header.  (The style with * at the beginning won out with
580 to 141 in existing files.)

Note: I've intentionally left intact other "variations" of the copyright
header, e.g. whether it says "Zebra", "Quagga", "FRR", or nothing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-05-15 16:37:41 +02:00
Donald Sharp
6281320446 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-08 16:51:21 -04:00
Renato Westphal
313605cb92 *: fix a bunch of segfaults detected by a CLI fuzzer
This patch fixes the following segfaults:
zebra aborted: vtysh -c "show ipv6 mroute"
zebra aborted: vtysh -c "configure terminal" -c "debug zebra kernel msgdump"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no packet-loss"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no metric"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no ava-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no res-bw"
zebra aborted: vtysh -c "configure terminal" -c "interface eth99" -c "link-params" -c "no use-bw"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 1.1.1.1 nssa"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "area 4294967295 nssa"
pimd aborted: vtysh -c "show ip msdp sa 1.1.1.1"
pimd aborted: vtysh -c "configure terminal" -c "ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip ssmpingd"
pimd aborted: vtysh -c "configure terminal" -c "no ip msdp mesh-group WORD source"
pimd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "ip pim hello 180"
bgpd aborted: vtysh -c "show bgp l2vpn evpn rd 1:1"
bgpd aborted: vtysh -c "clear vnc nve un *"
bgpd aborted: vtysh -c "clear vnc nve un 1.1.1.1"
bgpd aborted: vtysh -c "clear vnc nve un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 1.1.1.1 un 2001:db8::1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 1.1.1.1"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255 lifetime 4294967295"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1 cost 255"
bgpd aborted: vtysh -c "add vnc mac 11:11:11:11:11:11 virtual-network-identifier 4294967295 vn 2001:db8::1 un 2001:db8::1"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export bgp route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv4 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra ipv6 prefix-list NAME"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp 1" -c "no vnc export zebra route-map NAME"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "no set ipv6 vpn next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv4 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "route-map RMAP permit 1" -c "set vpnv6 next-hop"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family ipv6 vpn" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "address-family vpnv6 unicast" -c "network 2001:db8::1/128 rd 1:1 tag WORD"
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "no neighbor WORD shutdown message MSG..."
bgpd aborted: vtysh -c "configure terminal" -c "router bgp" -c "neighbor WORD shutdown message MSG..."

More to come later.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-04 14:39:58 -03:00
Donald Sharp
05ba625af7 Merge remote-tracking branch 'origin/stable/3.0' 2017-05-02 15:52:09 -04:00
Renato Westphal
b8af3fbbaf zebra: fix detection of interface renames
Restore the original logic in netlink_link_change() which works like this:
* once an interface event is detected, lookup the associated interface
  by its name;
* call the set_ifindex() function;
* set_ifindex() will lookup the interface again but now by its ifindex. If
  the lookups by name and ifindex yield to different results, then the
  interface was renamed and set_ifindex() will take care of that.

In the future, zns->if_table will be split into two different data
structures to allow faster lookups by both name and ifindex.

Fixes Issue #397.

Regression introduced by commit 12f6fb9.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-05-01 09:19:47 -03:00
Renato Westphal
ef04b19249 lib: fix segfault on exit caused by interface removal
Add missing bits to properly unlink interface in the if_unlink_per_ns()
function.

In the long term we should convert if_table to use a more convenient
data structure like a red-black tree instead of a routing table.

Fixes issue #398.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-04-28 15:38:00 -03:00
Don Slice
ef01549170 zebra: stop crash on process termination due to stale ifp->node
Problem reported that crash occurred when stopping quagga in certain
circumstances.  Determined that this was due to a stale pointer on the
ifp for a deleted interface.  The ifp->node had been freed but the ifp
still kept a pointer to it, and when later the process was stopped, it
attempted to delete it again.

Ticket: CM-15550
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-18 09:46:19 -04:00
Donald Sharp
97d2cd8d0c zebra: Fix printf formatting
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-04 07:50:31 -04:00
Donald Sharp
6f4c7f7476 zebra: Display new speed information in 'show int..' command
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-04-03 14:49:35 -04:00
David Lamparter
505e50567f *: apply DEFUN_NOSH for node-switch CLI commands
These have copies in vtysh that do the node-switch locally and are
listed in extract.pl's ignore list.  The ignore list however is
redundant since DEFUN_NOSH does the same thing...

ldpd is a bit hacky, but Renato is reworking this anyway.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-03-28 15:48:07 -04:00
Donald Sharp
f15dd9a4ee bgpd, lib, zebra: Rename if_update_vrf -> if_update
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:55:42 -04:00
Donald Sharp
1306c09a1b *: Refactor if_lookup_by_name to be VRF aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-03-15 10:36:23 -04:00
Donald Sharp
56c1f7d852 frr: Remove HAVE_IPV6 from code base
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-01-13 08:05:50 -05:00
Olivier Dugeon
daf0a4d29c Rationalize Link Parameters flags
* lib/if.h: Remove LP_TE as Link Parameters is set if different from 0
See IS_LINK_PARAMS_SET macro and use LP_TE_METRIC to determine if TE metric
is set or not
 * lib/if.c: replace LP_TE by LP_TE_METRIC in default LP status
 * zebra/interface.c: replace LP_TE by LP_TE_METRIC and check if TE metric
is equal to standard metric or not
 * ospfd/ospf_te.c: replace LP_TE by LP_TE_METRIC
 * isisd/isis_te.c: replace LP_TE by LP_TE_METRIC

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2017-01-05 08:19:11 +01:00
David Lamparter
d7d73ffc8f *: fix up DEFUNs without install_element calls
These now generate warnings which will break the build with -Werror.

Note this may have enabled commands that should be disabled, or the
other way around...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05 20:28:24 +01:00
David Lamparter
7ddcfca4fb Merge branch 'queue/osr/vtysh-generic'
WARNING: Merge contains nontrivial fixups in vrf_cmd handling.

Conflicts:
	lib/if.c
	zebra/interface.c
2016-12-05 20:04:08 +01:00
David Lamparter
53dc2b05c7 Merge branch 'stable/2.0'
Conflicts:
	bgpd/bgp_route.c
	lib/if.c
	ripd/rip_interface.c
	zebra/interface.c
	zebra/zebra_vty.c
2016-12-05 19:48:38 +01:00
David Lamparter
8ab22cd4be Merge branch '-renato' into stable/2.0
This contains bgp memory leak fixes as well as cleanups to VRF/namespace
handling and has been run through extended testing in Cumulus' testbed:

Tested-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-12-05 16:23:28 +01:00
Donald Sharp
b6a9e7b487 lib, zebra: Minimize display of link-params sub data
When link-params is configured it auto starts displaying
6000-02# conf t
dell-s6000-02(config)# int swp1
dell-s6000-02(config-if)# link-params
dell-s6000-02(config-link-params)# admin-grp 0x12345678
dell-s6000-02(config-link-params)# end
dell-s6000-02# show run

interface swp1
 link-params
  enable
  metric 0              <----Remove the bw lines
  max-bw 1.25e+06
  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 305419896
  exit-link-params
!

I'd like to reduce this to:

interface enp0s3
 ip igmp
 ip pim sm
 link-params
  enable
  admin-grp 0x12345678    <----- Fix this to be what we entered
  exit-link-params
!

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-05 16:02:46 +01:00
David Lamparter
0b84f29490 *: make DEFUN installations file-local
This moves all install_element calls into the file where the DEFUNs are
located.  This fixes several small related bugs:

- ospf6d wasn't installing a "no interface FOO" command
- zebra had a useless copy of "interface FOO"
- pimd's copy of "interface FOO" was not setting qobj_index, which means
  "description LINE" commands would fail with an error

The next commit will do the actual act of making "foo_cmd" static.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 17:25:56 +01:00
David Lamparter
0577b824e1 Merge branch 'stable/2.0' 2016-12-01 17:24:03 +01:00
Christian Franke
aa86a160f4 zebra: check ZEBRA_IFC_REAL on if_up
Only connected routes which have ZEBRA_IFC_REAL set should
be redistributed.

Signed-off-by: Christian Franke <nobody@nowhere.ws>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-12-01 16:38:36 +01:00
Renato Westphal
a62c490110 zebra: order VRFs by name on user output
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Renato Westphal
5f3d1bdf3c *: rename two vrf functions
Since VRFs can be searched by vrf_id or name, make this explicit in the
helper functions.

s/vrf_lookup/vrf_lookup_by_id/
s/zebra_vrf_lookup/zebra_vrf_lookup_by_id/

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Renato Westphal
1a1a70655c lib: convert vrf code to use red-black trees as well
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Renato Westphal
f30c50b992 zebra/lib: move some code around
* move netlink code from zebra_nc.c to kernel_netlink.c;
* move vrf CLI commands from if.c/interface.c to vrf.c/zebra_vrf.c;
* move declaration of the 'ns' structure to a header file.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:18:35 -02:00
Renato Westphal
58ac32e2d5 zebra/lib: plug several memleaks
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-11-28 16:15:27 -02:00
Quentin Young
3bd20d8460 Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	zebra/interface.c
2016-11-22 21:36:54 +00:00
Donald Sharp
03f99d9a4d vtysh, zebra: Fix link-params to use exit-link-params
Fix the link-params submode to use the 'exit-link-params'
to indicate we are exiting a submode.

Fixup all the relevant bits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-11-18 15:42:41 -05:00
David Lamparter
95c2af68ea zebra: fix link-params CLI handling
vtysh was breaking in a rather ugly way, and some "no" forms were
missing too.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-11-12 17:45:11 +09:00
Quentin Young
e52702f29d Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>

Conflicts:
	bgpd/bgp_route.c
	bgpd/bgp_routemap.c
	bgpd/bgp_vty.c
	isisd/isis_redist.c
	isisd/isis_routemap.c
	isisd/isis_vty.c
	isisd/isisd.c
	lib/command.c
	lib/distribute.c
	lib/if.c
	lib/keychain.c
	lib/routemap.c
	lib/routemap.h
	ospf6d/ospf6_asbr.c
	ospf6d/ospf6_interface.c
	ospf6d/ospf6_neighbor.c
	ospf6d/ospf6_top.c
	ospf6d/ospf6_zebra.c
	ospf6d/ospf6d.c
	ospfd/ospf_routemap.c
	ospfd/ospf_vty.c
	ripd/rip_routemap.c
	ripngd/ripng_routemap.c
	vtysh/extract.pl.in
	vtysh/vtysh.c
	zebra/interface.c
	zebra/irdp_interface.c
	zebra/rt_netlink.c
	zebra/rtadv.c
	zebra/test_main.c
	zebra/zebra_routemap.c
	zebra/zebra_vty.c
2016-10-17 23:36:21 +00:00
Donald Sharp
0b1442e37b *: Consolidate all double VIEW_NODE and ENABLE_NODE's
If a command is put into the VIEW_NODE, it is going into the
ENABLE_NODE as well.  This is especially true for show commands.
As such if a command is in both consolidate it down to VIEW_NODE.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-10-07 21:05:06 -04:00
David Lamparter
3ddccf1805 zebra: use qobj and enable concurrent config edits
This puts all the proper VTY_DECLVAR_CONTEXT calls in place, removing
all vty->index uses in the process.  With that, vty_config_lockless can
be enabled in zebra.

[v2: fix ordering screw-up in "interface XXX" command]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2016-10-07 09:09:52 -04:00
Daniel Walton
00d7d2d345 bgpd and zebra: scrubbed argc CHECK MEs
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 18:21:36 +00:00
Daniel Walton
67656e9b65 all: added CHECK ME for DEFUNs that look at argc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-29 17:48:57 +00:00
Quentin Young
b62ecea584 zebra: finish all zebra CHECK ME's
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2016-09-28 04:47:43 +00:00
Daniel Walton
9ccf14f739 Expand #defines in command strings
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 14:10:48 +00:00
Daniel Walton
92300491f6 zebra: CHECK ME fixes
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-25 03:00:04 +00:00
Daniel Walton
7c022376c8 zebra: add 'int idx_foo' argv index variables
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 19:26:31 +00:00
Daniel Walton
6147e2c694 convert <1-255> to (1-255), ()s to <>s, etc
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 13:47:20 +00:00
Daniel Walton
f412b39a33 ALIAS removal for bgp, ospf, pim, isis, rip, ripng, lib and zebra
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-23 03:55:26 +00:00
Daniel Walton
8b3f067710 zebra: argv update for all but zebra_vty.c
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-09-22 20:00:23 +00:00
Daniel Walton
bcff2289ed Revert "lib, zebra: Fixup if.c to work in the new regime"
This reverts commit 2511cb40e6.
2016-09-22 18:23:21 +00:00
Daniel Walton
ed5c254baf Revert "zebra: Fixup to use the new parser"
This reverts commit 5c94274ff7.
2016-09-22 18:21:59 +00:00
Donald Sharp
5c94274ff7 zebra: Fixup to use the new parser 2016-09-20 23:29:43 -04:00
Donald Sharp
2511cb40e6 lib, zebra: Fixup if.c to work in the new regime
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-20 21:44:37 -04:00
David Lamparter
4a1ab8e405 *: split & distribute memtypes and stop (re|ab)using lib/ MTYPEs
This is a rather large mechanical commit that splits up the memory types
defined in lib/memtypes.c and distributes them into *_memory.[ch] files
in the individual daemons.

The zebra change is slightly annoying because there is no nice place to
put the #include "zebra_memory.h" statement.

bgpd, ospf6d, isisd and some tests were reusing MTYPEs defined in the
library for its own use.  This is bad practice and would break when the
memtype are made static.

Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
[CF: rebased for cmaster-next]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
2016-09-19 16:31:04 -04:00
Donald Sharp
78860b9f45 zebra: Refactor interface statistic calling
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-09-16 18:24:08 -04:00
Olivier Dugeon
16f1b9ee29 Update Traffic Engineering Support for OSPFD
NOTE: I am squashing several commits together because they
do not independently compile and we need this ability to
do any type of sane testing on the patches.  Since this
series builds together I am doing this. -DBS

This new structure is the basis to get new link parameters for
Traffic Engineering from Zebra/interface layer to OSPFD and ISISD
for the support of Traffic Engineering

* lib/if.[c,h]: link parameters struture and get/set functions
* lib/command.[c,h]: creation of a new link-node
* lib/zclient.[c,h]: modification to the ZBUS message to convey the
link parameters structure
* lib/zebra.h: New ZBUS message

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support for IEEE 754 format

* lib/stream.[c,h]: Add stream_get{f,d} and stream_put{f,d}) demux and muxers to
  safely convert between big-endian IEEE-754 single and double binary
  format, as used in IETF RFCs, and C99.  Implementation depends on host
  using __STDC_IEC_559__, which should be everything we care about.  Should
  correctly error out otherwise.
* lib/network.[c,h]: Add ntohf and htonf converter
* lib/memtypes.c: Add new memeory type for Traffic Engineering support

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add link parameters support to Zebra

* zebra/interface.c:
   - Add new link-params CLI commands
   - Add new functions to set/get link parameters for interface
* zebra/redistribute.[c,h]: Add new function to propagate link parameters
to routing daemon (essentially OSPFD and ISISD) for Traffic Engineering.
* zebra/redistribute_null.c: Add new function
zebra_interface_parameters_update()
* zebra/zserv.[c,h]: Add new functions to send link parameters

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Add support of new link-params CLI to vtysh

In vtysh_config.c/vtysh_config_parse_line(), it is not possible to continue
to use the ordered version for adding line i.e. config_add_line_uniq() to print
Interface CLI commands as it completely break the new LINK_PARAMS_NODE.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

Update Traffic Engineering support for OSPFD

These patches update original code to RFC3630 (OSPF-TE) and add support of
RFC5392 (Inter-AS v2) & RFC7471 (TE metric extensions) and partial support
of RFC6827 (ASON - GMPLS).

* ospfd/ospf_dump.[c,h]: Add new dump functions for Traffic Engineering
* ospfd/ospf_opaque.[c,h]: Add new TLV code points for RFC5392
* ospfd/ospf_packet.c: Update checking of OSPF_OPTION
* ospfd/ospf_vty.[c,h]: Update ospf_str2area_id
* ospfd/ospf_zebra.c: Add new function ospf_interface_link_params() to get
Link Parameters information from the interface to populate Traffic Engineering
metrics
* ospfd/ospfd.[c,h]: Update OSPF_OPTION flags (T -> MT and new DN)
* ospfd/ospf_te.[c,h]: Major modifications to update the code to new
link parameters structure and new RFCs

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>

tmp
2016-09-03 11:05:50 -04:00
Timo Teräs
8ccc7e802b lib, zebra: unify link layer type and hardware address handling
This removes the BSD specific usage of struct sockaddr_dl
hardware address. This unifies to use explict hw_addr member for
the address, and zebra specific enumeration for the link layer
type.

Additionally the zapi is updated to never send platform specific
structures over the wire, but the ll_type along with hw_addr_len
and hw_addr are now sent for all platforms.

Based on initial work by Paul Jakma.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Author:    Timo Teräs <timo.teras@iki.fi>
#
# rebase in progress; onto 9c2f85d
# You are currently editing a commit while rebasing branch 'renato' on '9c2f85d'.
#
# Changes to be committed:
#	modified:   isisd/isis_circuit.c
#	modified:   lib/if.c
#	modified:   lib/if.h
#	modified:   lib/zclient.c
#	modified:   zebra/interface.c
#	modified:   zebra/interface.h
#	modified:   zebra/kernel_socket.c
#	modified:   zebra/rt_netlink.c
#	modified:   zebra/rtadv.c
#	modified:   zebra/zserv.c
#
# Untracked files:
#	"\033\033OA\033OB\033"
#	0001-bgpd-fix-build-on-Solaris.patch
#	ldpd/
#	redhat/ldpd.init
#	redhat/ldpd.service
#	tags
#
2016-09-03 11:05:50 -04:00
Renato Westphal
6b8a5694d3 zebra: create an abstraction layer for netlink_neigh_update()
We shouldn't have platform-agnostic code (e.g. zebra/interface.c)
calling platform-specific functions (e.g. netlink_neigh_update).

This commit introduces the kernel_neigh_update() function, which then
has to be implemented by all supported platforms. Currently only Linux
implements this function, which is only used by the RTADV code.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2016-08-07 21:05:26 -04:00
Dinesh G Dutt
07fc159679 Deprecate link-detect and don't display it in show running-config
Ticket: CM-11808
Reviewed By: CCR-4972
Testing Done: Usual stuff

link-detect is on by default, and has been so since the first release
of Cumulus Linux. So, in the light of not displaying defaults, don't
display link-detect if enabled, only if disabled.
2016-07-18 19:45:16 -07:00
Don Slice
3f6d6a5db8 zebra/ospf/ospf6: Fix several memory leaks on if up/down
Resolved several memory leaks caused by ifdown/ifup the vrf device or
a swp port.  For bgp/zebra/ospf/ospf6, bouncing the vrf device would cause
a linked list, Interface, and route-table to get leaked.  For ospf6,
bouncing the swp device also caused leaks of Connected and Prefix entries.

Ticket: CM-10841
Signed-off-by: Don Slice
Reviewed-By: Donald Sharp
Testing Done: Manual testing, bgp and ospf mins passed, smokes had fewer failures than base
2016-06-28 04:52:38 -07:00
Quentin Young
795b5abf69 zebra: Add ipv6 router advertisement message counter
Ticket: CM-4497

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-06-20 15:29:47 +00:00
Don Slice
70bd3c4369 ospfd/ospf6d/zebra: Change interface bandwidth range and auto-cost range to 100G
Prior to this change, interface bandwidth could not be defined above 10G. With
the use of higher speed interfaces, the ability to effectively define the path
links was highly impacted. Additionally, the default auto-cost reference-bandwidth
for ospf and ospfv3 was set to 100M, which relects a much earlier time.  Changed both
the range of interface bandwidth definitions and reference bandwidths to be up to
100G.  Set the default interface bandwidth (if not defined) to 10G to make the ratio
continue to cause a cost of 10 as before.  Manual testing as well as ospf-min and
ospf-smoke passed successfully.

Ticket: CM-10756
Signed-of-by: Don Slice
Reviewed-by: Donald Sharp
2016-06-13 09:06:45 -04:00
Timo Teräs
35d921cc20 zebra: use prefix2str for logging where possible
This 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>
(cherry picked from commit be6335d682c5ee1b6930345193eda875705fbab2)
2016-06-09 09:08:05 -04:00
Morgan Stewart
06b420a4d7 Fixed if_add_update possible null dereference
Coverity Scan #1221454
In zebra/interface.c if_data could be null dereferenced without early
check.

Signed-off-by: Morgan Stewart <morgan@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
(cherry picked from commit c8394ace7081ef0e71f3d162067c83c2629fc088)
2016-05-26 15:33:32 +00:00
David Lamparter
24b46333dd zebra: fix NetBSD interface stats printf
"format '%qu' expects type 'long long unsigned int', but argument 3 has
type '__uint64_t'"

Move to %llu, which is more standard.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 193e78f2460a537695e34368a29fc5cd02e4e1f5)
2016-05-26 15:33:30 +00:00
David Lamparter
b71cd0fc49 zebra: print "no link-detect"
The default for this is slated to change, so let's print the current
default value for preexisting configurations.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 4c421215a0330b96d85879810558d40027a96ca6)
2016-05-26 15:25:13 +00:00
Donald Sharp
9050881a77 zebra: Clean up some small static analysis warnings
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-05-19 10:42:21 -04:00
Donald Sharp
a3d21ef32e zebra: Fix interface based static routes
This commit fixes interface based static routes.

static routes are now stored and if an interface
comes up it finds the route and installs it.

Ticket: CM-10869
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-05-10 15:07:04 -04:00
Donald Sharp
c1c747a897 zebra: Fix show vrf and show run to use the zvrf_list
The show vrf and show run commands were iterating
over the vrf_list.  Use the zvrf_list instead
so that we can understand the differences
between something configed -vs- created

Ticket: CM-10139
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-05-06 10:41:30 -04:00
Donald Sharp
fb148af4a1 zebra: Add code to add/remove statics from the rib
On enable/disable of static routes add and remove them
from the rib as appropriate.

Ticket: CM-10139
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
2016-05-06 10:41:28 -04:00
vivek
4a04e5f796 BGP: Trigger IPv6 router advertisements upon config of unnumbered neighbor
Instead of turning on IPv6 RA on every interface as soon as it has an IPv6
address, only enable it upon configuration of BGP neighbor. When the BGP
neighbor is deleted, signal that RAs can be turned off.

To support this, introduce new message interaction between BGP and Zebra.
Also, take appropriate actions in BGP upon interface add/del since the
unnumbered neighbor could exist prior to interface creation etc.

Only unnumbered IPv6 neighbors require RA, the /30 or /31 based neighbors
don't. However, to keep the interaction simple and not have to deal with
too many dynamic conditions (e.g., address deletes or neighbor change to/from
'v6only'), RAs on the interface are triggered upon any unnumbered neighbor
configuration.

BGP-triggered RAs will cause RAs to be initiated on the interface; however,
if BGP asks that RAs be stopped (upon delete of unnumbered neighbor), RAs
will continue to be exchanged if the operator has explicitly enabled.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-10640
Reviewed By: CCR-4589
Testing Done: Various manual and automated (refer to defect)
2016-05-02 13:53:38 -07:00
Dinesh G Dutt
6c9678b454 Add support for fast rexmit of RA on link transitions.
Ticket: CM-7076
Reviewed By: CCR-4568
Testing Done:

To allow for faster convergence, modify transmission of IPv6 RA so
that on link transitions(link up, change VRF, link add etc.), we
transmit RA fast to ensure faster convergence with BGP Unnumbered.
But we don't enable Fast RA if RA interval is in msecs as we've
fixed the fast RA interval to be 1s. We retransmit RA 4 times, once
each second on link events and when RA is first enabled.
2016-04-27 13:54:08 -07:00
radhika
986aa00f94 Addition on hidden command "bfd multihop/singlehop" and "ptm-enable" per interface command
CM-10435
Issue: IBGP BFD sessions are created as multi-hop even though peer is single-hop away. This is causing an interop issue with ICOS.
Root Cause: By design all IBGP peers are registered with BFD as multi-hop.
Fix:
• Changed the default behavior of always treating IBGP BFD sessions as mult-hop. shared_network variable is used to determine whether the IBGP peer is single hop or multi-hop away. The logic for determining whether EBGP peer is single hop or multi-hop has not been changed.
• Since the default behavior has been changed, it will cause interop issues between 2.5 and 3.0 IBGP BFD sessions. A new hidden command “bfd multihop/singlehop” has been introduced to overcome the interop issues.

dell-s6000-10(config-router)# neighbor 30.0.2.6 bfd
<2-255> Detect Multiplier
<cr>
dell-s6000-10(config-router)# neighbor 30.0.2.6 bfd multihop
dell-s6000-10(config-router)# no neighbor 30.0.2.6 bfd multihop
dell-s6000-10(config-router)#
dell-s6000-10(config-router)# neighbor 30.0.2.6 bfd multihop
dell-s6000-10(config-router)# do show running-config
!
router bgp 100
neighbor igroup peer-group
neighbor igroup bfd 5 500 500
neighbor igroup bfd multihop
neighbor 30.0.2.2 remote-as 100
neighbor 30.0.2.2 peer-group igroup
neighbor 3101🔤bcad::2 remote-as 100
neighbor 3101🔤bcad::2 peer-group igroup
neighbor 30.0.2.6 remote-as 200
neighbor 30.0.2.6 bfd multihop
neighbor 3102🔤bcad::6 remote-as 200
neighbor 3102🔤bcad::6 bfd
neighbor 3102🔤bcad::6 ebgp-multihop 255
!

CM-10260
Issue: “Unable to connect to socket” message keeps getting logged when ptmd process doesn’t exist.
Root Cause: BFD clients (bgpd, ospfd and ospf6d) during initialization try to register with BFD/PTM by default. This results in continuous logging If PTM does not exist since there is no max on number of retries.
Fix:
• Stop the retries to connect to PTM after max reconnect timer of 5 mins is reached.
• Added zebra debug event wrapper to message logging to prevent it from showing by default.

CM-4541
Issue: Addition of a new command "ptm-enable" or "no ptm-enable" per interface to enable/disable PTM link status checks for an interface.
Fix: Currently there is only one ptm-enable global command that enables/disables PTM status updates for all interfaces. This new command will give the handle to individually stop interface from reacting on the PTM status updates.
• by default interface uses the ptm-enable global configuration
• "no ptm-enable" on an interface will disable PTM status updates from taking affect for that interface. This can bring the interface up if it was brought down due to PTM status update.
• "ptm-enable" on an interface will cause the interface to fallback to the global ptm-enable configuration value and will bring the interface up or down based on the last stored PTM status update if global ptm is enabled.

Ticket: CM-10435, CM-10260 and CM-4541
Signed-off-by: Radhika Mahankali
Reviewed-by: Donald Sharp, Kanna Rajagopal
2016-04-21 15:39:38 -07:00
Donald Sharp
7c5519562e zebra: Refactor zebra_vrf
Move zebra_vrf_XXX functionality into it's own
file so that we can isolate a bit the api edges

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-14 20:57:04 -04:00
Donald Sharp
fe18ee2d44 lib, zebra: Rework zebra_ns to be a bit more modular
The struct zebra_ns was littered throughout the code
base in a half-hazard fashion.  Gather up the references
and isolate the code a bit better.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-14 20:56:57 -04:00
Donald Sharp
e2b1be648d lib, zebra: Rework vrf_add_update
The vrf_add_update function does not need to exist.
Move it's constituent parts into the appropriate
vrf_create/vrf_enable functionality as well as
move the zebra_vrf_add_update() function call
into zebra_vrf_enable()

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-14 20:56:43 -04:00
Donald Sharp
e74f14fc79 lib, zebra: Rearrange vrf_delete_update
vrf_delete_update really belongs in vrf.c broken up
into it's appropriate places.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-14 20:56:12 -04:00
Donald Sharp
58255d3440 lib, zebra: Refactor vrf creation a bit more
Create the idea of a VRF_UNKNOWN, this is for a vrf where we don't
yet have the vrf_id for it yet.

Refactor the vrf_create code out of existence.  We had two code
paths vrf_create and vrf_get.  We should use vrf_get to create
the new vrf since XXX_get() creates the data structures now.

Signed-off-by: Donald Sharp
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
2016-04-12 20:19:28 -04:00
Donald Sharp
7707478a33 Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2016-04-08 13:16:21 -04:00
Donald Sharp
79694123fd lib, zebra: Rename ZEBRA_VRF_ACTIVE
ZEBRA_VRF_ACTIVE is a poor name for when a vrf is
actually active.  Rename VRF_ACTIVE.

Ticket: CM-10338
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Radhika Mahankali <radhika@cumulusnetworks.com>
2016-04-08 13:15:41 -04:00
Christian Franke
55ce4d3add zebra: count iface up/down events and keep last time of their occurrence
It is quite useful to be able to assert whether specific interfaces have
flapped or also to verify that specific interfaces have not flapped.

By having counters for those events and storing the last time of their
occurrence, this is made possible.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2016-04-07 20:41:43 -04:00
Don Slice
99ffac1827 zebra: add or delete router-id when interface moves vrfs
When an interface changes which vrf it is part of, it needs to be added
to the list of possible router-id choices in the new vrf and removed
from the old vrf/default.

Ticket: CM-9074
Signed-off-by: Don Slice
Reviewed-by: Vivek Venkatraman
2016-03-25 11:51:35 +00:00
Donald Sharp
9e1bf607c1 zebra: Replace vrf with zebra_vrf in a few places
We were incorrectly using vrf instead of zebra_vrf in a
few spots.

Ticket: CM-9412
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2016-03-23 05:29:15 -07:00
vivek
c8e264b60e Quagga: Implement VRF change semantics for an interface
Implement VRF change semantics for an interface to be invoked
when an interface is moved from one VRF (e.g., the Default) to
another. This includes the message definition as well as updating,
deleting or adding the interface from clients, depending on their
interest in the VRFs (old and new). Also handle replay of the
addresses on the interface upon VRF change, if required.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by:   Don Slice <dslice@cumulusnetworks.com>

Ticket: CM-9527
Reviewed By: CCR-4174
Testing Done: Manual tests of various scenarios
2016-02-25 19:30:53 +00:00
vivek
a815b7881e Zebra: Zebra: Display interface info for NHT in a VRF
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>

Ticket: CM-9458
Reviewed By: CCR-4150
Testing Done: Manual
2016-02-23 04:17:09 +00:00
vivek
30a3822f2b Zebra: Restrict automatic RA enable to relevant interfaces
When enabling IPv6 Router Advertisements automatically based on the
presence of IPv6 address on an interface, do it only for relevant
interfaces.

Note: This needs a configure option for completion.

Ticket: CM-9358
Reviewed By: CCR-4116
Testing Done: Manual verification
2016-02-18 18:47:32 -08:00
Don Slice
e6a59b3505 zebra: display_vrf_name_on_interface
Changed vrf output from vrf_id to vrf name in "show interface"

Ticket: CM-9131
Reviewed By: sharpd
Testing Done: Manual testing, see ticket
2016-02-04 09:05:00 -08:00
Don Slice
1721646ebe zebra: show_interface_name_vrf fix
Ticket: CM-9110
Reviewed By:
Testing Done: Manual testing, see ticket

Aliased "show interface name swpxx" to "show interface name swpxx vrf all" to find the interface regarless of which vrf it resides in.
2016-02-04 05:59:12 -08:00
Donald Sharp
12f6fb9731 lib, zebra: The Bulk of the conversion over to NS and VRF
Convert the rest of zebra over to use a Namespae and VRF.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2016-02-01 10:55:42 -08:00
Donald Sharp
f11b863d69 zebra: Fix crash in connected.c due to RA change
Back out original null pointer fix targeted it was the wrong fix.

Basically when a ip address is deleted the RA code was waiting till after
the connected pointer was deleted to set the RA appropriately.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
2015-12-15 05:22:48 -08:00
Daniel Walton
ca208d065c zebra: Crash upon disabling a link
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-8514
2015-12-14 19:40:27 +00:00
vivek
1c8481370f Zebra: Schedule RIB processing based on trigger event
Currently, when RIB processing is initiated (i.e., by calling rib_update()),
all routes are queued for processing. This is not desirable in all situations
because, sometimes the protocol may have an alternate path. In addition,
with NHT tracking nexthops, there are situations when NHT should be kicked
off first and that can trigger subsequent RIB processing.

This patch addresses this by introducing the notion of a trigger event. This
is only for the situation when the entire RIB is walked. The current triggers
- based on when rib_update() is invoked - are "interface change" and "route-
map change". In the former case, only the relevant routes are walked and
scheduled, in the latter case, currently all routes are scheduled for
processing.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7662
Reviewed By: CCR-3905

Note: The initial defect in this area was CM-7420. This was addressed in
2.5.4 with an interim change that only walked static routes upon interface
down. The change was considered a bit risky to do for interface up etc. Also,
this did not address scenarios like CM-7662. The current fix addresses CM-7662.
2015-12-08 16:55:43 -08:00
Daniel Walton
b612050594 Enable IPv6 ND RA for interfaces that have an IPv6 address
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by:   Donald Sharp <sharpd@cumulusnetworks.com>

Ticket: CM-7932
2015-12-07 13:05:34 -08:00
vivek
922705ecdc Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-11-20 08:51:48 -08:00
vivek
41ec92223a Zebra: Cleanup RIB debugs
Some of the changes include:
- ensuring IPv6 addresses are printed correctly
- say 'updating' or 'deleting' etc. only when that is actually done
- say 'queuing' or 'dequeuing' only when that is actually done
- print useful info for 'detailed' debug - that now subsumes 'rib queue'
- delete various useless logs
- VRF-specific - print VRF id in RIB debugs prior to prefix
  (e.g., 4:37.1.1.0/28)

Ticket: CM-8110
Reviewed By: CCR-3765
Testing Done: Manual testing (2.5-br)
2015-11-20 08:48:32 -08:00
Donald Sharp
8afc891ac7 Merge branch 'cmaster' of ssh://stash.cumulusnetworks.com:7999/quag/quagga into cmaster 2015-11-20 07:12:30 -08:00
Donald Sharp
70d43d7cd3 Quagga: Fixup decision about what an unnumbered interface is
This Change modifies what zebra thinks is an unnumbered interface.
If the interface is not a loopback and the prefixlength for the
interface is 32 than consider this an unnumbered interface.

Ticket: CM-8016
Reviewed by: CCR-3827
Testing: Full Regression Suites

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-20 07:10:47 -08:00
Donald Sharp
8da4e9466a Quagga: Cleanup RTADV define
The RTADV define was not being set correctly or consistently.
Make the code consistent with our HAVE_IPV6 define.

If the user wants to explicitly turn it off then they should
run --disable-rtadv from the configure cli

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-11-20 07:07:41 -08:00
Feng Lu
78104b9bad zebra: let FIB stand for its respective VRF
A 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 in FIB are kept in default VRF. And the logic
is not changed.

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>
[DL: conflicts fixed + compile warning fix]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	zebra/connected.c
	zebra/kernel_socket.c
	zebra/rib.h
	zebra/rt_netlink.c
	zebra/zebra_rib.c
	zebra/zserv.c

Conflicts:
	zebra/connected.c
	zebra/interface.c
	zebra/kernel_socket.c
	zebra/rib.h
	zebra/rt_netlink.c
	zebra/rtread_getmsg.c
	zebra/zebra_rib.c
	zebra/zebra_vty.c
	zebra/zserv.c
2015-10-29 23:38:03 -07:00
Feng Lu
8b87bdf416 zebra: show interfaces in a specified VRF or all VRFs
The 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 description vrf all

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: David Lamparter <equinox@opensourcerouting.org>
2015-10-29 22:59:26 -07:00
Feng Lu
cd2a8a42e1 lib, zebra, vtysh: configure an interface in non-default VRF
Introduce 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 <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	zebra/interface.c
2015-10-29 18:08:53 -07:00
Feng Lu
6a69b354a6 *: 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
  vrf_terminate() instead.

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: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	bgpd/bgp_main.c
	pimd/pim_iface.c
	pimd/pim_iface.h
	pimd/pim_main.c
	pimd/pimd.c
2015-10-29 17:00:32 -07:00
Feng Lu
3968dbf8ef 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>
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: David Lamparter <equinox@opensourcerouting.org>

Conflicts:
	lib/if.c
	zebra/interface.c
2015-10-29 16:49:39 -07:00
vivek
b84c725326 Zebra: On a link down, schedule static routes only.
Ticket: CM-7420
Reviewed By: Vivek, Donald
Testing Done: UT, verification of the fix + ospf and bgp smoke

On a link delete/down event, schedule only the prefixes which have a
static RIB too.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
2015-10-20 22:37:32 -07:00
radhika
950bd436b6 Fix Quagga ptm status per interface to show more meaningful status
Ticket: CM-6812
Reviewed By: Donald
Testing Done:

Double commit of 2119c8fccda5f1497820009c6f1f82eda3c8d0f1 from 2.5br to master

 In Quagga, the ptm status is shown as pass for all the interfaces that PTM is not tracking. When ptm is enabled in Quagga all the interfaces are initialized as pass and changed to fail/pass when ptm cable check updates are received. For all the interfaces for which no status was received from PTM remain at pass status. Interface show in quagga indicates wrong status and it should be n/a for all the untracked interfaces. To fix the problem introduced a third state “unknown” and this is default ptm status for all the interfaces. The ptm status is updated accordingly to pass/fail when the updates are received from PTM. Also, reset all interface ptm status to unknown when the connection with ptm is lost and the status gets updated when the connection with PTM is re-established.
2015-10-09 11:18:09 -07:00
Donald Sharp
88177fe3ed Fixup of warnings in the code
Ticket: None
Reviewed by: Trivial
Testing:

A bunch of warnings have crept in to the code base.  This
fixes the issue
2015-07-25 15:55:47 -07:00
Donald Sharp
c8ed14ddb6 ptm-integration.patch
Integrates Prescriptive Topology Module(ptm) into quagga.

If this module is enabled, link ups are notified only after the link is verified
as being connected to the neighbor specified. The neighbor specification and
checking is done by the ptm daemon.

<This is a recommit of this patch because it was changed in situ>
2015-07-22 13:07:08 -07:00
Donald Sharp
eb4b183040 ipv6_ll_address_to_mac() fails to correctly convert fe80::a8aa:aaff:feaa:aaf8 to AA:AA:AA:AA:AA:F8 2015-06-12 07:59:12 -07:00
Donald Sharp
c43ed2e48a This patch changes BGP from only listening mode for BFD status updates to interactive mode of dynamically registering/deregistering BFD enabled peers with PTM/BFD through zebra. Peer is registered with BFD when it goes into established state and de-registers when it goes out of establish state.
This patch also adds BFD multihop support for BGP. Whether a peer is multi-hop or single hop is determined internally. All IGP peers are considered as multi-hop peers. EBGP peers are considered as single hop unless configured as multi-hop.

BGP BFD command enhancement to configure BFD parameters (detect multiplier, min rx and min tx).

router bgp <as-number>
  neighbor <name/ip-address> bfd <detect mult> <min rx> <min tx>

Signed-off-by: Radhika Mahankali <radhika@cumulusnetworks.com>
Reviewed-by:   Dinesh G Dutt <ddutt@cumulusnetworks.com>
Reviewed-by:   Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by:   Kanna Rajagopal <kanna@cumulusnetworks.com>
2015-06-12 07:59:11 -07:00
Donald Sharp
a197c47cfb When an interface goes down, any neigbors learnt on that interface
using IPv6 Router Advertisements (RAs) must be deleted. When an
interface comes up and neighbors are learnt on that interface, the
BGP FSM for any interface peer must be started only if a valid
local address exists; the local address may come up later after IPv6
Duplicate Address Detection.
2015-06-12 07:59:09 -07:00
Donald Sharp
5c610fafc4 2015-06-11 09:19:59 -07:00
Donald Sharp
525c183906 Unnumbered interface support. 2015-05-19 17:58:13 -07:00
Donald Sharp
d914d5ff0e Block martian address configuration on an interface and also block from
getting installed into the zebra tables.
2015-05-19 17:47:23 -07:00
Donald Sharp
d5a5c8f05b This patch adds support for a new BFD session down message from zebra to
protocols. BGP and OSPF are integrated to respond this BFD session down message
originated in Zebra via ptmd.

BGP and OSPF now have a bfd command, which tells OSPF/BGP to respond to the
BFD session down message.

OSPF:

interface <>
 ip ospf bfd

BGP:

router bgp <>
  neighbor <> bfd

Please note that these commands don't enable BFD as a protocol. BFD configuration
and paramter tuning are via BFD applicable UI.

Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Shrijeet Mukherjee <shm@cumulusnetworks.com>
2015-05-19 17:47:23 -07:00
Donald Sharp
244c1cdce5 ptm-integration.patch
Integrates Prescriptive Topology Module(ptm) into quagga.

If this module is enabled, link ups are notified only after the link is verified
as being connected to the neighbor specified. The neighbor specification and
checking is done by the ptm daemon.
2015-05-19 17:40:44 -07:00
Donald Sharp
a80beece64 'neighbor <if-name> interface' config support in BGP including RA/Zebra changes.
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Pradosh Mohapatra <pmohapat@cumulusnetworks.com>
             Dinesh Dutt <ddutt@cumulusnetworks.com>
2015-05-19 17:40:40 -07:00
David Lamparter
6b0655a251 *: nuke ^L (page feed)
Quagga sources have inherited a slew of Page Feed (^L, \xC) characters
from ancient history.  Among other things, these break patchwork's
XML-RPC API because \xC is not a valid character in XML documents.

Nuke them from high orbit.

Patches can be adapted simply by:
	sed -e 's%^L%%' -i filename.patch
(you can type page feeds in some environments with Ctrl-V Ctrl-L)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2014-06-04 06:58:02 +02:00
Christian Franke
bfac8dcd2f zebra: improve interface shutdown behaviour
Linux removes IPv6 addresses when the interface is set down. Those
addresses need to be readded when the interface is set up again.

Also, an interface should not be reactivated from shutdown by configuring
an ip address.

Finally, remove the three-state logic for the shutdown setting as its
sole current use may be mild confusion.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-09-19 17:51:16 +02:00
Christian Franke
02b4805f39 zebra: don't change connected state from zebra/interface.c
Try to avoid changing connected state from zebra/interface.c as this
means making assumptions about kernel behaviour which may be or may
become wrong. This state should rather be updated by events from the
kernel.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-09-19 17:51:16 +02:00
Christian Franke
f7f740fe58 zebra: add ZEBRA_IFC_QUEUED to keep track of kernel state
As there are timeframes when we don't get a notification from the kernel
about new addresses. (e.g. while Linux performs IPv6 DAD), we need to
have some information whether an address has been sent to the kernel or
not.

One case where this is relevant would be a user adding an IPv6 address,
but deleting it before DAD has been complete. With the next patch which
removes some (ill assuming) synchronous parts in address setup,
ipv6_address_uninstall would not know whether or not it has to actually
delete the prefix from the kernel. Resolving these windows where we lack
information is what the flag ZEBRA_IFC_QUEUED is intended for.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-09-19 17:51:16 +02:00
Christian Franke
676e1a0142 zebra: clear ZEBRA_IFC_CONFIGURED on "no ipv6 addr"
To match the semantics of IPv4, the ZEBRA_IFC_CONFIGURED flag
should be cleared when an IPv6 connected is uninstalled via
vty.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-09-19 17:51:16 +02:00
Christian Franke
9db047fcb1 zebra: make if_subnet_delete a bit more strict
Enhance if_subnet_delete so it will complain about improper use.
Also, fix one occurence of improper use where it was called for
IPv6 as well.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2013-09-19 17:51:16 +02:00
David Lamparter
7f062c217b zebra: lingering IP address after deletion (BZ#486)
zebra address bookkeeping is a mess. this is just a workaround to have
IPv4 address deletion somewhat working on Linux.

the if_unset_prefix call is synchronous, when it returns success the
address deletion completed successfully. this is either signaled by a
netlink ACK or by an OK return value from ioctl().

This version is wrapped by #ifdef HAVE_NETLINK so we don't touch the
BSDs for now.

* zebra/interface.c: On Linux, update zebra internal state after
  deleting an address.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-07-13 18:54:09 +02:00
Denis Ovsienko
d660f69842 zebra: justify some IPv6 ND RA timers wrt RFC
There was a regression introduced with the previous commit:
"ipv6 nd home-agent-lifetime 1800000" appeared by default in every
interface section of running-config, although this  command is
invalid in this context. Troubleshooting and bugfixing of the issue
tracked out several bugs in router advertisement procedures, some of
which are fixed in this commit.

* zebra/interface.c
  * if_zebra_new_hook(): update to treat -1 as "uninitialized"
  * nd_dump_vty(): idem
* zebra/rtadv.c
  * rtadv_send_packet(): update processing of "router lifetime" field,
    "home agent" option and "home agent lifetime" field to conform to
    RFC6275 better
  * ipv6_nd_ra_interval_msec(): update MaxRtrAdvInterval range check,
    make sure it never exceeds (initialized) AdvDefaultLifetime
  * ipv6_nd_ra_interval(): idem
  * ipv6_nd_ra_lifetime(): update AdvDefaultLifetime range check, make
    sure it never falls below MaxRtrAdvInterval
  * ipv6_nd_homeagent_lifetime(): update HomeAgentLifetime range check
  * no_ipv6_nd_ra_lifetime(): update to treat -1 as "uninitialized"
  * no_ipv6_nd_homeagent_lifetime(): idem
  * rtadv_config_write(): idem
2012-01-26 11:42:48 +04:00
Paul Jakma
f63f06da2e general: remove inline qualifiers and move in-header functions to objects
* (general) Move functions in headers into files, to be compiled into
  shared object files. Remove inline qualifier from functions. Let the
  compiler do the work.
2012-01-06 16:18:18 +00:00
Roman Hoog Antink
e26873fd8f zebra: fix infinite loop when deleting an interface
When deleting a VLAN interface after flushing its
addresses, zebra uses 100% CPU time and freezes.

 * interface.c: The while loop in line 407 that
   should clean up connected routes never hits one
   of the 2 lines "last = node;" and thus loops
   forever.

Signed-off-by: Roman Hoog Antink <rha@open.ch>
2010-05-05 12:03:33 -04:00
Stephen Hemminger
ffac19c58e zebra: remove unused function to fix warning
* zebra/interface.c
  * if_supported_family(): sayonara
2009-12-08 12:27:02 +03:00
Chris Caputo
b60668d092 RFC 4191 Default Router Preference support for router advertisements
Adds "ipv6 nd router-preference (high|medium|low)" and
"no ipv6 nd router-preference" interface commands.

Files modified:

   doc/ipv6.texi
   zebra/interface.c
   zebra/interface.h
   zebra/rtadv.c
   zebra/rtadv.h

Signed-off-by: Chris Caputo <ccaputo@alt.net>
2009-06-23 14:15:57 +01:00
Stephen Hemminger
81cce0185e [cleanup] Use correct buffer size for inet_ntop()
Don't need big buffer 1024 to hold IPV4 (INET_ADDRSTRLEN)
or IPv6 (INET6_ADDRSTRLEN) message.
2009-06-18 20:18:27 +01:00
Stephen Hemminger
393deb9bd6 [cleanup] Convert XMALLOC/memset to XCALLOC
Simple conversion of XMALLOC/memset to XCALLOC
2009-06-12 17:07:49 +01:00
Paul Jakma
6f0e3f6e17 [autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: sys/conf.h depends on sys/param.h, at least on
	  FBSD 6.2.
	  (bug #363) Should check for in_pktinfo for IRDP

2006-05-27 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: General cleanup of header and type checks, introducing
	  an internal define, QUAGGA_INCLUDES, to build up a list of
	  stuff to include so as to avoid 'present but cant be compiled'
	  warnings.
	  Misc additional checks of things missing according to autoscan.
	  Add LIBM, for bgpd's use of libm, so as to avoid burdening
	  LIBS, and all the binaries, with libm linkage.
	  Remove the bad practice of using m4 changequote(), just
	  quote the []'s in the case statements properly.
	  This should fix bugs 162, 303 and 178.
	* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
	  HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
	* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 02:38:51 +00:00
Paul Jakma
d9a18f1113 [zebra] Retain configured IPv4 address upon removal by kernel
2007-04-08 Paul Jakma <paul.jakma@sun.com>

	* interface.c: (if_delete_update) Address removal triggered
	  by kernel shouldn't remove configured IPv4 address from connected
	  list.
2007-04-10 19:30:20 +00:00
Andrew J. Schorr
e4529636b7 [PtP over ethernet] New peer flag allows much more addressing flexibility
2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating
	  whether a peer address has been configured.  Comment now shows
	  the new interpretation of the destination addr: if ZEBRA_IFA_PEER
	  is set, then it must contain the destination address, otherwise
	  it may contain the broadcast address or be NULL.
	  (CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete
	  macros that were specific to IPv4 and not fully general.
	  (CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag.
	  (CONNECTED_PREFIX) New macro giving the prefix to insert into
	  the RIB: if CONNECTED_PEER, then use the destination (peer) address,
	  else use the address field.
	  (CONNECTED_ID) New macro to come up with an identifying address
	  for the struct connected.
	* if.c: (if_lookup_address, connected_lookup_address) Streamline
	  logic with new CONNECTED_PREFIX macro.
	* prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros
	  for better performance than the general prefix_copy function.
	* zclient.c: (zebra_interface_address_read) For non-null destination
	  addresses, set prefixlen to equal the address prefixlen.  This
	  is needed to get the new CONNECTED_PREFIX macro to work properly.
	* connected.c: (connected_up_ipv4, connected_down_ipv4,
	  connected_up_ipv6, connected_down_ipv6) Simplify logic using the
	  new CONNECTED_PREFIX macro.
	  (connected_add_ipv4) Set prefixlen in destination addresses (required
	  by the CONNECTED_PREFIX macro).  Use CONNECTED_PEER macro instead
	  of testing for IFF_POINTOPOINT.  Delete invalid warning message.
	  Warn about cases where the ZEBRA_IFA_PEER is set but no
	  destination address has been supplied (and turn off the flag).
	  (connected_add_ipv6) Add new flags argument so callers may set
	  the ZEBRA_IFA_PEER flag.  If peer/broadcast address satisfies
	  IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning.
	  Set prefixlen in destination address so CONNECTED_PREFIX will work.
	* connected.h: (connected_add_ipv6) Add new flags argument so
	  callers may set the ZEBRA_IFA_PEER flag.
	* interface.c: (connected_dump_vty) Use CONNECTED_PEER macro
	  to decide whether the destination address is a peer or broadcast
	  address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT).
	* if_ioctl.c: (if_getaddrs) Instead of setting a peer address
	  only when the IFF_POINTOPOINT is set, we now accept a peer
	  address whenever it is available and not the same as the local
	  address.  Otherwise (no peer address assigned), we check
	  for a broadcast address (regardless of the IFF_BROADCAST flag).
	  And must now pass a flags value of ZEBRA_IFA_PEER to
	  connected_add_ipv4 when a peer address is assigned.
	  The same new logic is used with the IPv6 code as well (and we
	  pass the new flags argument to connected_add_ipv6).
	  (if_get_addr) Do not bother to check IFF_POINTOPOINT: just
	  issue the SIOCGIFDSTADDR ioctl and see if we get back
	  a peer address not matching the local address (and set
	  the ZEBRA_IFA_PEER in that case).  If there's no peer address,
	  try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set.
	* if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl
	  without bothering to check the IFF_POINTOPOINT flag.  And if
	  no peer address was found, just try the SIOCGLIFBRDADDR ioctl
	  without checking the IFF_BROADCAST flag.  Call connected_add_ipv4
	  and connected_add_ipv6 with appropriate flags.
	* if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to
	  connected_add_ipv6.
	* kernel_socket.c: (ifam_read) Must pass new flags argument to
	  connected_add_ipv6.
	* rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2
	  to determine local and possible peer address (so there's no longer
	  a test for IFF_POINTOPOINT).  Set ZEBRA_IFA_PEER flag appropriately.
	  Pass new flags argument to connected_add_ipv6.
	  (netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast
	  to determine whether the connected destination address is a
	  broadcast address.
	* bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete)
	  Simplify logic by using new CONNECTED_PREFIX macro.
	* ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix,
	  ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX
	  macro.
	* ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX
	  macro, both options collapse into the same code.
	* ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new
	  CONNECTED_ID macro.
	  (ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX
	  macro.
	* ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro
	  instead of testing the IFF_POINTOPOINT flag.
	* ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro
	  instead of testing with if_is_pointopoint.  And add commented-out
	  code to implement alternative (in my opinion) more elegant behavior
	  that has no special-case treatment for PtP addresses.
	  (ospf_network_run) Use new CONNECTED_ID macro to simplify logic.
	* rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID
	  macro to simplify logic.
	  (rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does
	  not give a useful result if prefixlen is 32 (we require a peer
	  address in such cases).
	* ripd.c: (rip_update_interface) Fix same bug as above.
2006-12-12 19:18:21 +00:00
Paul Jakma
74ecdc9e74 [zebra] Fix forgetfulness wrt configured address on FreeBSD
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* (general) The key fixes are actually Andrew Schorr's.
	* interface.c: (ip_address_uninstall) Unset the configured flag.
	* connected.c: (connected_same) new helper, check whether
	  two connected are same.
	  (connected_implicit_withdraw) new helper, consolidation of
	  existing code in connected_add_ipv{4,6}.
	  Try filter out unneeded Zserv address delete/adds when
	  address is exact same.
	  Where old address is implicitely removed, be sure to preserve
	  the IFC_CONFIGURED flag if set, fixes bug where configured
	  addresses were being lost on FreeBSD.
2006-06-15 18:10:47 +00:00
Paul Jakma
630c97ce0f [zebra] remove internal if_flag_dump, use libzebras version.
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* lib/if.c: (if_flag_dump) remove the whitespace indentation, callers
	  should provide.
	* zebra/interface.c: (if_flag_dump_vty) redundant code, remove.
	  (if_dump_vty) use libzebra if_flag_dump.
2006-06-15 12:48:17 +00:00
Paul Jakma
beb5633607 [zebra] CID #31, guard against potential NULL return of route_node_lookup
2006-05-11 Paul Jakma <paul.jakma@sun.com>

	* interface.c: (if_delete_update) route_node_lookup may return
	  NULL, should fix Coverity CID #31.
2006-05-11 13:28:05 +00:00
paul
3a570c8b7b [zebra] Display flags on their line in 'show interface'.
2006-02-02 Paul Jakma <paul.jakma@sun.com>

	* interface.c: (if_dump_vty) move flags to their line, neater.
2006-02-02 17:27:13 +00:00
paul
5c78b3d006 [zebra/solaris] Interface state fixups for Solaris.
2006-01-25 Paul Jakma <paul.jakma@sun.com>

	* (general) More solaris PF_ROUTE hacks. The IFF_UP mangling
	  for solaris was incomplete on the PF_ROUTE side. fix it.
	  This changeset generally uglifies things. For some future
	  work I'd like to see the state changes seperated out from
	  the details of the code. Differences between systems might
	  then be slightly easier to implement without convoluted
	  hacks.
	  Changes should be specific to Solaris mostly, however
	  also tested on FreeBSD 6.
	* if_ioctl_solaris.c: (interface_list_ioctl) ignore ~IFF_UP
	  interfaces, we'll hear about them when/if interface goes up
	  through NEWADDR.
	  Update flags explicitely at end of it to kick mangling.
	* ioctl_solaris.c: (if_mangle_up) removed to interface.c, in
	  kind.
	  (lifreq_set_name) more convenient to take the string, than
	  the ifp.
	  (if_get_flags_direct) new convenience function, returns
	  the actual flags. Used during bootstrap in if_ioctl_solaris.c
	  to peek at flags of logical interfaces to see whether or
	  not to ignore them.
	  (if_get_flags) ENXIO means it's gone, poke out IFF_UP and
	  kick flags update.
	  (if_{un,}set_flags) flags argument should be 64bit.
	* ioctl.{c,h}: flags argument should be 64bit.
	* interface.h: Add a 'primary_state' flag to struct zebra_if on
	  SUNOS_5.
	  Export if_flags_update.
	* interface.c: (if_flags_mangle) moved over in kind from
	  ioctl_solaris.c. Nasty kludge to try get IFF_UP right, as
	  much as is possible. Also keep track of the actual IFF_UP
	  value for the primary interface, so we can know when the ifp
	  must be deleted.
	  (if_flags_update) Take a new interface flags value, apply it
	  to the interface, and take whatever actions are required due
	  to flag transitions.
	  (if_refresh) flag state change logic is moved out to
	  previous. Just call if_get_flags, which will end up using
	  previous to effect the update of flags.
	  (if_flag_dump_vty) IFF_IPV{4,6} aren't interesting, VIRTUAL
	  and NOXMIT are though.
	* kernel_socket.c: (ifm_read) Down->Down transitions shouldn't
	  create ifp, for non-IFANNOUNCE systems.
	  Use if_flags_update to update flags.
	  flag transition logic is now handled automatically through
	  if_flags_update.
	  (ifam_read) Better to call if_refresh *after* adding
 	  connected addresses, as connected count affects IFF_UP on
 	  IFF_UP-mangled systems.
 	  On Solaris, Up->Down due to DELADDR means we need to delete
	  the ifp - the IFINFO might already have been and gone.
	* rt.h: include other dependent headers.
2006-01-25 04:31:40 +00:00
paul
0752ef0b2e 2005-11-03 Paul Jakma <paul.jakma@sun.com>
* connected.{c,h}: Include memory.h
	  (connected_add_ipv4) Use MTYPE for ifc label.
	  (connected_add_ipv6) Also should accept label. Store it in ifp.
	  (connected_del_ipv4) Taking label as argument is pointless.
	* rt_netlink.c: (netlink_interface_addr) update label usage
	  for connected_{add,delete} functions.
	* if_ioctl.c: (if_getaddrs) NULL label for connected_add_ipv6.
	* if_ioctl_solaris.c: (interface_list_ioctl) Pass LIFC_NOXMIT
	  so we also find out about NOXMIT interfaces like VNI.
	  Bit of hackery to turn interface names into the primary
	  interface name, later with routing socket messages we only
	  will about primary interfaces anyway, so we must normalise
	  the name.
	  (if_get_addr) take label as argument, so it can
	  be passed to connected_add.
	  If label is provided, then it is interface name to issue the
	  ioctl for address information on, not the ifp name.
	  (interface_list) List AF_UNSPEC too, just in case.
	* if_proc.c: (ifaddr_proc_ipv6) label for connected_add_ipv6.
	* interface.c: (if_addr_wakeup) Some very bogus code - sets
	  IFF_RUNNING - add comment.
	  (if_refresh)
	  (ip_address_install) Use MTYPE for ifc label.
	* ioctl_solaris.c: (if_mangle_up) New function. Hackery to make
	  IFF_UP reflect whether any addresses are left on the
	  interface, as we get signalled for IFF_UP flags change on the
	  primary interface only. Logical interfaces dont generate
	  IFINFO, but we do get an RTM_DELADDR.
	  (if_get_flags) Call if_mangle_up before return.
	* kernel_socket.c: (ifam_read) Fixup calls to
	  connected_{add,delete} to match above changes. Rename gate
	  variable to brd, less confusing.
	  Pass the interface name as a label, if it is not same name
	  as ifp->name.
2005-11-03 12:35:21 +00:00
paul
ca16218df7 2005-09-12 Paul Jakma <paul.jakma@sun.com>
* (general) RTM_CHANGE and implicit withdraw on RTM_NEWADDR
	  support.
	* connected.c: (connected_withdraw) new function. withdraw a
	  connected subnet address set from zebra, and pass information
	  along to clients.
	  (connected_announce) similar, but to announce a new connected
	  subnet address set.
	  (connected_check_ipv4) renamed to connected_check, as its
	  AFI independent.
	  (connected_add_ipv{4,6}) Remove the connected address announce
	  stuff, use connected_announce instead.
	  If connected_check indicates address is already present,
	  treat it as an implicit withdraw of the existing address, ie
	  remove the old address details and replace with the new
	  details.
	  (connected_delete_ipv{4,6}) Use connected_withdraw.
	  (connected_check_ipv6) deleted in favour of connected_check.
	* connected.h: Rename connected_check_ipv4 to connected_check.
	  delete connected_check_ipv6.
	* interface.c: Use connected_check rather than the AFI specific
	  symbols.
	* kernel_socket.c: (rtm_read) RTM_CHANGE support. Create a
	  rib delete event for the existing route, before adding route
	  again.
	  (kernel_read) we can handle RTM_CHANGE now.
2005-09-12 16:58:52 +00:00
paul
6eb8827d66 2005-07-29 Paul Jakma <paul.jakma@sun.com>
* interface.c: (if_delete_update) should always be available, not
	  just on RTM_IFANNOUNCE/NETLINK systems.
	* kernel_socket.c: (ifan_read) only call if_delete_update when
	  interface departs, dont if_delete, because we wish to retain
	  interface configuration state even when interfaces are removed.
	  (ifm_read) If we dont have RTM_IFANNOUNCE, then transitioning
	  to down state is only chance we have to clean up interface in case
	  it is deleted (eg Solaris down -> unplumb -> plumb up).
	* redistribute.c: (zebra_interface_delete_update) should always be
	  available, we /will/ call it now on all systems, via
	  if_delete_update.
	* zserv.c: (zsend_interface_delete) ditto
	  (zsend_interface_address) Update the call-flow diagramme, to
	  reflect that if_delete_update /is/ now called on all systems,
	  potentially.
	* zserv.h: (zsend_interface_delete) unconditionally exported, as
	  above.
2005-07-29 14:36:00 +00:00
paul
a1ac18c4d5 2005-06-28 Paul Jakma <paul.jakma@sun.com>
* (global) Extern and static'ification, with related fixups
	  of declarations, ensuring files include their own headers, etc.
	  if_ioctl.c: (interface_info_ioctl) fix obvious arg mis-order in
	  list loop
2005-06-28 17:17:12 +00:00
paul
1eb8ef2584 2005-04-07 Paul Jakma <paul.jakma@sun.com>
* (global): Fix up list loops to match changes in lib/linklist,
	  and some basic auditing of usage.
	* configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES
	* HACKING: Add notes about deprecating interfaces and commands.
	* lib/linklist.h: Add usage comments.
	  Rename getdata macro to listgetdata.
	  Rename nextnode to listnextnode and fix its odd behaviour to be
	  less dangerous.
	  Make listgetdata macro assert node is not null, NULL list entries
          should be bug condition.
          ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use
          with for loop, Suggested by Jim Carlson of Sun.
          Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the
          "safety" of previous macro.
	  LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to
	  distinguish from the similarly named functions, and reflect their
	  effect better.
	  Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section
	  with the old defines which were modified above,
	  for backwards compatibility - guarded to prevent Quagga using it..
	* lib/linklist.c: fix up for linklist.h changes.
	* ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single
	  scan of the area list, rather than scanning all areas first for
	  INTER_ROUTER and then again for INTER_NETWORK. According to
	  16.2, the scan should be area specific anyway, and further
	  ospf6d does not seem to implement 16.3 anyway.
2005-04-07 07:30:20 +00:00
ajs
d2fc88962a 2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
Fix problems when netlink interfaces are renamed (same ifindex used
	for a new interface).  Start cleaning up some problems with the way
	interface names are handled.
	* interface.c: (if_new_intern_ifindex) Remove obsolete function.
	  (if_delete_update) After distributing the interface deletion message,
	  set ifp->ifindex to IFINDEX_INTERNAL.
	  (if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is
	  IFINDEX_INTERNAL.
	  (zebra_interface) Check return code from interface_cmd.func.
	  Do not set internal ifindex values to if_new_intern_ifindex(),
	  since we now use IFINDEX_INTERNAL for all pseudo interfaces.
	* kernel_socket.c: (ifm_read) Fix code and comments to reflect that
	  all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL.
        * rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex.
	  Detects interface rename events by checking if that ifindex is already
	  being used.  If it is, delete the old interface before assigning
	  the ifindex to the new interface.
	  (netlink_interface, netlink_link_change) Call set_ifindex to update
	  the ifindex.
	* if.h: Remove define for IFINDEX_INTERNBASE and add define
	  IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo-
	  interfaces should have ifindex set to 0.
	  (if_new) Remove function.
	  (if_delete_retain) New function to delete an interface without
	  removing from iflist and freeing the structure.
	  (ifname2ifindex) New function.
	* if.c: (if_new) Remove function (absorb into if_create).
	  (if_create) Replace function if_new with call to calloc.
	  Set ifp->ifindex to IFINDEX_INTERNAL.  Fix off-by-one error
	  in assert to check length of interface name.  Add error message
	  if interface with this name already exists.
	  (if_delete_retain) New function to delete an interface without
	  removing from iflist and freeing the structure.
	  (if_delete) Implement with help of if_delete_retain.
	  (ifindex2ifname) Reimplement using if_lookup_by_index.
	  (ifname2ifindex) New function to complement ifindex2ifname.
	  (interface) The interface command should check the name length
	  and fail with a warning message if it is too long.
	  (no_interface) Fix spelling in warning message.
	  (if_nametoindex) Reimplement using if_lookup_by_name.
	  (if_indextoname, ifaddr_ipv4_lookup) Reimplement using
	  if_lookup_by_index.
	* bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex
	  to IFINDEX_INTERNAL.
	* isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead
	  of if_delete, since it is generally not safe to remove interface
	  structures.  After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
	  (zebra_interface_if_lookup) Tighten up code.
	* ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function
	  was commented out.  But this is not safe: we should at least update
	  the ifindex when the interface is deleted.  So the new version
	  updates the interface status and sets ifp->ifindex to
	  IFINDEX_INTERNAL.
	  (ospf6_zebra_route_update) Use if_indextoname properly.
	* ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface
	  flags to help with debugging.
	* ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex
	  to IFINDEX_INTERNAL.
	  (zebra_interface_if_lookup) Make function static.  Tighten up code.
	* rip_interface.c: (rip_interface_delete) After deleting, set
	  ifp->ifindex to IFINDEX_INTERNAL.
	* ripng_interface.c: (ripng_interface_delete) After deleting, set
	  ifp->ifindex to IFINDEX_INTERNAL.
2005-04-02 18:38:43 +00:00
vincent
7cee1bb150 2005-03-25 Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
* interface.c, interface.h, rtadv.c, rtadv.h: extensions to Neighbor
	  discovery for Mobile IPv6.
2005-03-25 13:08:53 +00:00
hasso
ed9bb6d524 * zebra/interaface.c: "show interface description" command
implemented.
2005-03-13 19:17:21 +00:00
hasso
3452d47524 * interface.c: Fix CRC and frame errors statistics in Linux. 2005-03-06 13:42:05 +00:00
hasso
6f2c27af21 * interface.c: Better statistics output in "show interface" command in
case of /proc being used. I don't have others to test with at the
	  moment.
2005-01-18 13:44:35 +00:00
ajs
b617800227 2004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* *.c: Change level of debug messages to LOG_DEBUG.
2004-12-07 21:12:56 +00:00
ajs
6099b3b569 2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* global: Replace strerror with safe_strerror.  And vtysh/vtysh.c
	  needs to include "log.h" to pick up the declaration.
2004-11-20 02:06:59 +00:00
hasso
6bd7c6aec2 Remove dead "ip tunnel" command. 2004-10-28 17:32:27 +00:00
hasso
3fb9cd6ef4 OK. Here it is - PtP patch from Andrew J. Schorr. No problems with ospfd,
ripd might need some more testing though.
2004-10-19 19:44:43 +00:00
hasso
39db97e4e0 Some compiler warnings fixes and fix for bugzilla #119. 2004-10-12 20:50:58 +00:00
hasso
eef1fe11b8 New way to handle secondary addresses from Gilad Arnold. 2004-10-03 18:46:08 +00:00
hasso
52dc7ee65f Remove usage of evil list and listnode typedefs. 2004-09-23 19:18:23 +00:00
paul
5b73a671aa 2004-07-23 Sowmini Varadhan <Sowmini.Varadhan@Sun.COM>
* if_ioctl_solaris.c: HAVE_IPV6 ifdef fixups
        * zserv.c: ditto
        * ioctl_solaris.c: ditto.
        * interface.c: cast for LLADDR
        * interface.h: Add guards, include redistribute.h and remove
          extraneous definitions of zebra_interface_{up,down}_update
        * ioctl.h: Add AF_IOCTL define for non SOLARIS_IPV6
        * redistribute.h: include dependent header, zserv.h
        * zserv.h: include dependent header, rib.h
2004-07-23 15:26:14 +00:00
hasso
ca7769881f OK, here it is - irdp support. But don't expect me to fix any bugs in it. 2004-06-12 14:33:05 +00:00
paul
44145db3ae 2004-05-09 Paul Jakma <paul@dishone.st>
* ioctl.c: (if_get_mtu) set mtu6 to mtu
	* mtu_kvm.c: (if_kvm_get_mtu) set mtu6 to mtu
	* rt_netlink.c: (netlink_interface) set mtu6 to mtu
	  (netlink_link_change) ditto

2004-05-09 Sowmini Varadhan <sowmini.varadhan@sun.com>

	* interface.c: (if_delete_update) only used with HAVE_NETLINK
	  and RTM_IFANNOUNCE.
	  (if_flag_dump_vty) Solaris IFF_IPV4 and IFF_IPV6 if flags
	  (if_dump_vty) print mtu6 if not same as mtu
2004-05-09 11:00:23 +00:00
hasso
f1d92e17ab Temorary secondary-label fix. Real fix from Gilad will follow after release. 2004-03-18 15:40:33 +00:00
hasso
e23949c0e7 Fix help. "ipv6 ..." commands are for IPv6. 2004-03-11 15:54:02 +00:00
paul
bfc135325e From: Hasso Tepper <hasso@estpak.ee>
ensure only interfaces that are inactive or do not exist can be deleted
2003-05-24 06:40:04 +00:00
paul
32d2463ca2 From: Hasso Tepper <hasso@estpak.ee>
Add the 'no interface' command to all the daemons and vtysh. now it's
possible to delete interface from routeing daemons as well only if it
doesn't exist in os.

http://hasso.linux.ee/zebra/ht-no_interface_fix.patch
2003-05-23 09:25:20 +00:00
paul
7515cffe5e Undo Hasso last patch, about to apply a slightly updated patch. 2003-05-23 09:21:46 +00:00
paul
68f43848fa From: Hasso Tepper <hasso@estpak.ee>
http://hasso.linux.ee/zebra/ht-no_interface-23052003.patch

Add the 'no interface' command to all the daemons and vtysh.
2003-05-23 06:58:44 +00:00
paul
b571e7fc5f Amir - rev 198
Log:
Removed unused variable in interface.c
2003-04-09 07:16:59 +00:00
paul
2e3b2e474e zebra link state detection support 2002-12-13 21:03:13 +00:00
paul
48b33aaf70 patch from Frank van Maarseveen <F.vanMaarseveen@inter.NL.net>
[zebra 14599] PATCH: permit [no]multicast command for (yet) inactive interfaces
2002-12-13 20:52:52 +00:00
paul
718e374419 Initial revision 2002-12-13 20:15:29 +00:00