Commit Graph

2310 Commits

Author SHA1 Message Date
Denis Ovsienko
72f062b6eb ospfd: address more trivial compiler warnings
* ospf_ase.c
  * ospf_ase_complete_direct_routes(): dismiss unused variable
2012-01-08 11:43:07 +00:00
Denis Ovsienko
5e1731ac1d ospf6d: ospf6_lsa_cmd_init() does not exist 2012-01-08 11:39:50 +00:00
Denis Ovsienko
0e8032d699 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
2012-01-08 11:31:50 +00:00
Denis Ovsienko
b64bfc1c4a 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
2012-01-08 11:31:35 +00:00
Denis Ovsienko
318f0d8a7f 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
2012-01-08 11:31:17 +00:00
Denis Ovsienko
8e80bdf20f 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()
2012-01-08 11:30:55 +00:00
Paul Jakma
23be94ea00 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
2012-01-06 16:19:36 +00: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
Denis Ovsienko
651e70d7f4 doc: update BGP RFC references 2012-01-02 19:14:18 +04:00
Denis Ovsienko
fb5174a27e zebra: fix IPv6 RA wrt interface removal (BZ#480) 2012-01-02 19:14:08 +04:00
Matthias Ferdinand
4f1735fd6a 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:13:58 +04:00
Vyacheslav Trushkin
cba1fab2d7 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:13:48 +04:00
Ulrich Weber
664711c1f4 lib: fix some strtoul() use cases
...otherwise 4294967295 is not a valid value on 32bit systems
2012-01-02 19:13:28 +04:00
Vyacheslav Trushkin
6fd16207fe ospf6d: add verifying user's privileges 2012-01-02 18:38:11 +04:00
Denis Ovsienko
4e677f52db 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 18:38:04 +04:00
Denis Ovsienko
fe40bfa2e1 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 18:37:54 +04:00
Denis Ovsienko
733cd9e579 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 18:37:42 +04:00
Dmitrij Tejblum
de5ccb9602 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 18:37:32 +04:00
Vyacheslav Trushkin
2ea1ab1c30 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 18:37:24 +04:00
Denis Ovsienko
2654e43ca2 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 18:36:58 +04:00
Denis Ovsienko
d171bf58ef 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 18:23:24 +04:00
Denis Ovsienko
8c7f49d277 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:45 +04:00
Jaroslav Fojtik
223da1a912 ospfd: more info in LSA checksum warning (BZ#685) 2011-12-21 16:42:35 +04:00
Stephen Hemminger
9206f9ecd5 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
2011-12-18 20:21:21 +04:00
Tom Goff
b48cebbba0 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 1d19234e79.

* 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.
2011-12-14 14:11:29 +04:00
Denis Ovsienko
bb915f5fa6 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 fdbc8e77c8
2011-12-13 21:11:39 +04:00
Denis Ovsienko
32ca973920 lib: optimize apply_mask_ipv6() 2011-12-13 19:30:49 +04:00
Denis Ovsienko
caff7905e2 lib: optimize apply_mask_ipv4() 2011-12-13 19:30:45 +04:00
Denis Ovsienko
21f569e37d lib: make masklen2ip6() safer and faster 2011-12-13 19:30:39 +04:00
Denis Ovsienko
051954f574 lib: fix endianness of masklen2ip() 2011-12-13 19:30:29 +04:00
Denis Ovsienko
9663386f16 lib: make masklen2ip() safer and faster 2011-12-13 19:30:17 +04:00
Denis Ovsienko
5031ed1347 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
2011-12-13 19:27:34 +04:00
Denis Ovsienko
fa0796661c 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()
2011-12-13 19:27:14 +04:00
Denis Ovsienko
0ead5c183c lib: spelling 2011-12-13 19:25:06 +04:00
David Lamparter
ca05126921 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
2011-12-13 19:23:38 +04:00
David Lamparter
e0ca5fde7b lib: put route_types.txt to real use
this replaces most occurences of routing protocol lists by preprocessor
defines from route_types.h. the latter is autogenerated from
route_types.txt by a perl script (previously awk). adding a routing
protocol now is mostly a matter of changing route_types.txt and log.c.

Conflicts:

	lib/route_types.awk
2011-12-13 19:13:17 +04:00
David Lamparter
ebf08631ca zebra: fix redistribution of new protocols
redistribute is currently limited to "known" protocols. there is no
reason for this limitation, so, remove it.
2011-12-13 19:12:55 +04:00
David Lamparter
7052f22880 rib: default distance value for new protocols (v2)
adding protocols and forgetting to update zebra_rib.c currently causes
a beyond end of array access for the default distance value. fix by
making 150 the default distance for unknown routing protocols.

150 is higher than all other IGPs but lower than iBGP (200)
2011-12-13 19:12:49 +04:00
David Lamparter
ca9f342c2c build: fixup autoconf for cross-compiling (to OpenWRT)
MALLOC/REALLOC aren't used properly (no rpl_malloc), remove them

while at it, infer some sane ipforwarding method from the OS value.
(v2 on that, "==" is not a proper operator for standard "test")
2011-12-13 19:12:42 +04:00
Tom Goff
a34eb3689c zebra: set the interface link-layer socket address
* kernel_socket.c: (ifm_read) The reorganization from commit
  6fe70d1b35 removed setting the
  interface link-layer socket address structure on routing socket
  platforms.  This restores saving the link-layer information because
  it might be used elsewhere: rtm_write() when no gateway is given,
  if_dump_vty() and rtadv_send_packet().
2011-12-13 19:05:24 +04:00
Denis Ovsienko
85a2ebf2a1 zebra: spelling 2011-12-13 14:27:10 +04:00
Denis Ovsienko
05e54ee3df build: delete .cvsignore files 2011-12-13 14:27:01 +04:00
Denis Ovsienko
ad8d4802a3 ospfd: spelling 2011-12-13 14:26:53 +04:00
Vyacheslav Trushkin
3414d03545 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:26:45 +04:00
Vyacheslav Trushkin
b51146856e 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:26:28 +04:00
Vyacheslav Trushkin
2f658673fa isisd: indent longopts array 2011-12-13 14:26:18 +04:00
Vyacheslav Trushkin
1add115a9c 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:25:54 +04:00
Vyacheslav Trushkin
9a9446eabb 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:25:43 +04:00
Ulrich Weber
6989880ad7 ripngd: limit max of "timers basic" to 65535 as documented
and use VTY_GET_INTEGER_RANGE instead of calling strtoul
2011-12-13 14:25:33 +04:00
Ulrich Weber
bde12e3fd5 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:25:25 +04:00