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

Upstream fixes: prefixlen for routes, support subnet routes, fix inet_pton retval tests #57

Merged
merged 4 commits into from Feb 27, 2024

Conversation

LaakkonenJussi
Copy link
Contributor

This syncs inet.c a bit closer to upstream by applying:

  • Prefixlen for adding a route
  • Support for subnet routes in
  • Fix return value tests for inet_pton

* Don't add a routes for link-local or unspecified
* destination address coupled with unspecified gateway.
*/
if ((!host || is_addr_ll(AF_INET, (struct sockaddr *)&addr) || __connman_inet_is_any_addr(host, AF_INET))

Choose a reason for hiding this comment

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

There is curious inconsistency between this function and ipv6 version. The latter null checks 'host' right at the start vs this one does not -> these added lines null check 'host' after it has already been used (ipv4) or when it has already been established that it is not null (ipv6).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think that has passed upstream review without issues but indeed, that latter !host is unnecessary and could be removed. Not really sure if this particular commit is needed, though, since it had no effect on the issue at hand. And it is not part of any upstream release yet.

A part of testing routine that do these things affect the case at all. I think I'll drop this commit for later on, since the author of the commit experienced the issue only with virtual ethernet. That does not really apply to us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped that patch. Let it simmer in upstream still. Does not seem to be urgent for us now.

Jian Liang and others added 4 commits February 27, 2024 14:39
[inet] Add prefixlen to iproute_default_function. JB#61508

Add prefixlen parameter to this function in preparation for using
it also in creating subnet route later, e.g.

default via 192.168.100.1 dev eth0
192.168.100.0/24 dev eth0
[inet] Implement subnet route creation/deletion in iproute_default_modify. JB#61508

- Calculate subnet address base on gateway address and prefixlen
- Differentiate creation of routes to gateway and subnet
[connman] Test return value of inet_pton consistently. JB#61508

inet_pton return 1 on success and 0 or -1 on failure depending on the
error it wants to return. Use either '== 1' or '!= 1' consistently to
test if the call was succesfull. ConnMan doesn't destinguish between 0
and -1.
@LaakkonenJussi LaakkonenJussi changed the title [inet] Upstream fixes: support subnet routes, fix inet_pton retval tests. JB#61508 Upstream fixes: support subnet routes, fix inet_pton retval tests Feb 27, 2024
@LaakkonenJussi LaakkonenJussi changed the title Upstream fixes: support subnet routes, fix inet_pton retval tests Upstream fixes: prefixlen for routes, support subnet routes, fix inet_pton retval tests Feb 27, 2024
@LaakkonenJussi LaakkonenJussi merged commit 625ee19 into sailfishos:master Feb 27, 2024
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