]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
12 years agobgpd: consolidate attribute flag checks
Paul Jakma [Tue, 17 Jan 2012 13:31:33 +0000 (13:31 +0000)]
bgpd: consolidate attribute flag checks

* bgpd/bgp_attr.c: (attr_flags_values []) array of required flags for
  attributes, EXTLEN & PARTIAL masked off as "dont care" as appropriate.
  (bgp_attr_flag_invalid) check if flags may be invalid, according to
  the above table & RFC rules.
  (bgp_attr_*) Use bgp_attr_flag_invalid.
  (bgp_attr_as4_aggregator) ditto, also take startp argument for the
  NOTIFY data.
  (bgp_attr_parse) pass startp to bgp_attr_as4_aggregator

12 years agolib: fix incorrect thread list processing loops
Paul Jakma [Tue, 28 Feb 2012 18:32:56 +0000 (18:32 +0000)]
lib: fix incorrect thread list processing loops

* thread.c: (thread_timer_process,thread_process) thread_list_delete nulls
  thread->next. Loops need to save next first, or will only process the head.
  Problem noted by Lou Berger <lberger@labn.net>.

12 years agoospf6d: remove defaults from iface config (BZ#550)
Vyacheslav Trushkin [Fri, 10 Feb 2012 06:42:45 +0000 (10:42 +0400)]
ospf6d: remove defaults from iface config (BZ#550)

12 years agoospf6d: remove own routes on SIGTERM (BZ#448)
Phil Laverdiere [Mon, 2 Jan 2012 16:04:26 +0000 (20:04 +0400)]
ospf6d: remove own routes on SIGTERM (BZ#448)

12 years agolib: fix logging of ZEBRA_HELLO message
Denis Ovsienko [Sat, 21 Jan 2012 18:50:19 +0000 (22:50 +0400)]
lib: fix logging of ZEBRA_HELLO message

12 years agolib: add THREAD_TIMER_MSEC_ON()
Everton Marques [Thu, 16 Feb 2012 05:14:54 +0000 (06:14 +0100)]
lib: add THREAD_TIMER_MSEC_ON()

 * lib/thread.h: new timer macro, millisecond precision

(this was cherrypicked from pimd to isolate all non-contained changes)

From: Everton Marques <everton.marques@gmail.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
12 years agoisisd: implement MD5 circuit authentication
Fritz Reichmann [Sat, 1 Oct 2011 13:49:48 +0000 (17:49 +0400)]
isisd: implement MD5 circuit authentication

* Replace command "isis passwd" with "isis passwd {clear|md5}"
* Verify HMAC MD5 on ISIS Hello PDUs
* Add HMAC MD5 authentication to md5.h/md5.c from RFC2104

12 years agoisisd: unexpected kernel routing table (BZ#544)
Fritz Reichmann [Sat, 1 Oct 2011 13:43:12 +0000 (17:43 +0400)]
isisd: unexpected kernel routing table (BZ#544)

Fix bug 544: isisd produces an unexpected routing table for wide-metric.

* isis_spf.c: Accept VTYPE_PSEUDO_TE_IS and VTYPE_NONPSEUDO_TE_IS
  vertex types for SPF calculation
* isis_pdu.c: Change order of TLVs to match Cisco to make bitwise
  comparison easier for Wireshark
* isis_tlv.c: EXTREME_TLV_DEBUG for TLV debugging instead of
  EXTREME_DEBUG

12 years agoisisd: fix wrong next-hops from SPF
Peter Szilagyi [Sat, 1 Oct 2011 13:22:51 +0000 (17:22 +0400)]
isisd: fix wrong next-hops from SPF

The forwarding table was filled with wrong next-hops, and which is even
worse, it was done in a totally non-deterministic way.

The next-hop set for an IP prefix by isisd was the neighbor IS from
which the flooded LSP about the IP prefix was arrived. So, if an IS
received all the LSPs through its, say, eth0 interface, all entries
in the forwarding table contained the next IS reachable via eth0 as
the next-hop.

The solution is to propagate the correct next-hop further from node to
node as the SPF algorithm traverses the graph and selects the next
node to be added to the set of already covered nodes.

Also, the construction of the tentative node list (the nodes where the
shortest path is not known yet) was buggy: if a node was already a
member of this list with a certain path cost, and an alternative path
was found to it with a lower cost while processing a pseudo-node LSP,
it was not added to the list. This way, the path selected by isisd for
a certain prefix was the first one it encountered during the LSDB
processing.

Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
12 years agoisisd: send proper LSP after DIS election
Peter Szilagyi [Sat, 1 Oct 2011 13:15:46 +0000 (17:15 +0400)]
isisd: send proper LSP after DIS election

After an IS has been elected as the Designated IS for a LAN, it did
not refresh the content of the pseudo-node after a new node has been
connected to the same LAN. Instead, the periodically reoriginated
pseudo-node LSP still contained only those IS neighbors that were
already present when the DIS election process was commenced.

The fix for the problem schedules an LSP regeneration rather than
just reoriginating the same LSP with the old content.

Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
12 years agoisisd: fix circuit state machine
Peter Szilagyi [Sat, 1 Oct 2011 13:11:45 +0000 (17:11 +0400)]
isisd: fix circuit state machine

isisd has a so-called circuit state machine that takes care about
the interface state changes, such as initializing, down, up. When
an interface was brought down by a link failure, the interface
information was deleted and set to NULL. When the link was restored
later, the interface was looked up by the old pointer, but since it
was cleared, it was never found again, resulting in an interface
never entering the up state again.

Also, the program regularly crashed because of a deleted pointer in
the same context which was later accessed without any further
checking.

Signed-off-by: Fritz Reichmann <fritz@reichmann.nl>
12 years agoospf6d: fix out of bounds write in ospf6_prefix_apply_mask
David Lamparter [Mon, 31 May 2010 10:02:31 +0000 (12:02 +0200)]
ospf6d: fix out of bounds write in ospf6_prefix_apply_mask

ospf6_prefix_apply_mask would write one byte beyond the 4/8/12
bytes allocated for prefixes of length 32/64/96.

based on report and patch by Jon Andersson <jon.andersson@thales.no>

Reported-by: Jon Andersson <jon.andersson@thales.no>
Signed-off-by: David Lamparter <equinox@diac24.net>
12 years agozebra: justify rtadv VTY commands with arguments
Denis Ovsienko [Tue, 24 Jan 2012 08:39:58 +0000 (12:39 +0400)]
zebra: justify rtadv VTY commands with arguments

ipv6 nd ra-interval
ipv6 nd ra-lifetime
ipv6 nd reachable-time
ipv6 nd home-agent-preference
ipv6 nd home-agent-lifetime
ipv6 nd router-preference

Calls to atoi() and atol() are replaced with VTY_GET_INTEGER_RANGE()
macro, command patterns are clarified and aliases of some commands
are added for consistency. Other changes are listed below.

* zebra/rtadv.c
  * ipv6_nd_ra_interval_msec(): resolve -Wsign-compare
  * ipv6_nd_ra_interval(): idem
  * rtadv_init(): update to list new aliases
* doc/ipv6.texi: update to match current implementation

12 years agozebra: freshen RFC references in rtadv
Denis Ovsienko [Tue, 24 Jan 2012 07:02:03 +0000 (11:02 +0400)]
zebra: freshen RFC references in rtadv

RFC2461 was replaced by RFC4861
RFC3775 was replaced by RFC6275
draft-ietf-mip6-mipext-advapi-03 was replaced by RFC4584

12 years agozebra: use prefix_ipv6 in rtadv_prefix
Denis Ovsienko [Sun, 8 Jan 2012 14:27:12 +0000 (18:27 +0400)]
zebra: use prefix_ipv6 in rtadv_prefix

rtadv_prefix.prefix was casted to "struct prefix_ipv6" and had the same
size, make it exactly this type to make the code a bit cleaner.

12 years agozebra: clear host bits of ND RA prefix option
Denis Ovsienko [Sun, 8 Jan 2012 13:46:34 +0000 (17:46 +0400)]
zebra: clear host bits of ND RA prefix option

RFC4861 4.6.2. Prefix Information

Prefix         An IP address or a prefix of an IP address.  The
               Prefix Length field contains the number of valid
               leading bits in the prefix.  The bits in the prefix
               after the prefix length are reserved and MUST be
               initialized to zero by the sender and ignored by
               the receiver.

* rtadv.c
  * ipv6_nd_prefix(): add missing call to apply_mask_ipv6()
  * no_ipv6_nd_prefix(): idem

12 years agozebra: justify some IPv6 ND RA timers wrt RFC
Denis Ovsienko [Fri, 30 Dec 2011 17:55:49 +0000 (21:55 +0400)]
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

12 years agozebra: fix output of IPv6 ND RA options
Denis Ovsienko [Tue, 27 Dec 2011 14:49:15 +0000 (18:49 +0400)]
zebra: fix output of IPv6 ND RA options

The following options could be configured for an interface, but were
never visible in the config text:

ipv6 nd adv-interval-option
ipv6 nd home-agent-preference
ipv6 nd home-agent-lifetime
ipv6 nd home-agent-config-flag

12 years agofix zebra protocol after MP-BGP changes
Denis Ovsienko [Mon, 5 Dec 2011 12:35:14 +0000 (16:35 +0400)]
fix zebra protocol after MP-BGP changes

The previous commits modified both zebra and bgpd for additional
SAFI field, but not any other routing daemon, which led to zebra
daemon crashing with failed assertion.

12 years agozebra: fix recent MP-BGP commits for FreeBSD
Denis Ovsienko [Mon, 5 Dec 2011 09:43:18 +0000 (13:43 +0400)]
zebra: fix recent MP-BGP commits for FreeBSD

12 years agozebra: Removal of the following warning messages
G.Balaji [Sun, 27 Nov 2011 14:39:40 +0000 (20:09 +0530)]
zebra: Removal of the following warning messages
       warning: too many arguments for format [-Wformat-extra-args]

12 years agobgpd: Addition of ipv6 network command in Multicast address family mode.
G.Balaji [Fri, 23 Sep 2011 17:06:20 +0000 (22:36 +0530)]
bgpd: Addition of ipv6 network command in Multicast address family mode.

      The patch adds the ipv6 network command in the BGP multicast address
      family mode.

12 years agozebra: IPv6 MP-BGP Routes addition and deletion
G.Balaji [Sat, 26 Nov 2011 18:10:39 +0000 (22:10 +0400)]
zebra: IPv6 MP-BGP Routes addition and deletion

This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the RTM's RIB.

12 years agobgpd: IPv6 MP-BGP Routes addition and deletion
G.Balaji [Sat, 26 Nov 2011 18:04:05 +0000 (22:04 +0400)]
bgpd: IPv6 MP-BGP Routes addition and deletion

This patch contains the following:
1. Addition of IPv6 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv6 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.

12 years agozebra: IPv4 MP-BGP Routes addition and deletion
G.Balaji [Sat, 26 Nov 2011 17:59:32 +0000 (21:59 +0400)]
zebra: IPv4 MP-BGP Routes addition and deletion

This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the RTM's RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the RTM's RIB.

12 years agobgpd: IPv4 MP-BGP Routes addition and deletion
G.Balaji [Sat, 26 Nov 2011 17:58:42 +0000 (21:58 +0400)]
bgpd: IPv4 MP-BGP Routes addition and deletion

This patch contains the following:
1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB.
2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.

12 years agozebra: include MTU option in RA on request (BZ#665)
Denis Ovsienko [Tue, 27 Dec 2011 06:45:36 +0000 (10:45 +0400)]
zebra: include MTU option in RA on request (BZ#665)

This implements a new "ipv6 nd mtu <1-65535>" interface-level command.

* doc/ipv6.texi: add description
* zebra/rtadv.c
  * rtadv_send_packet(): send option type 5, when configured
  * ipv6_nd_mtu(): new VTY helper
  * no_ipv6_nd_mtu(): ditto
  * rtadv_config_write(): add new option
  * rtadv_init(): list new helpers

12 years agobgpd: reinstate zlookup checks, required for BGP without zebra
Paul Jakma [Mon, 9 Jan 2012 11:36:23 +0000 (11:36 +0000)]
bgpd: reinstate zlookup checks, required for BGP without zebra

* bgp_nexthop.c: The nexthop lookup cache has to return success for queried
  nexthops if bgpd isn't connected to zebra, or else BGP without zebra doesn't
  work.

12 years agoMarker merge for 'RE-0.99.17.6'
Paul Jakma [Sun, 8 Jan 2012 14:47:06 +0000 (14:47 +0000)]
Marker merge for 'RE-0.99.17.6'

This marker merge (i.e. an 'ours' strategy merge) is a placeholder to show
that all commits in Quagga-RE stable, to its release RE-0.99.17.6 tag, have
been reviewed and merged into 'master'.

12 years agobgpd: Fix incorrect attribute type code in call to bgp_attr_malformed
Paul Jakma [Sun, 8 Jan 2012 14:17:42 +0000 (14:17 +0000)]
bgpd: Fix incorrect attribute type code in call to bgp_attr_malformed

12 years agobgpd: Improve flag error messages in bgp_attr_aspath
Paul Jakma [Sun, 8 Jan 2012 14:15:03 +0000 (14:15 +0000)]
bgpd: Improve flag error messages in bgp_attr_aspath

* bgpd/bgp_attr.c: (bgp_attr_aspath) error message could be misleading,
  clearly log what flag was incorrect.

  (Problem noted in "bgpd: fix error message in bgp_attr_aspath()" in
   Quagga-RE)

12 years agolib: use prefix bit length macros
Denis Ovsienko [Mon, 24 Oct 2011 14:45:05 +0000 (18:45 +0400)]
lib: use prefix bit length macros

12 years agoospfd: use IS_LSA_SELF() where appropriate
Denis Ovsienko [Mon, 24 Oct 2011 14:17:09 +0000 (18:17 +0400)]
ospfd: use IS_LSA_SELF() where appropriate

12 years agobgpd: rewrite attr flag error logging
Denis Ovsienko [Sun, 23 Oct 2011 18:32:44 +0000 (22:32 +0400)]
bgpd: rewrite attr flag error logging

* bgp_attr.c
  * attr_flag_str: new message list
  * bgp_attr_flags_diagnose(): new function, implements previously added
    error logging in a generic way
  * bgp_attr_origin(): use bgp_attr_flags_diagnose()
  * bgp_attr_nexthop(): ditto
  * bgp_attr_med(): ditto
  * bgp_attr_local_pref(): ditto
  * bgp_attr_atomic(): ditto
  * bgp_attr_originator_id(): ditto
  * bgp_attr_cluster_list(): ditto
  * bgp_mp_reach_parse(): ditto
  * bgp_mp_unreach_parse(): ditto

12 years agodoc: "[no] router zebra" does not belong to ospfd
Denis Ovsienko [Fri, 7 Oct 2011 16:43:59 +0000 (20:43 +0400)]
doc: "[no] router zebra" does not belong to ospfd

12 years agoospfd: justify ospf_default_originate_timer()
Denis Ovsienko [Mon, 3 Oct 2011 10:08:01 +0000 (14:08 +0400)]
ospfd: justify ospf_default_originate_timer()

The function is implemented in ospf_lsa.c, move its "extern" declaration
to ospf_lsa.h for consistency.

12 years agoospfd: address more trivial compiler warnings
Denis Ovsienko [Sun, 28 Aug 2011 18:38:45 +0000 (22:38 +0400)]
ospfd: address more trivial compiler warnings

* ospf_ase.c
  * ospf_ase_complete_direct_routes(): dismiss unused variable

12 years agoospf6d: ospf6_lsa_cmd_init() does not exist
Denis Ovsienko [Sat, 20 Aug 2011 18:45:58 +0000 (22:45 +0400)]
ospf6d: ospf6_lsa_cmd_init() does not exist

12 years agobgpd: improve "show ip bgp scan detail"
Denis Ovsienko [Tue, 9 Aug 2011 10:42:58 +0000 (14:42 +0400)]
bgpd: improve "show ip bgp scan detail"

* bgp_nexthop.c (show_ip_bgp_scan_tables): access proper structure field
  in AF_INET6 case, handle ifindex NH type properly

12 years agobgpd: dismiss some zlookup checks
Denis Ovsienko [Mon, 8 Aug 2011 15:36:44 +0000 (19:36 +0400)]
bgpd: dismiss some zlookup checks

bgp_nexthop_onlink(): zlookup is not used here at all
bgp_nexthop_lookup_ipv6(): rely on the detection performed by "query"
  function (this also changes the fallback value to 0), reorder if-block
bgp_nexthop_lookup(): idem

12 years agobgpd: add "show ip bgp scan detail" command
Denis Ovsienko [Fri, 5 Aug 2011 17:47:08 +0000 (21:47 +0400)]
bgpd: add "show ip bgp scan detail" command

* bgp_nexthop.c: (show_ip_bgp_scan) transform into
  show_ip_bgp_scan_tables(), which uses inet_ntop() and can dump
  nexthops on request; (show_ip_bgp_scan_detail_cmd) new function

12 years agobgpd: touch nexthop handling code
Denis Ovsienko [Fri, 5 Aug 2011 14:52:52 +0000 (18:52 +0400)]
bgpd: touch nexthop handling code

bgp_nexthop_lookup_ipv6(): declare variables where they are actually
used, drop no-op initialization (the field is already 0)
bgp_nexthop_lookup(): ditto
bgp_nexthop_check_ebgp(): rename to bgp_nexthop_onlink()
bgp_nexthop_cache_changed(): rename to bgp_nexthop_cache_different()

12 years agolib/if: trivial, fix rarely used if debug function to print everything
Paul Jakma [Fri, 6 Jan 2012 16:07:39 +0000 (16:07 +0000)]
lib/if: trivial, fix rarely used if debug function to print everything

* if.c: (if_dump) loop that doesn't do anything, wants to be
  before the zlog of what it's meant to print out so all the connected
  addresses get printed out. Trival: just a debug function

12 years agogeneral: remove inline qualifiers and move in-header functions to objects
Paul Jakma [Fri, 8 Apr 2011 11:44:43 +0000 (12:44 +0100)]
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.

12 years agoversion RE-0.99.17.6
Denis Ovsienko [Thu, 5 Jan 2012 13:46:53 +0000 (17:46 +0400)]
version RE-0.99.17.6

12 years agodoc: update BGP RFC references
Denis Ovsienko [Tue, 27 Dec 2011 14:06:45 +0000 (18:06 +0400)]
doc: update BGP RFC references

12 years agozebra: fix IPv6 RA wrt interface removal (BZ#480)
Denis Ovsienko [Tue, 27 Dec 2011 06:18:47 +0000 (10:18 +0400)]
zebra: fix IPv6 RA wrt interface removal (BZ#480)

12 years agozebra: fix ifindex test condition (BZ#487)
Matthias Ferdinand [Mon, 26 Dec 2011 12:35:30 +0000 (16:35 +0400)]
zebra: fix ifindex test condition (BZ#487)

When the same ip address is used on several interfaces,
and one of them gets deleted (or equivalent: set to down and
then address removed), rib_delete_ipv[46] will also remove
the connected route from other interfaces.

rib_delete_ipv[46] is called twice when an interface is
deleted:
    - for the "ifdown" event
    - for the address removal
(note: this may be specific to the netlink interface of linux)
The second call does not find the connected route to that same
ifindex anymore, but deletes similar connected routes to any
other ifindex instead.

Reason: the ifindex check is on the same level as the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. If everything
matches except for the ifindex, the "else" part (intended for
different route types) is executed, thus removing the route
from the wrong interface.

fix: move ifindex check inside the "then" part of the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. Now connected
routes to other ifindexes will not spill over to the "else"
part for different route types anymore.

12 years agoospf6d: fix compiler warning messages
Vyacheslav Trushkin [Thu, 22 Dec 2011 14:24:19 +0000 (18:24 +0400)]
ospf6d: fix compiler warning messages

* fix disagreement with C99 in zlog_debug calls
Format specifier in some zlog_debug calls for size_t values
was changed in order to C99 ('%u' -> '%zu').

* fix -Wsign-compare warnings
Type of return value of ospf6_packet_max() was changed.

12 years agolib: fix some strtoul() use cases
Ulrich Weber [Tue, 20 Dec 2011 22:24:11 +0000 (02:24 +0400)]
lib: fix some strtoul() use cases

...otherwise 4294967295 is not a valid value on 32bit systems

12 years agoospf6d: Route locking (memory) cleanup
Tom Goff [Wed, 10 Nov 2010 21:03:02 +0000 (13:03 -0800)]
ospf6d: Route locking (memory) cleanup

* ospf6_route.c: (ospf6_route_best_next) Allows unlock route, even
  when there's no next route.  This is consistent with how
  ospf6_route_next() behaves.

* ospf6_intra.c: (ospf6_intra_prefix_lsa_remove) Make sure the last
  route considered is always unlocked.  This is needed when the for
  loop terminates because ospf6_route_is_prefix() returns zero.

Signed-off-by: Vyacheslav Trushkin <me@dogonthesun.net>
12 years agoospf6d: Have ospf6d cleanup when it terminates normally
Tom Goff [Wed, 10 Nov 2010 21:01:41 +0000 (13:01 -0800)]
ospf6d: Have ospf6d cleanup when it terminates normally

A clean exit makes it easier to use memory debuggers.

* ospf6_asbr.c: (ospf6_asbr_terminate) Add a function to do route map
  cleanup.
* ospf6_lsa.c: (ospf6_lsa_terminate) Add a function to cleanup the lsa
  handler vector.
* ospf6_main.c: (ospf6_exit) Add an function that causes ospf6d to
  gracefully exit.
* ospf6_message.c: (ospf6_message_terminate) Add a function that frees
  the send and receive buffers.
* ospf6_top.c: (ospf6_delete) Enable the ospf6_delete() function.
  Disable ospf6 before freeing everything.

Signed-off-by: Vyacheslav Trushkin <me@dogonthesun.net>
Conflicts:

ospf6d/ospf6_lsa.h

12 years agolib: Add a function to delete all interfaces
Tom Goff [Wed, 10 Nov 2010 21:00:54 +0000 (13:00 -0800)]
lib: Add a function to delete all interfaces

if.c: (if_terminate) This adds a cleanup function that can be called
    when a daemon exits, similar to vty_terminate().

12 years agodoc: update BGP RFC references
Denis Ovsienko [Tue, 27 Dec 2011 14:06:45 +0000 (18:06 +0400)]
doc: update BGP RFC references

12 years agozebra: fix IPv6 RA wrt interface removal (BZ#480)
Denis Ovsienko [Tue, 27 Dec 2011 06:18:47 +0000 (10:18 +0400)]
zebra: fix IPv6 RA wrt interface removal (BZ#480)

12 years agozebra: fix ifindex test condition (BZ#487)
Matthias Ferdinand [Mon, 26 Dec 2011 12:35:30 +0000 (16:35 +0400)]
zebra: fix ifindex test condition (BZ#487)

When the same ip address is used on several interfaces,
and one of them gets deleted (or equivalent: set to down and
then address removed), rib_delete_ipv[46] will also remove
the connected route from other interfaces.

rib_delete_ipv[46] is called twice when an interface is
deleted:
    - for the "ifdown" event
    - for the address removal
(note: this may be specific to the netlink interface of linux)
The second call does not find the connected route to that same
ifindex anymore, but deletes similar connected routes to any
other ifindex instead.

Reason: the ifindex check is on the same level as the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. If everything
matches except for the ifindex, the "else" part (intended for
different route types) is executed, thus removing the route
from the wrong interface.

fix: move ifindex check inside the "then" part of the check
for ZEBRA_ROUTE_CONNECT/NEXTHOP_TYPE_IFINDEX. Now connected
routes to other ifindexes will not spill over to the "else"
part for different route types anymore.

12 years agoospf6d: fix compiler warning messages
Vyacheslav Trushkin [Thu, 22 Dec 2011 14:24:19 +0000 (18:24 +0400)]
ospf6d: fix compiler warning messages

* fix disagreement with C99 in zlog_debug calls
Format specifier in some zlog_debug calls for size_t values
was changed in order to C99 ('%u' -> '%zu').

* fix -Wsign-compare warnings
Type of return value of ospf6_packet_max() was changed.

12 years agolib: fix some strtoul() use cases
Ulrich Weber [Tue, 20 Dec 2011 22:24:11 +0000 (02:24 +0400)]
lib: fix some strtoul() use cases

...otherwise 4294967295 is not a valid value on 32bit systems

12 years agoospf6d: add verifying user's privileges
Vyacheslav Trushkin [Tue, 20 Dec 2011 16:52:31 +0000 (20:52 +0400)]
ospf6d: add verifying user's privileges

12 years agoospfd: fix bug in NSSA ABR status check
Denis Ovsienko [Sun, 18 Dec 2011 12:27:02 +0000 (16:27 +0400)]
ospfd: fix bug in NSSA ABR status check

* ospf_abr.c
  * ospf_abr_nssa_am_elected(): feed "best" instead of "address of best"
    into IPV4_ADDR_CMP(), because "best" is a pointer; also, mean s_addr
    field of the structures to get better typed pointers

12 years agolib: address type-punned pointers in prefix_same()
Denis Ovsienko [Sun, 18 Dec 2011 11:40:17 +0000 (15:40 +0400)]
lib: address type-punned pointers in prefix_same()

IPV4_ADDR_SAME() wasn't passed the right union member, this could cause
a bug due to strict-aliasing. IPV6_ADDR_SAME() case got its fix before
the error could be created by macro upgrade.

12 years agobgpd: justify checks for IPv4 class D/E
Denis Ovsienko [Sat, 17 Dec 2011 15:39:30 +0000 (19:39 +0400)]
bgpd: justify checks for IPv4 class D/E

* lib/prefix.h
  * IPV4_CLASS_DE(): make consistent with counterpart macros
* bgp_packet.c
  * bgp_open_receive(): test using macro instead of ">="
* bgp_route.c
  * bgp_update_rsclient(): idem
  * bgp_update_main(): idem

12 years agoospfd: fix packet reception for FreeBSD 10.
Dmitrij Tejblum [Mon, 12 Dec 2011 16:30:10 +0000 (20:30 +0400)]
ospfd: fix packet reception for FreeBSD 10.

* ospf_packet.c (ospf_recv_packet): FreeBSD, starting from version 10, will not
  subtract the IP header size from ip_len.

This is the patch from FreeBSD's ports/net/quagga/files/patch-ospfd__ospf_packet.c,
by Boris Kovalenko.

12 years agozebra: ZEBRA_HELLO and mopping up routes (BZ#448)
Vyacheslav Trushkin [Sun, 11 Dec 2011 14:48:47 +0000 (18:48 +0400)]
zebra: ZEBRA_HELLO and mopping up routes (BZ#448)

ZEBRA_HELLO message is used by routing daemons to inform zebra
what type of routes daemon will be announcing to zebra. Also
zebra uses route_type_oaths array to track which daemon announces
which protocol. Zebra mops up routes if daemon didn't for some
reason.

12 years agolib: fix type-punning in ip_masklen()
Denis Ovsienko [Fri, 16 Dec 2011 12:25:02 +0000 (16:25 +0400)]
lib: fix type-punning in ip_masklen()

ip_masklen() was likely to return incorrect results after being compiled
with -fstrict-aliasing (-O2, -O3, -Os)

12 years agolib: optimize ip_masklen()
Denis Ovsienko [Sun, 4 Dec 2011 19:21:55 +0000 (23:21 +0400)]
lib: optimize ip_masklen()

The new implementation makes use of a 64KB mapping table, which makes it
possible to compute masklen faster and with constant execution time. The
map also allows for additional version of the function, which can detect
errors in input argument.

The previous implementation had a variable cost of execution, which
depended on masklen in a non-linear manner, and at its worst (/31) was
4 times slower, than the new implementation. The only case of old
function just slightly outperforming the new one is /0, which is of
little practical interest.

12 years agoospf6d: add verifying user's privileges
Vyacheslav Trushkin [Tue, 20 Dec 2011 16:52:31 +0000 (20:52 +0400)]
ospf6d: add verifying user's privileges

12 years agoospfd: fix bug in NSSA ABR status check
Denis Ovsienko [Sun, 18 Dec 2011 12:27:02 +0000 (16:27 +0400)]
ospfd: fix bug in NSSA ABR status check

* ospf_abr.c
  * ospf_abr_nssa_am_elected(): feed "best" instead of "address of best"
    into IPV4_ADDR_CMP(), because "best" is a pointer; also, mean s_addr
    field of the structures to get better typed pointers

12 years agolib: address type-punned pointers in prefix_same()
Denis Ovsienko [Sun, 18 Dec 2011 11:40:17 +0000 (15:40 +0400)]
lib: address type-punned pointers in prefix_same()

IPV4_ADDR_SAME() wasn't passed the right union member, this could cause
a bug due to strict-aliasing. IPV6_ADDR_SAME() case got its fix before
the error could be created by macro upgrade.

12 years agobgpd: justify checks for IPv4 class D/E
Denis Ovsienko [Sat, 17 Dec 2011 15:39:30 +0000 (19:39 +0400)]
bgpd: justify checks for IPv4 class D/E

* lib/prefix.h
  * IPV4_CLASS_DE(): make consistent with counterpart macros
* bgp_packet.c
  * bgp_open_receive(): test using macro instead of ">="
* bgp_route.c
  * bgp_update_rsclient(): idem
  * bgp_update_main(): idem

12 years agoospfd: fix packet reception for FreeBSD 10.
Dmitrij Tejblum [Mon, 12 Dec 2011 16:30:10 +0000 (20:30 +0400)]
ospfd: fix packet reception for FreeBSD 10.

* ospf_packet.c (ospf_recv_packet): FreeBSD, starting from version 10, will not
  subtract the IP header size from ip_len.

This is the patch from FreeBSD's ports/net/quagga/files/patch-ospfd__ospf_packet.c,
by Boris Kovalenko.

12 years agozebra: ZEBRA_HELLO and mopping up routes (BZ#448)
Vyacheslav Trushkin [Sun, 11 Dec 2011 14:48:47 +0000 (18:48 +0400)]
zebra: ZEBRA_HELLO and mopping up routes (BZ#448)

ZEBRA_HELLO message is used by routing daemons to inform zebra
what type of routes daemon will be announcing to zebra. Also
zebra uses route_type_oaths array to track which daemon announces
which protocol. Zebra mops up routes if daemon didn't for some
reason.

12 years agolib: fix compile warnings from set-never-used
Stephen Hemminger [Tue, 6 Dec 2011 21:29:49 +0000 (01:29 +0400)]
lib: fix compile warnings from set-never-used

The if_dump code had empty loop, that caused set-never-used warning.

12 years agoRevert "lib: address -Wunused-but-set-variable"
Denis Ovsienko [Tue, 6 Dec 2011 21:35:11 +0000 (01:35 +0400)]
Revert "lib: address -Wunused-but-set-variable"

Stephen Hemminger's commits contain all the changes and
several other warning fixes.

This reverts commit 6947dbebdc91b6272f8107a6e0dd211457438606.

12 years agolib: fix SMUX compiler warnings
Stephen Hemminger [Tue, 6 Dec 2011 20:55:15 +0000 (00:55 +0400)]
lib: fix SMUX compiler warnings

Make progname a string, and cast when calling asn1.
Remove variable set but never used.

12 years agozebra: fix warnings in forward proc
Stephen Hemminger [Tue, 6 Dec 2011 20:09:56 +0000 (00:09 +0400)]
zebra: fix warnings in forward proc

Check result of fgets(), and don't set variable that is
never used.

12 years agobgpd: cleanup privs on termination
Stephen Hemminger [Tue, 6 Dec 2011 20:04:46 +0000 (00:04 +0400)]
bgpd: cleanup privs on termination

When doing valgrind testing, the privledges from zprivs_init() need
to be cleaned up on exit.

12 years agoospfd: remove unused code
Stephen Hemminger [Tue, 6 Dec 2011 19:54:17 +0000 (23:54 +0400)]
ospfd: remove unused code

The code for nssa_range and other bits that were written but
never used.

12 years agobgpd: store nexthop info for redistributed IPV6 routes
Stephen Hemminger [Tue, 6 Dec 2011 10:51:10 +0000 (14:51 +0400)]
bgpd: store nexthop info for redistributed IPV6 routes

BGP was ignoring nexthop info for static and other redistributed
routes for IPv6.  Build extra attribute info to store the nexthop.
See also:
  https://bugzilla.vyatta.com/show_bug.cgi?id=6073

12 years agoospfd: avoid redundant lookup in ospf_redistribute_withdraw
Stephen Hemminger [Tue, 6 Dec 2011 10:46:42 +0000 (14:46 +0400)]
ospfd: avoid redundant lookup in ospf_redistribute_withdraw

The old algorithim looked up every node twice as it withdrew
the entry. It looks up entry once in redistribute_withdraw, then
looks it up again info_delete. Use result of first lookup
to do the free directly.

This may explain the slow performance observed in
 https://bugzilla.vyatta.com/show_bug.cgi?id=4421

12 years agolib: fix memory leak on connect() failure
Stephen Hemminger [Tue, 6 Dec 2011 10:09:18 +0000 (14:09 +0400)]
lib: fix memory leak on connect() failure

Change sockunion_log() to not use strdup(). This fixes a small memory
leak that occurs on every failed connect(), and is simpler/cleaner.

12 years agolib: call filter delete hook before freeing access list
Stephen Hemminger [Tue, 6 Dec 2011 10:04:12 +0000 (14:04 +0400)]
lib: call filter delete hook before freeing access list

The delete_hook was being run after calling access list delete function.
This would cause ospf to dereference a NULL, in ospf_filter_update
because 'access->name' was already freed.

See also:
    https://bugzilla.vyatta.com/show_bug.cgi?id=7654

12 years agolib: fix type-punning in ip_masklen()
Denis Ovsienko [Fri, 16 Dec 2011 12:25:02 +0000 (16:25 +0400)]
lib: fix type-punning in ip_masklen()

ip_masklen() was likely to return incorrect results after being compiled
with -fstrict-aliasing (-O2, -O3, -Os)

12 years agolib: optimize ip_masklen()
Denis Ovsienko [Sun, 4 Dec 2011 19:21:55 +0000 (23:21 +0400)]
lib: optimize ip_masklen()

The new implementation makes use of a 64KB mapping table, which makes it
possible to compute masklen faster and with constant execution time. The
map also allows for additional version of the function, which can detect
errors in input argument.

The previous implementation had a variable cost of execution, which
depended on masklen in a non-linear manner, and at its worst (/31) was
4 times slower, than the new implementation. The only case of old
function just slightly outperforming the new one is /0, which is of
little practical interest.

12 years agoRevert "lib: optimize apply_mask_ipv6()"
Denis Ovsienko [Sun, 1 Jan 2012 12:33:12 +0000 (16:33 +0400)]
Revert "lib: optimize apply_mask_ipv6()"

Experience with IPv4 counterpart of this function suggests, that
this way of type-punning is likely to cause errors.

12 years agoRevert "lib: optimize apply_mask_ipv6()"
Denis Ovsienko [Sun, 1 Jan 2012 12:33:12 +0000 (16:33 +0400)]
Revert "lib: optimize apply_mask_ipv6()"

Experience with IPv4 counterpart of this function suggests, that
this way of type-punning is likely to cause errors.

12 years agoospfd: more info in LSA checksum warning (BZ#685)
Jaroslav Fojtik [Sun, 11 Dec 2011 14:22:16 +0000 (18:22 +0400)]
ospfd: more info in LSA checksum warning (BZ#685)

12 years agoospfd: more info in LSA checksum warning (BZ#685)
Jaroslav Fojtik [Sun, 11 Dec 2011 14:22:16 +0000 (18:22 +0400)]
ospfd: more info in LSA checksum warning (BZ#685)

12 years agofix set never used warnings
Stephen Hemminger [Sun, 18 Dec 2011 15:43:40 +0000 (19:43 +0400)]
fix set never used warnings

(This patch was modified to leave calls to stream_getl() in place, they
are necessary for the stream's internal pointer to advance to the
correct position. -- Denis)

Signed-off-by: Denis Ovsienko <infrastation@yandex.ru>
Fix gcc warnings about varables that are set but never used.

* bgpd/bgp_attr.c
  * cluster_unintern(): ret
  * transit_unintern(): ret
  * bgp_attr_default_intern(): attre
  * bgp_mp_reach_parse(): rd_high, rd_low
* bgpd/bgp_route.c
  * bgp_announce_check_rsclient(): bgp
* bgpd/bgp_zebra.c
  * zebra_read_ipv4(): ifindex
  * zebra_read_ipv6(): ifindex
* bgpd/bgpd.c
  * bgp_config_write_peer(): filter
* lib/distribute.c
  * distribute_list_all(): dist
  * distribute_list(): dist
  * distribute_list_prefix_all(): dist
  * distribute_list_prefix(): dist
* lib/if_rmap.c
  * if_rmap(): if_rmap
* lib/vty.c
  * vty_accept(): vty
* lib/zclient.c
  * zclient_read(): ret
* zebra/irdp_interface.c
  * if_group(): zi
* zebra/rt_netlink.c
  * kernel_read(): ret, sock

12 years agoospf6d: always remove the result of a previous SPF calculation
Tom Goff [Wed, 14 Dec 2011 10:11:29 +0000 (14:11 +0400)]
ospf6d: always remove the result of a previous SPF calculation

This is needed to avoid stale routes in some cases; the regression was
introduced by commit 1d19234e79c77a7d55194b513f2a77c6a691bc2c.

* ospf6_spf.c: (ospf6_spf_calculation) Call ospf6_spf_table_finish()
  before possibly returning if no router-LSA is found for the root of
  the SPF tree.

12 years agobgpd: fix regression in ORF procesing (BZ#688)
Denis Ovsienko [Tue, 13 Dec 2011 17:11:39 +0000 (21:11 +0400)]
bgpd: fix regression in ORF procesing (BZ#688)

This issue has been pointed out by Lou Berger and Tim Browski.

* bgp_packet.c
  * bgp_route_refresh_receive(): restore if() condition, which was
    broken by commit fdbc8e77c88f751924299d0bc752371d5cc31116

12 years agolib: optimize apply_mask_ipv6()
Denis Ovsienko [Tue, 18 Oct 2011 18:02:52 +0000 (22:02 +0400)]
lib: optimize apply_mask_ipv6()

12 years agolib: optimize apply_mask_ipv4()
Denis Ovsienko [Tue, 18 Oct 2011 14:33:53 +0000 (18:33 +0400)]
lib: optimize apply_mask_ipv4()

12 years agolib: make masklen2ip6() safer and faster
Denis Ovsienko [Mon, 17 Oct 2011 17:11:10 +0000 (21:11 +0400)]
lib: make masklen2ip6() safer and faster

12 years agolib: fix endianness of masklen2ip()
Denis Ovsienko [Tue, 11 Oct 2011 11:17:45 +0000 (15:17 +0400)]
lib: fix endianness of masklen2ip()

12 years agolib: make masklen2ip() safer and faster
Denis Ovsienko [Sat, 8 Oct 2011 14:15:21 +0000 (18:15 +0400)]
lib: make masklen2ip() safer and faster

12 years agoospf6d: decode message type with LOOKUP()
Denis Ovsienko [Fri, 14 Oct 2011 17:59:58 +0000 (21:59 +0400)]
ospf6d: decode message type with LOOKUP()

* ospf6_message.h
  * OSPF6_MESSAGE_TYPE_CANONICAL(): dismiss
  * OSPF6_MESSAGE_TYPE_NAME(): dismiss
* ospf6_message.c
  * ospf6_message_type_str: rewrite as a message list, add max value
  * ospf6_packet_examin(): update to use LOOKUP()
  * ospf6_receive(): idem
  * ospf6_send(): idem

12 years agoospf6d: make some old sizing checks assertions
Denis Ovsienko [Sat, 8 Oct 2011 13:22:45 +0000 (17:22 +0400)]
ospf6d: make some old sizing checks assertions

As long as ospf6_packet_examin() is now the single checkpoint for
received packets, most of the old checks performed elsewhere can
be converted into assert() constructs. Malformed input data at
respective points can be attributed solely to a programming error,
not a malformed packet.

* ospf6_message.c
  * ospf6_hello_print()
  * ospf6_dbdesc_print()
  * ospf6_lsreq_print()
  * ospf6_lsupdate_print()
  * ospf6_lsack_print()
  * ospf6_hello_recv()
  * ospf6_dbdesc_recv_master()
  * ospf6_dbdesc_recv_slave()
  * ospf6_lsreq_recv()
  * ospf6_lsupdate_recv()
  * ospf6_lsupdate_recv()
  * ospf6_lsack_recv()
  * ospf6_receive()

12 years agolib: spelling
Denis Ovsienko [Fri, 14 Oct 2011 16:56:19 +0000 (20:56 +0400)]
lib: spelling

12 years agolib: add sockopt helper for setting IPV6_V6ONLY and use it
David Lamparter [Sun, 4 Oct 2009 14:21:49 +0000 (16:21 +0200)]
lib: add sockopt helper for setting IPV6_V6ONLY and use it

getaddrinfo returns a list of socket parameters for listening. it
will contain both IPv4 and IPv6 listening sockets. unless we use
IPV6_V6ONLY on the IPv6 ones, only the socket listed first will
work. if the IPv4 one came first, the IPv6 one would get an
"Address in use" error.

this functionality was already present for bgpd and its listening
sockets. as it is needed for vtys as well, make it a common helper.

Conflicts:

lib/sockunion.c