Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightway-core: Ignore wire::Frame::Data{Frag} until State::Online #126

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

xv-ian-c
Copy link
Contributor

Description

Data packets (whether fragmented or not) received from outside should not be forwarded out of the inside path until the connection is Online or after it has begun the disconnect process.

We already correctly do this for data received on the inside path, in Connection::inside_data_received.

Motivation and Context

Traffic should only flow across an Online connection.

How Has This Been Tested?

e2e tests continue to pass.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • The correct base branch is being used, if not main

Data packets (whether fragmented or not) received from outside should not be
forwarded out of the inside path until the connection is `Online` or after it
has begun the disconnect process.

We already correctly do this for data received on the inside path, in
`Connection::inside_data_received`.
Copy link

Code coverage summary for a9dcf11:

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
lightway-app-utils/src/args/cipher.rs                              7                 7     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
lightway-app-utils/src/args/connection_type.rs                     7                 7     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
lightway-app-utils/src/args/duration.rs                           10                10     0.00%           7                 7     0.00%          15                15     0.00%           0                 0         -
lightway-app-utils/src/args/ip_map.rs                             11                11     0.00%           3                 3     0.00%          15                15     0.00%           0                 0         -
lightway-app-utils/src/args/logging.rs                            20                20     0.00%           4                 4     0.00%          18                18     0.00%           0                 0         -
lightway-app-utils/src/connection_ticker.rs                       44                 4    90.91%          17                 2    88.24%         156                 5    96.79%           0                 0         -
lightway-app-utils/src/dplpmtud_timer.rs                          70                 7    90.00%          22                 4    81.82%         282                11    96.10%           0                 0         -
lightway-app-utils/src/event_stream.rs                             6                 0   100.00%           3                 0   100.00%          13                 0   100.00%           0                 0         -
lightway-app-utils/src/iouring.rs                                162               141    12.96%          25                16    36.00%         316               288     8.86%           0                 0         -
lightway-app-utils/src/metrics.rs                                 18                18     0.00%          18                18     0.00%          36                36     0.00%           0                 0         -
lightway-app-utils/src/sockopt/ip_mtu_discover.rs                 23                23     0.00%           4                 4     0.00%          93                93     0.00%           0                 0         -
lightway-app-utils/src/sockopt/ip_pktinfo.rs                       4                 4     0.00%           1                 1     0.00%          16                16     0.00%           0                 0         -
lightway-app-utils/src/tun.rs                                     82                82     0.00%          22                22     0.00%          84                84     0.00%           0                 0         -
lightway-app-utils/src/utils.rs                                   13                13     0.00%           1                 1     0.00%          11                11     0.00%           0                 0         -
lightway-client/src/args.rs                                       34                34     0.00%          28                28     0.00%          35                35     0.00%           0                 0         -
lightway-client/src/io/inside/tun.rs                              42                42     0.00%           7                 7     0.00%          47                47     0.00%           0                 0         -
lightway-client/src/io/outside/tcp.rs                             50                50     0.00%          10                10     0.00%          45                45     0.00%           0                 0         -
lightway-client/src/io/outside/udp.rs                             63                63     0.00%          12                12     0.00%          61                61     0.00%           0                 0         -
lightway-client/src/keepalive.rs                                 277                49    82.31%          56                 8    85.71%         372                26    93.01%           0                 0         -
lightway-client/src/lib.rs                                       188               188     0.00%          20                20     0.00%         273               273     0.00%           0                 0         -
lightway-client/src/main.rs                                       49                49     0.00%           7                 7     0.00%         162               162     0.00%           0                 0         -
lightway-core/src/borrowed_bytesmut.rs                            87                 1    98.85%          24                 0   100.00%         196                 1    99.49%           0                 0         -
lightway-core/src/builder_predicates.rs                           20                10    50.00%           4                 2    50.00%          32                16    50.00%           0                 0         -
lightway-core/src/cipher.rs                                       10                 0   100.00%           4                 0   100.00%          14                 0   100.00%           0                 0         -
lightway-core/src/connection.rs                                  490               239    51.22%          48                19    60.42%         668               283    57.63%           0                 0         -
lightway-core/src/connection/builders.rs                          63                23    63.49%          18                 7    61.11%         223                54    75.78%           0                 0         -
lightway-core/src/connection/dplpmtud.rs                         767                90    88.27%          69                 1    98.55%         950                11    98.84%           0                 0         -
lightway-core/src/connection/fragment_map.rs                     139                11    92.09%          29                 0   100.00%         292                 7    97.60%           0                 0         -
lightway-core/src/connection/io_adapter.rs                       149                17    88.59%          42                 5    88.10%         319                23    92.79%           0                 0         -
lightway-core/src/connection/key_update.rs                        23                 7    69.57%           5                 0   100.00%          38                19    50.00%           0                 0         -
lightway-core/src/context.rs                                      93                25    73.12%          26                 7    73.08%         199                40    79.90%           0                 0         -
lightway-core/src/context/ip_pool.rs                               7                 3    57.14%           1                 0   100.00%           6                 0   100.00%           0                 0         -
lightway-core/src/context/server_auth.rs                          14                11    21.43%           4                 3    25.00%          24                20    16.67%           0                 0         -
lightway-core/src/io.rs                                            3                 3     0.00%           3                 3     0.00%          10                10     0.00%           0                 0         -
lightway-core/src/lib.rs                                           9                 6    33.33%           4                 1    75.00%          18                 9    50.00%           0                 0         -
lightway-core/src/metrics.rs                                       9                 9     0.00%           7                 7     0.00%          17                17     0.00%           0                 0         -
lightway-core/src/packet.rs                                       27                 7    74.07%           4                 1    75.00%          30                 6    80.00%           0                 0         -
lightway-core/src/plugin.rs                                       70                 8    88.57%          25                 5    80.00%         162                 9    94.44%           0                 0         -
lightway-core/src/utils.rs                                       111                19    82.88%          26                 0   100.00%         184                11    94.02%           0                 0         -
lightway-core/src/version.rs                                      49                 0   100.00%          24                 0   100.00%          94                 0   100.00%           0                 0         -
lightway-core/src/wire.rs                                        154                19    87.66%          39                 0   100.00%         263                 2    99.24%           0                 0         -
lightway-core/src/wire/auth_failure.rs                             9                 1    88.89%           3                 0   100.00%          19                 0   100.00%           0                 0         -
lightway-core/src/wire/auth_request.rs                           152                12    92.11%          37                 0   100.00%         290                 0   100.00%           0                 0         -
lightway-core/src/wire/auth_success_with_config_ipv4.rs           69                 4    94.20%          13                 0   100.00%         145                 0   100.00%           0                 0         -
lightway-core/src/wire/data.rs                                    21                 1    95.24%           7                 0   100.00%          43                 0   100.00%           0                 0         -
lightway-core/src/wire/data_frag.rs                               47                 1    97.87%          19                 0   100.00%          94                 0   100.00%           0                 0         -
lightway-core/src/wire/ping.rs                                    24                 3    87.50%           8                 0   100.00%          69                 0   100.00%           0                 0         -
lightway-core/src/wire/pong.rs                                    15                 2    86.67%           5                 0   100.00%          34                 0   100.00%           0                 0         -
lightway-core/src/wire/server_config.rs                           20                 2    90.00%           5                 0   100.00%          44                 0   100.00%           0                 0         -
lightway-server/src/args.rs                                       29                29     0.00%          27                27     0.00%          27                27     0.00%           0                 0         -
lightway-server/src/auth.rs                                      109                36    66.97%          21                 5    76.19%         150                28    81.33%           0                 0         -
lightway-server/src/connection.rs                                 50                50     0.00%          23                23     0.00%         107               107     0.00%           0                 0         -
lightway-server/src/connection_manager.rs                        105               105     0.00%          34                34     0.00%         217               217     0.00%           0                 0         -
lightway-server/src/connection_manager/connection_map.rs          90                 8    91.11%          27                 2    92.59%         274                 8    97.08%           0                 0         -
lightway-server/src/io/inside/tun.rs                              28                28     0.00%           8                 8     0.00%          33                33     0.00%           0                 0         -
lightway-server/src/io/outside/tcp.rs                             78                78     0.00%          10                10     0.00%          85                85     0.00%           0                 0         -
lightway-server/src/io/outside/udp.rs                            136               136     0.00%          18                18     0.00%         247               247     0.00%           0                 0         -
lightway-server/src/io/outside/udp/cmsg.rs                        47                16    65.96%          14                 5    64.29%         233                56    75.97%           0                 0         -
lightway-server/src/ip_manager.rs                                 82                25    69.51%          19                 4    78.95%         254                28    88.98%           0                 0         -
lightway-server/src/ip_manager/ip_pool.rs                        101                 1    99.01%          32                 0   100.00%         305                 0   100.00%           0                 0         -
lightway-server/src/lib.rs                                        94                94     0.00%          11                11     0.00%         143               143     0.00%           0                 0         -
lightway-server/src/main.rs                                       67                67     0.00%           9                 9     0.00%         169               169     0.00%           0                 0         -
lightway-server/src/metrics.rs                                    84                82     2.38%          75                73     2.67%         193               189     2.07%           0                 0         -
lightway-server/src/statistics.rs                                 56                24    57.14%           9                 4    55.56%         104                42    59.62%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                           4987              2135    57.19%        1111               472    57.52%        9080              3170    65.09%           0                 0         -

✅ Region coverage 57% passes
✅ Line coverage 65% passes

@xv-ian-c xv-ian-c marked this pull request as ready for review November 13, 2024 14:42
@xv-ian-c xv-ian-c requested a review from a team as a code owner November 13, 2024 14:42
@xv-ian-c xv-ian-c merged commit 649b581 into main Nov 14, 2024
11 checks passed
@xv-ian-c xv-ian-c deleted the CVPN-1585-no-data-frames-before-online branch November 14, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants