Commit Graph

2254 Commits

Author SHA1 Message Date
Denis Ovsienko
2894cdc344 zebra: fix IPv6 RA wrt interface removal (BZ#480) 2012-01-02 19:51:27 +04:00
Matthias Ferdinand
6dd6c307bf 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.
2012-01-02 19:51:20 +04:00
Vyacheslav Trushkin
b4b315989f 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.
2012-01-02 19:51:11 +04:00
Ulrich Weber
830526a512 lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
2012-01-02 19:50:57 +04:00
Tom Goff
65cd7a4a66 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>
2012-01-02 19:50:50 +04:00
Tom Goff
36d3e8d828 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
2012-01-02 19:50:41 +04:00
Tom Goff
a809d1cc54 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().
2012-01-02 19:50:32 +04:00
Vyacheslav Trushkin
13351032d1 ospf6d: add verifying user's privileges 2012-01-02 17:28:01 +04:00
Denis Ovsienko
85136e9048 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
2012-01-02 17:27:53 +04:00
Denis Ovsienko
7eed92b965 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.
2012-01-02 17:27:44 +04:00
Denis Ovsienko
45b341f72d 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
2012-01-02 17:27:34 +04:00
Dmitrij Tejblum
b31d8fc301 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.
2012-01-02 17:27:26 +04:00
Vyacheslav Trushkin
89e9f82e0b 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.
2012-01-02 17:27:19 +04:00
Stephen Hemminger
07bb964ef1 lib: fix compile warnings from set-never-used
The if_dump code had empty loop, that caused set-never-used warning.
2012-01-02 17:27:13 +04:00
Denis Ovsienko
94e7cd90fe Revert "lib: address -Wunused-but-set-variable"
Stephen Hemminger's commits contain all the changes and
several other warning fixes.

This reverts commit 6947dbebdc91b6272f8107a6e0dd211457438606.
2012-01-02 17:27:05 +04:00
Stephen Hemminger
4f5e717413 lib: fix SMUX compiler warnings
Make progname a string, and cast when calling asn1.
Remove variable set but never used.
2012-01-02 17:16:07 +04:00
Stephen Hemminger
7e7a2d38b2 zebra: fix warnings in forward proc
Check result of fgets(), and don't set variable that is
never used.
2012-01-02 17:15:55 +04:00
Stephen Hemminger
8502229b7e bgpd: cleanup privs on termination
When doing valgrind testing, the privledges from zprivs_init() need
to be cleaned up on exit.
2012-01-02 17:15:42 +04:00
Stephen Hemminger
a80e20d175 ospfd: remove unused code
The code for nssa_range and other bits that were written but
never used.
2012-01-02 17:15:31 +04:00
Stephen Hemminger
840faaeb00 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
2012-01-02 17:15:19 +04:00
Stephen Hemminger
4fafd3deef 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
2012-01-02 17:15:09 +04:00
Stephen Hemminger
c17fbd6b1e 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.
2012-01-02 17:14:33 +04:00
Stephen Hemminger
ed269db39a 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
2012-01-02 17:14:17 +04:00
Denis Ovsienko
ce77002e90 lib: fix type-punning in ip_masklen()
ip_masklen() was likely to return incorrect results after being compiled
with -fstrict-aliasing (-O2, -O3, -Os)
2012-01-02 17:10:55 +04:00
Denis Ovsienko
e1fabbb86c 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.
2012-01-02 17:10:42 +04:00
Denis Ovsienko
bf19277c34 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.
2012-01-01 16:37:39 +04:00
Jaroslav Fojtik
7b0d1c6d31 ospfd: more info in LSA checksum warning (BZ#685) 2011-12-21 16:23:50 +04:00
Denis Ovsienko
6258c2ae35 zebra: spelling 2011-12-13 14:21:02 +04:00
Denis Ovsienko
1b960ed436 build: delete .cvsignore files 2011-12-13 14:20:54 +04:00
Denis Ovsienko
42140fb1b1 ospfd: spelling 2011-12-13 14:20:46 +04:00
Vyacheslav Trushkin
d5cd9a9758 lib: clearing zclient.c for some cases of building
lib/zclient.c: using of HAVE_TCP_ZEBRA in zclient_socket_*
definitions extended by else clause.
2011-12-13 14:15:48 +04:00
Vyacheslav Trushkin
271ee735ed quagga: option "-z" ("--socket <path>") added
All daemons modified to support custom path to zserv
socket.

lib: generalize a zclient connection

zclient_socket_connect added. zclient_socket and
zclient_socket_un were hidden under static expression.
"zclient_serv_path_set" modified.
2011-12-13 14:13:06 +04:00
Vyacheslav Trushkin
844ee4a8ac isisd: indent longopts array 2011-12-13 14:12:16 +04:00
Vyacheslav Trushkin
1c8afb7c20 bgpd: implement 'match probability' in route-maps
New clause 'match probability <percentage value>'
was added in route-maps (bgpd/bgp_routemap.c modified).
2011-12-13 14:11:03 +04:00
Vyacheslav Trushkin
fd31c50bc3 ospf6d: justify multicast group management
* ospf6_network.[ch]
  * ospf6_sso(): new function supersedes ospf6_join_allspfrouters(),
    ospf6_leave_allspfrouters(), ospf6_join_alldrouters() and
    ospf6_leave_alldrouters()
* ospf6_interface.c
  * ospf6_interface_state_change(): update respectively
  * interface_up(): ditto
  * interface_down(): ditto
2011-12-13 14:10:31 +04:00
Ulrich Weber
c0cad43688 ripngd: limit max of "timers basic" to 65535 as documented
and use VTY_GET_INTEGER_RANGE instead of calling strtoul
2011-12-13 14:10:04 +04:00
Ulrich Weber
5009160c74 bgp: use VTY_GET_INTEGER_RANGE() in bgp_clear()
Second patch replaces "VTY_GET_LONG ("AS", as_ul, arg);"
by "VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);"
as done in all other code, which parses AS numbers.
2011-12-13 14:09:25 +04:00
Vyacheslav Trushkin
1ce0878791 ospf6d: implement 'match interface' for route-maps
ospf6_routemap_rule_match_interface* was imported from ospfd
daemon with minor changes. new CLI options defined.

`ospf6_routemap_rule_match_interface' was changed to support
IPv6 (ospfv3) route's external information.
2011-12-13 14:08:40 +04:00
Roderick Schertler
a994c7b6bb doc: rectify "match ip next-hop" in ripd (BZ#537) 2011-11-21 18:36:52 +04:00
Denis Ovsienko
9ebf400a1c bgpd: fix AS4_PATH attr flag check (BZ#676)
AS_PATH is a well-known, transitive path attribute and cannot be flagged
as "Partial". This is what commit
77a20b8af32c926176f8492a086d9e4ec670496b implemented, but it did not
account, that bgp_attr_aspath() is also used to process AS4_PATH, which
is an optional, transitive path attribute and as such may be flagged as
"Partial". This change justfies the test condition.
2011-11-21 18:35:48 +04:00
Denis Ovsienko
0f572cde26 bgpd: fix 2 more cases of length error reporting
* bgp_attr.c (bgp_attr_originator_id, bgp_attr_cluster_list): use
  bgp_notify_send_with_data()
2011-11-21 18:35:32 +04:00
Denis Ovsienko
d3962ba7c7 lib: use prefix bit length macros 2011-11-21 18:35:18 +04:00
Denis Ovsienko
f6247bf278 ospfd: use IS_LSA_SELF() where appropriate 2011-11-21 18:33:15 +04:00
Denis Ovsienko
26f5e782ef 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
2011-11-21 18:33:07 +04:00
Denis Ovsienko
5c8d16fd85 ospfd: spelling/format fix 2011-11-21 18:32:58 +04:00
Denis Ovsienko
12da1a188a bgpd: check AGGREGATOR attr flags (BZ#678)
* bgp_attr.c
  * bgp_attr_aggregator(): check Optional/Transitive flag bits
2011-11-21 18:32:45 +04:00
Denis Ovsienko
c6cb2d9151 lib: optimize apply_mask_ipv6() 2011-11-21 18:32:33 +04:00
Denis Ovsienko
ed7a62efea lib: optimize apply_mask_ipv4() 2011-11-21 18:32:23 +04:00
Denis Ovsienko
3062d2dab6 bgpd: fix error message in bgp_attr_aspath() 2011-11-21 18:26:39 +04:00
Denis Ovsienko
49ff274c29 lib: make masklen2ip6() safer and faster 2011-11-21 18:26:04 +04:00