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

Added TTL option for tunnels (LP: #1846783) #139

Closed
wants to merge 0 commits into from

Conversation

kev1989
Copy link
Contributor

@kev1989 kev1989 commented May 22, 2020

Description

Some protocols set the TTL field of the packet to 1; when passing through the tunnel, the packet is discarded. To solve the problem, the tunnel has the TTL option, but it was not in netplan.

Checklist

@codecov-commenter
Copy link

codecov-commenter commented May 22, 2020

Codecov Report

Merging #139 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #139   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           39        39           
  Lines         5453      5453           
=========================================
  Hits          5453      5453           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f77dee...4ae4e17. Read the comment docs.

@slyon
Copy link
Collaborator

slyon commented Jun 22, 2020

Hey, thank you for your contribution.
To better understand the problem, could you please specify the protocol, where you can observe this behavior?

Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution. I've added some inline comments for smaller issues with the code. Could you please have a look at them?

Also, the test suite seems to be failing, as not all test have been adopted to the new TTL setting. Could you please check the 21 failures and adopt those test cases accordingly? It should be just adding the TTL=64/ttl=64 values for networkd/NetworkManager to the correct places. So that we can run make check successfully.

Failing tests: https://paste.ubuntu.com/p/ffByVxcC3b/

doc/netplan.md Outdated
@@ -967,6 +967,10 @@ more general information about tunnels.

: Defines the address of the remote endpoint of the tunnel.

``ttl`` (scalar)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please append – since **0.100** to this line, so we can document that this setting will be introduced with the current development version (0.100)

src/parse.h Outdated
@@ -329,6 +329,7 @@ struct net_definition {
char *remote_ip;
char *input_key;
char *output_key;
guint ttl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the indentation to be in line with the other variables of this struct (8 spaces).

src/validation.c Outdated
@@ -72,6 +72,11 @@ validate_tunnel_grammar(NetplanNetDefinition* nd, yaml_node_t* node, GError** er
if (!nd->tunnel.remote_ip)
return yaml_error(node, error, "%s: missing 'remote' property for tunnel", nd->id);

if (nd->tunnel.ttl) {
if ((nd->tunnel.ttl) < 1 || (nd->tunnel.ttl) > 255)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can combine the two ifs.. if (nd->tunnel.ttl) is true it will be > 0 (as this is a uint variable), which makes the check for nd->tunnel.ttl < 1 useles.

So we could just combine it as: if (nd->tunnel.ttl && nd->tunnel.ttl > 255)

@wolfy1339
Copy link

This would close https://bugs.launchpad.net/netplan/+bug/1846783

@slyon slyon changed the title Added TTL option for tunnels Added TTL option for tunnels (LP: #1846783) Feb 24, 2021
@slyon slyon closed this Feb 24, 2021
@slyon
Copy link
Collaborator

slyon commented Feb 24, 2021

According to https://bugs.launchpad.net/netplan/+bug/1846783 this is required for IPIP/SIT/GRE tunnels.
I addressed my concerns mentioned above.

@slyon
Copy link
Collaborator

slyon commented Feb 24, 2021

I accidentaly closed this PR, I cannot re-open as I do not have access to @kev1989 's master branch. So I've setup a new PR containing the changes, incl. my fixes: #194

@slyon
Copy link
Collaborator

slyon commented Feb 24, 2021

This PR was now merged. Thank you very much for your contribution @kev1989 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants