Commit Graph

404 Commits

Author SHA1 Message Date
G.Balaji
73bfe0bd9a 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.
2012-01-23 14:31:05 +04:00
G.Balaji
c7ec179a95 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.
2012-01-23 14:30:50 +04:00
G.Balaji
5a616c08ce 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.
2012-01-23 14:30:33 +04:00
Paul Jakma
fc98d16ea7 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.
2012-01-09 11:36:23 +00:00
Paul Jakma
f31d6927b2 bgpd: Fix incorrect attribute type code in call to bgp_attr_malformed 2012-01-08 14:21:55 +00:00
Paul Jakma
83a9a2213a 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)
2012-01-08 14:15:03 +00:00
Denis Ovsienko
afcb767922 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
2012-01-08 12:57:35 +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
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
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
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
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
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
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
Denis Ovsienko
05e54ee3df build: delete .cvsignore files 2011-12-13 14:27:01 +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
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
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
Stephen Hemminger
04d5e24d74 bgpd: cleanup privs on termination
When doing valgrind testing, the privledges from zprivs_init() need
to be cleaned up on exit.
2011-12-07 01:23:58 +04:00
Stephen Hemminger
f04a80a5d2 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
2011-12-06 15:03:00 +04:00
Oleg A. Arkhangelsky
ce0af6ff5a bgpd: fix memory leak for extra attributes
this fixes commit b881c7074b
2011-12-03 15:18:19 +04:00
David Lamparter
2fbd6f5a62 bgpd: remove unused function bgp_bind_address
bgp_bind_address is replaced with sockunion_bind.
2011-11-21 19:42:05 +04:00
David Lamparter
1727d2e2b9 bgpd: fix update-source for IPv6 (BZ#548)
if update-source was given as interface name, bgpd was unconditionally
trying to bind to an IPv4 address from that interface.

change function to find the best-matching (number of address bits)
same-family address on the interface.
2011-11-21 19:41:59 +04:00
Dylan Hall
3cf1288bfd bgpd: fix "nexthop-local unchanged" (BZ#350) 2011-11-15 21:35:11 +04:00
Chris Luke
5c88f19d5b bgpd: justify capabilities for TOS setting
To set the TOS bits on TCP connections, platforms that restrict
capabilities need the priv level to be raised before the sockopt
is set, and this requires the ZCAP_NET_ADMIN priv.

* bgp_main.c: update _caps_p to include ZCAP_NET_ADMIN
* bgp_network.c
  * bgp_connect(): request ZPRIVS_RAISE/ZPRIVS_LOWER
  * bgp_listener(): request ZPRIVS_RAISE earlier
2011-11-15 20:57:02 +04:00
Sergey Y. Afonin
1758dbaa3b bgpd: revised fix to --dryrun (BZ#622) 2011-11-15 20:45:17 +04:00
Denis Ovsienko
267551879e bgpd: fix 2 more cases of length error reporting
* bgp_attr.c (bgp_attr_originator_id, bgp_attr_cluster_list): provide
  required arguments to bgp_attr_malformed()
2011-10-26 19:38:49 +04:00
Denis Ovsienko
b4cd242151 bgpd: check AGGREGATOR attr flags (BZ#678)
* bgp_attr.c
  * bgp_attr_aggregator(): check Optional/Transitive flag bits
2011-10-22 22:32:26 +04:00
Denis Ovsienko
bbb04bf3bb bgpd: fix more regressions in attr flag checks
Commit 05a4936b713b9882171d0f7fb20b8439df23939e fixed some of the
attributes involved, but not all. This commit should do it.

* bgp_attr.c
  * bgp_attr_originator_id()
  * bgp_attr_cluster_list()
  * bgp_mp_reach_parse()
  * bgp_mp_unreach_parse()
2011-10-19 17:28:01 +04:00
Denis Ovsienko
abc384f85b bgpd: use bgp_attr_malformed()
Some of the recent attribute flags/length checks copied from QRE use
bgp_notify_send_with_data() directly, but master branch assumes
using bgp_attr_malformed().

* bgp_attr.c
  * bgp_attr_med()
  * bgp_attr_local_pref()
  * bgp_attr_atomic()
  * bgp_attr_originator_id()
  * bgp_attr_cluster_list()
  * bgp_mp_reach_parse()
  * bgp_mp_unreach_parse()
2011-10-18 13:55:07 +04:00
Denis Ovsienko
565b828dc0 bgpd: add flag checks for MP_(UN)REACH_NLRI
* bgp_attr.[ch]
  * bgp_mp_reach_parse(): add extra arguments and a uniform flag
    check block
  * bgp_mp_unreach_parse(): idem
  * bgp_attr_parse(): provide extra arguments
* bgp_mp_attr_test.c
  * parse_test(): justify respective calls
2011-10-17 19:07:02 +04:00
Denis Ovsienko
f8627ff1ef bgpd: fix spelling of CLUSTER_LIST 2011-10-17 19:03:56 +04:00
Denis Ovsienko
0b83044b91 bgpd: check CLUSTER_LIST attribute flags
* bgp_attr.c
  * bgp_attr_cluster_list(): accept extra argument, add checks for
    "optional", "transitive" and "partial" bits, log each error
    condition independently
  * bgp_attr_parse(): provide extra arguments
2011-10-17 19:03:31 +04:00
Denis Ovsienko
d595b566bc bgpd: check ORIGINATOR_ID attribute flags
* bgp_attr.c
  * bgp_attr_originator_id(): accept extra argument, add checks for
    "optional", "transitive" and "partial" bits, log each error
    condition independently
  * bgp_attr_parse(): provide extra arguments
2011-10-17 19:02:55 +04:00
Stephen Hemminger
6d0732c8ab IPv6 transport class suppport
IPv6 supports the same concept of differentiated service for routing
protocols as IPv4, but like too many things, the standards committee
decided that having two names for the same thing wasn't good enough and
introduced a third more generic term transport class.

The socket option to set transport class works the same as IPv4, but the
arguments are different.

* lib/sockopt.[ch]
  * setsockopt_ipv6_tclass(): new function
* bgpd/bgp_network.c
  * bgp_connect(): set socket option
  * bgp_listener(): set socket option
* ospf6d/ospf6_network.c
  * ospf6_set_transport_class(): new function
  * ospf6_serv_sock(): set socket option
* ripngd/ripngd.c
  * ripng_make_socket(): set socket option
2011-10-17 18:59:19 +04:00
Denis Ovsienko
a5b228b379 bgpd: fix regression in improved attr flag checks
Commit 2febf323411c1aed9d7694898f852ce2ef36a7e5 assumed every flag
bit except optional/transitive/partial unset, which at times could
not be true for "extended length" bit.

* bgp_attr.c
  * bgp_attr_origin(): exclude BGP_ATTR_FLAG_EXTLEN from comparison
  * bgp_attr_nexthop(): idem
  * bgp_attr_med(): idem
  * bgp_attr_local_pref(): idem
  * bgp_attr_atomic(): idem
2011-10-12 13:59:09 +04:00
Peter Pentchev
21cc76941a bgpd: fix parsing of graceful restart cap. (#663)
"While setting up a testbed, I ran across a little problem in the
parsing of the "graceful restart" BGP capability that resulted in
Quagga not actually activating it for the peer in question - when
the peer sent a single AFI/SAFI block."

* bgp_open.c
  * bgp_capability_restart(): actually process the last AFI/SAFI block
2011-10-08 20:17:21 +04:00
Denis Ovsienko
a624cae2b2 bgpd: improve attr length error handling (BZ#679)
* bgp_attr.c
  * bgp_attr_parse(): provide extra argument to bgp_attr_aggregator()
  * bgp_attr_local_pref(): use bgp_notify_send_with_data()
  * bgp_attr_atomic(): idem
  * bgp_attr_aggregator(): idem

Conflicts:

	bgpd/bgp_attr.c
2011-10-08 14:18:00 +04:00
Denis Ovsienko
b84b62dfb6 bgpd: improve attr flags checks
Do not check each of the Optional/Transitive/Partial attribute
flag bits, when their only valid combination is known in advance,
but still perform bit-deep error message logging. This change
assumes unused (low-order) 4 bits of the flag octet cleared.

* bgp_attr.c
  * bgp_attr_origin(): rewrite check
  * bgp_attr_nexthop(): idem
  * bgp_attr_med(): idem
  * bgp_attr_local_pref(): idem
  * bgp_attr_atomic(): idem

Conflicts:

	bgpd/bgp_attr.c
2011-09-30 14:11:13 +04:00
Denis Ovsienko
2d42e68aa0 bgpd: ignore 4 bits of attribute flags byte 2011-09-30 10:32:02 +04:00
Denis Ovsienko
214bcaa13e bgpd: add missing "partial" flag checks (BZ#676)
ORIGIN handling function used to have "partial" bit check and recent
commits added it for NEXT_HOP, MULTI_EXIT_DISC and ATOMIC_AGGREGATE
cases. This commit adds "partial" check for AS_PATH and LOCAL_PREF
cases, which should leave attributes 1 through 6 inclusive completely
covered with attribute flags checks.

* bgp_attr.c
  * bgp_attr_origin(): use bit-by-bit checks for better diagnostics
  * bgp_attr_aspath(): add flag check
  * bgp_attr_local_pref(): idem

Conflicts:

	bgpd/bgp_attr.c
2011-09-30 10:30:36 +04:00
Denis Ovsienko
bc3443ebf0 bgpd: improve NEXT_HOP attribute checks (BZ#680)
* lib/prefix.h
  * IPV4_CLASS_DE(): new helper macro
* bgp_attr.c
  * bgp_attr_nexthop(): add check for "partial" bit, refresh flag error
    reporting, explain meaning of RFC4271 section 6.3 and implement it

Conflicts:

	bgpd/bgp_attr.c
2011-09-30 01:24:35 +04:00
Denis Ovsienko
0a28130d35 bgpd: rename SAFI 3 according to RFC4760
- SAFI value 3 is reserved.  It was assigned by RFC 2858 for a use
  that was never fully implemented, so it is deprecated by this
  document.

* zebra.h: rename macro
* bgp_fsm.c: (bgp_graceful_restart_timer_expire,
  bgp_graceful_stale_timer_expire, bgp_stop, bgp_establish): update
* bgpd.c: (peer_nsf_stop): update
* bgp_open.c: (bgp_capability_vty_out): SAFI 3 isn't a recognized case
  any more
2011-09-29 22:19:08 +04:00
Denis Ovsienko
42e6d745d1 bgpd: more SAFI fixes
(with resolved conflict in bgpd/bgp_packet.c)

Two macros resolving to the same integer constant broke a case block and
a more thorough merge of BGP_SAFI_VPNV4 and BGP_SAFI_VPNV6 was
performed.

* bgpd.h: MPLS-labeled VPN SAFI is AFI-independent, switch to single
* macro
* bgp_capability_test.c: update test data
* bgp_mp_attr_test.c: idem
* bgp_route.c: (bgp_maximum_prefix_overflow, bgp_table_stats_vty) update
  macro and check conditions (where appropriate)
* bgp_packet.c: (bgp_route_refresh_send, bgp_capability_send,
  bgp_update_receive, bgp_route_refresh_receive): idem
* bgp_open.c: (bgp_capability_vty_out, bgp_afi_safi_valid_indices,
  bgp_open_capability_orf, bgp_open_capability): idem
* bgp_attr.c: (bgp_mp_reach_parse, bgp_packet_attribute,
  bgp_packet_withdraw): idem
2011-09-29 22:14:11 +04:00
Denis Ovsienko
beb1ca03bf bgpd: fix SAFI for for MPLS labeled VPN-IPv6
* bgpd.h: change value of BGP_SAFI_VPNV6 to 128 (RFC4659, BZ#659)
* bgp_route.c: (bgp_table_stats_vty) fix length argument to strncmp()
2011-09-29 22:07:54 +04:00
Dmitrij Tejblum
4b4e07d2d8 bgpd: don't be confused by "unspecific" subcode in the NOTIFY message.
* bgp_debug.c (bgp_notify_open_msg, bgp_notify_update_msg,
  bgp_notify_cease_msg, bgp_notify_capability_msg): add messages for
  "unspecific" subcode.
2011-09-27 21:46:04 +04:00