[Xorp-hackers] [greearb/xorp.ct] f01c2e: xorp: rib: Make RouteEntry more generic

GitHub noreply at github.com
Wed Jun 20 08:16:15 PDT 2012


  Branch: refs/heads/master
  Home:   https://github.com/greearb/xorp.ct
  Commit: f01c2eb428a588a61eeaefc158d68457a17b5dff
      https://github.com/greearb/xorp.ct/commit/f01c2eb428a588a61eeaefc158d68457a17b5dff
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/route.cc
    M xorp/rib/route.hh

  Log Message:
  -----------
  xorp: rib: Make RouteEntry more generic

Make RouteEntry more generic, by making it templetized.
Move _net and _policitags to this class, because all classes that inherit it are using those fields.

IPRouteEntry overides the nexthop function of RouteEntry with different NextHop type.
To be more specific it overides it with IPNextHop type.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 50a0115b5d74b6c1186be502eb526d3c0451c85c
      https://github.com/greearb/xorp.ct/commit/50a0115b5d74b6c1186be502eb526d3c0451c85c
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_deletion.cc
    M xorp/rib/rt_tab_extint.cc
    M xorp/rib/rt_tab_origin.cc
    M xorp/rib/rt_tab_pol_conn.cc
    M xorp/rib/rt_tab_register.cc

  Log Message:
  -----------
  xorp: rib: Use operator* instead of payload() method for Trie class

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 382fe0b7c71b60e92a97c678f773ed3affa34985
      https://github.com/greearb/xorp.ct/commit/382fe0b7c71b60e92a97c678f773ed3affa34985
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib.cc
    M xorp/rib/rib.hh
    M xorp/rib/route.cc
    M xorp/rib/route.hh
    M xorp/rib/rt_tab_extint.cc
    M xorp/rib/tests/test_deletion.cc
    M xorp/rib/tests/test_redist.cc

  Log Message:
  -----------
  xorp: rib: templatize RibVif class

Make RibVif's class interface cleaner and easier to understand.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 52b91bad501ee25e9fc3aa343f0bd91caf7bdfcc
      https://github.com/greearb/xorp.ct/commit/52b91bad501ee25e9fc3aa343f0bd91caf7bdfcc
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/libxorp/nexthop.cc
    M xorp/libxorp/nexthop.hh
    M xorp/rib/rib.cc
    M xorp/rib/route.cc
    M xorp/rib/route.hh
    M xorp/rib/rt_tab_extint.cc
    M xorp/rib/rt_tab_register.cc
    M xorp/rib/tests/rt_tab_expect.cc
    M xorp/rib/tests/test_register.cc
    M xorp/rib/xrl_target.cc

  Log Message:
  -----------
  xorp: rib: IPRouteEntry directly return NextHop of appropriate type

IPRouteEntry has member of IPNextHop type. It now returns nexthop of
IPNextHop type, without dynamic_casting.
This alows us to avoid unecesary casting!

DiscardNextHop and UnreachableNextHop directly inherit from
IPNextHop.

Passed all rib tests.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 3b95bf9e585aa2e7db15d300bb1a8138e150862e
      https://github.com/greearb/xorp.ct/commit/3b95bf9e585aa2e7db15d300bb1a8138e150862e
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib_manager.cc
    M xorp/rib/rib_manager.hh

  Log Message:
  -----------
  xorp: rib: Make helper functions be static RibManager members

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 22dcc5f392d8a6904afc95967032f6c6b568cc43
      https://github.com/greearb/xorp.ct/commit/22dcc5f392d8a6904afc95967032f6c6b568cc43
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_pol_redist.cc
    M xorp/rib/rt_tab_pol_redist.hh

  Log Message:
  -----------
  xorp: rib: Templatize PolicyRedistTable by introducing PolicyRedistClient

PolicyRedistClient is template class. It is used as wrapper for XrlPolicyRedist4V0p1Client
and XrlPolicyRedist6V0p1Client, for now, to call send_delete_route{4, 6} and send_add_route{4, 6}
uniformerly by calling functions send_delete_route and send_add_route.

By doing that we don't need to specialize add_redist and delete_redist functions.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: c17cb1d51c7f195039b55497fb7c9acd32d3454b
      https://github.com/greearb/xorp.ct/commit/c17cb1d51c7f195039b55497fb7c9acd32d3454b
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_extint.cc
    M xorp/rib/rt_tab_extint.hh

  Log Message:
  -----------
  xorp: rib: Fix memory leak in ExtIntTable

Add destructor that frees all entries from _ip_unresolved_table
and _ip_route_table.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 688a54af12c9f5a2e7a5c3087d341b02eb15dece
      https://github.com/greearb/xorp.ct/commit/688a54af12c9f5a2e7a5c3087d341b02eb15dece
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_register.cc
    M xorp/rib/rt_tab_register.hh

  Log Message:
  -----------
  xorp: rib: Fix memory leak in RegisterTable

Added destructor that frees all entries from _ipregistry.
Also in function register_route_range, route range obtained with
lookup_route_range is freed.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 861cc3b7821cd95cf31e58ebb57aadf5d262f5ea
      https://github.com/greearb/xorp.ct/commit/861cc3b7821cd95cf31e58ebb57aadf5d262f5ea
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_pol_redist.cc

  Log Message:
  -----------
  xorp: rib: Implemented PolicyRedistTable<A>::str()

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: c097f9bcc8b62300b6a85b15149ddd4b26932b69
      https://github.com/greearb/xorp.ct/commit/c097f9bcc8b62300b6a85b15149ddd4b26932b69
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rt_tab_pol_conn.cc

  Log Message:
  -----------
  xorp: rib: Implemented PolicyConnectedTable<A>::str()

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: b3b40367c6c8ac921f6a7ccf7d51ecb75c9ab520
      https://github.com/greearb/xorp.ct/commit/b3b40367c6c8ac921f6a7ccf7d51ecb75c9ab520
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib.cc
    M xorp/rib/rib.hh

  Log Message:
  -----------
  xorp: rib: Efficient handling of route tables

All route tables aren't stored any more in one large list. Instead,
each route table, that can have multiple instances in RIB,
has it's own map.
That's why we have MergedTable map, RedistTable map and
OriginTable map.
To provide faster lookup of OriginTables OriginTable map is
splited in two maps - IGP OriginTable map and EGP OriginTable map.

Each route table map has it's own apropriate function for
searching RoutTable entry. OriginTable map has three lookup
functions. One global search function, and one for IGP and EGP maps.
Tables are added in appropriate via overloaded add_route function.

Because we can have only one instance of RegisterTable,
PolicyRedistTable, PolicyConnectedTable and ExtIntTable, they
aren't stored in maps. They are saved as class members.

In code, find_table is replaced with apropriate
find_{origin, igp_origin, egp_origin, merged, redist} calls.
That way a lot of dynamic_cast is avoided!

print_rib() method is pretified, so it would print RoutTables
as they are stored now.

All rib tests passed.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: af6c6a08f15192a72deb5965a51bbc09577c0128
      https://github.com/greearb/xorp.ct/commit/af6c6a08f15192a72deb5965a51bbc09577c0128
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib.cc
    M xorp/rib/rib.hh

  Log Message:
  -----------
  xorp: rib: Split add_origin_table into smaller units

Added four new functions:
plumb_origin_table - checks existing tables and plumbs origin
table appropriately
plumb_ahead_of_first - plumbs origin table ahead of first
existing table in tree
plumb_ahead_of_merged - creates Merged table and plumbs origin
table ahead of merged table.
plumb_ahead_of_ext_int - creates ExtInt table and plumbs origin
table ahead of ExtInt table

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 4e28909afd43e4a91ec7b1c107953233f319d899
      https://github.com/greearb/xorp.ct/commit/4e28909afd43e4a91ec7b1c107953233f319d899
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib.cc
    M xorp/rib/rib.hh

  Log Message:
  -----------
  xorp: rib: Make add_route more efficient

When looking if the route is directly connected or not, we only need
to look in connected OriginTable. For that reason, save that table
in a pointer and perform lookup directly in that table.
If the route is not found in connected origin table, we don't need
to loop through all vifs, because vif addresses are dinamically
added/removed from the connected table. Also removed
find_vif(const A& addr) because it isn't used any more.
Connected routes are added directly to vif - no need to loop
through existing vifs!
Passed all tests.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: a889afecca6c87c03018a185d4d976b59660b789
      https://github.com/greearb/xorp.ct/commit/a889afecca6c87c03018a185d4d976b59660b789
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/rib.cc
    M xorp/rib/rt_tab_origin.cc
    M xorp/rib/rt_tab_origin.hh
    M xorp/rib/tests/test_deletion.cc
    M xorp/rib/tests/test_redist.cc

  Log Message:
  -----------
  xorp: rib: Make OriginTable::add_route() more efficient

Instead of passing the reference to route, we pass
route pointer
This way of passing is more efficient because we only have to call
one IPRouteEntryConstructor instead of two.
Pointer shouldn't be changed after it was passed to this function.

Passed all rib tests.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 93642a97a961de113217c7abe8b712587605ca76
      https://github.com/greearb/xorp.ct/commit/93642a97a961de113217c7abe8b712587605ca76
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/tests/test_register.cc

  Log Message:
  -----------
  xorp: rib: Fixed register test

Checking of verifytype in test_route_range was wrong.
If we got route check if we expected it.
If we got the Discard, or Unreachable, route, don't need to
check any more.
If we didn't go the route check if we expected the miss.

Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: 3cf0a20b6c238a6e4c46041eb4c8512a099be56c
      https://github.com/greearb/xorp.ct/commit/3cf0a20b6c238a6e4c46041eb4c8512a099be56c
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/etc/templates/policy.tp
    M xorp/policy/common/element.cc

  Log Message:
  -----------
  xorp: policy: Fix usage of network{4,6}-lists

Add '~' as string distguisher, instead of ' '.
Also add posible completions to policy template.

Reported-by: Jens Dackenberg <jens.devel at gmail.com>
Signed-off-by: Igor Maravic <igorm at etf.rs>


  Commit: a805f4d4e2503cdf5166b5db73822bf764bb1101
      https://github.com/greearb/xorp.ct/commit/a805f4d4e2503cdf5166b5db73822bf764bb1101
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/fea/data_plane/fibconfig/fibconfig_entry_set_netlink_socket.cc
    M xorp/rib/parser.hh
    M xorp/rib/parser_direct_cmds.hh

  Log Message:
  -----------
  trivial: ws fixes


  Commit: ca6b94e6b0b4ab861aa18a98e541fe1c4e9bc098
      https://github.com/greearb/xorp.ct/commit/ca6b94e6b0b4ab861aa18a98e541fe1c4e9bc098
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/rib/parser.hh
    M xorp/rib/parser_direct_cmds.hh
    M xorp/rib/parser_xrl_cmds.hh
    M xorp/rib/tests/commands
    M xorp/rib/tests/test_rib_direct.cc
    M xorp/rib/tests/test_rib_xrls.cc

  Log Message:
  -----------
  xorp: rib: Add commands for testing adding and deleting of interface routes


  Commit: 6caf1480ec15714f095d30dd1bdccd7000db2668
      https://github.com/greearb/xorp.ct/commit/6caf1480ec15714f095d30dd1bdccd7000db2668
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/fea/data_plane/fibconfig/fibconfig_entry_set_netlink_socket.cc

  Log Message:
  -----------
  xorp: fea: data_plane: fibconfig: Fix using of rtmsg scope parameter

When the route doesn't have the specified gateway or nexthop it's scope should be link(RT_SCOPE_LINK).
Otherwise it should be global(RT_SCOPE_UNIVERSE).

Referenced from iproute2.


  Commit: 35d66f2aa672686534b2c881770e200cc4e0d689
      https://github.com/greearb/xorp.ct/commit/35d66f2aa672686534b2c881770e200cc4e0d689
  Author: Igor Maravic <igorm at etf.rs>
  Date:   2012-06-20 (Wed, 20 Jun 2012)

  Changed paths:
    M xorp/fea/data_plane/fibconfig/fibconfig_entry_set_netlink_socket.cc

  Log Message:
  -----------
  xorp: fea: data_plane: fibconfig: Fix using of rtmsg scope parameter in delete_entry

When deleting route we should use RT_SCOPE_NOWHERE instead of RT_SCOPE_UNIVERSE.

Reported-by: Jiangxin Hu <jiangxin.hu at crc.gc.ca>


Compare: https://github.com/greearb/xorp.ct/compare/ca06dac68f92...35d66f2aa672


More information about the Xorp-hackers mailing list