Page MenuHomeFreeBSD

Split gigantic rtsock route_output() into a bunch of smaller functions.
ClosedPublic

Authored by melifaro on Dec 18 2019, 9:54 AM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 23 2024, 5:43 AM
Unknown Object (File)
Nov 15 2024, 1:51 AM
Unknown Object (File)
Nov 7 2024, 8:50 AM
Unknown Object (File)
Oct 31 2024, 7:11 AM
Unknown Object (File)
Sep 27 2024, 1:31 PM
Unknown Object (File)
Sep 24 2024, 11:40 PM
Unknown Object (File)
Sep 23 2024, 4:16 PM
Unknown Object (File)
Sep 23 2024, 4:47 AM
Subscribers

Details

Summary

Amount of changes to the original code has been intentionally minimised
to ease diffing.
The changes are mostly mechanical, with the following exceptions:

  • lltable handler is now called directly based of RTF_LLINFO flag presense.
  • "report" logic for updating rtm in RTM_GET/RTM_DELETE has been simplified, fixing several potential use-after-free cases in rt_addrinfo.
  • llable asserts has been replaced with error-returning, preventing kernel crashes when lltable gw af family is invalid (root required).
Test Plan

rtsock functionality tests: D22860.

Before:

10:02 [2] m@devel2 s kyua test -k /usr/obj/usr/home/melifaro/free/head/amd64.amd64/tests/sys/net/routing/Kyuafile
test_rtsock_l3:rtm_add_v4_gw_direct_success  ->  passed  [0.011s]
test_rtsock_l3:rtm_add_v6_gu_gw_gu_direct_success  ->  passed  [0.005s]
test_rtsock_l3:rtm_del_v4_prefix_nogw_success  ->  passed  [0.005s]
test_rtsock_l3:rtm_del_v6_gu_prefix_nogw_success  ->  failed: /usr/home/melifaro/free/head/tests/sys/net/routing/test_rtsock_l3.c:123: NETMASK sa diff: overall memcmp() reports diff for af 28 offset 2  [0.005s]
test_rtsock_l3:rtm_get_v4_empty_dst_failure  ->  passed  [0.002s]
test_rtsock_l3:rtm_get_v4_exact_success  ->  passed  [0.004s]
test_rtsock_l3:rtm_get_v4_hostbits_failure  ->  passed  [0.005s]
test_rtsock_l3:rtm_get_v4_lpm_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_add_v4_gu_lle_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_add_v6_gu_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_add_v6_ll_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_del_v4_gu_lle_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_del_v6_gu_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_del_v6_ll_lle_success  ->  passed  [0.003s]

After:

9:59 [0] m@devel0 s kyua test -k /usr/obj/usr/home/melifaro/free/head/amd64.amd64/tests/sys/net/routing/Kyuafile
test_rtsock_l3:rtm_add_v4_gw_direct_success  ->  passed  [0.013s]
test_rtsock_l3:rtm_add_v6_gu_gw_gu_direct_success  ->  passed  [0.007s]
test_rtsock_l3:rtm_del_v4_prefix_nogw_success  ->  passed  [0.005s]
test_rtsock_l3:rtm_del_v6_gu_prefix_nogw_success  ->  failed: /usr/home/melifaro/free/head/tests/sys/net/routing/test_rtsock_l3.c:123: NETMASK sa diff: overall memcmp() reports diff for af 28 offset 2  [0.005s]
test_rtsock_l3:rtm_get_v4_empty_dst_failure  ->  passed  [0.002s]
test_rtsock_l3:rtm_get_v4_exact_success  ->  passed  [0.005s]
test_rtsock_l3:rtm_get_v4_hostbits_failure  ->  passed  [0.005s]
test_rtsock_l3:rtm_get_v4_lpm_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_add_v4_gu_lle_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_add_v6_gu_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_add_v6_ll_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_del_v4_gu_lle_success  ->  passed  [0.005s]
test_rtsock_lladdr:rtm_del_v6_gu_lle_success  ->  passed  [0.003s]
test_rtsock_lladdr:rtm_del_v6_ll_lle_success  ->  passed  [0.003s]

(rtm_del_v6_gu_prefix_nogw_success is working, but complaining about not fully zeroing IPv6 netmask SA in the output, which needs to be fixed as a separate issue).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Add forgotten kern_jail to the diff.

melifaro added reviewers: network, ae, cem.
This revision was not accepted when it landed; it landed in state Needs Review.Dec 31 2019, 5:27 PM
This revision was automatically updated to reflect the committed changes.