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

[th/connectivity-per-af-fixes] #255

Closed
wants to merge 18 commits into from
Closed

Conversation

thom311
Copy link
Member

@thom311 thom311 commented Dec 1, 2018

No description provided.

@lkundrak lkundrak force-pushed the th/connectivity-per-af-fixes branch 5 times, most recently from 89d33a6 to a91a70b Compare December 2, 2018 21:44
@thom311 thom311 force-pushed the th/connectivity-per-af-fixes branch from a91a70b to aa1c5e8 Compare December 3, 2018 09:38
@lkundrak lkundrak force-pushed the th/connectivity-per-af-fixes branch 2 times, most recently from 67da30a to 76f4b2a Compare December 3, 2018 10:36
@thom311 thom311 force-pushed the th/connectivity-per-af-fixes branch 3 times, most recently from 642a9dd to 5344e88 Compare December 3, 2018 10:45
@thom311
Copy link
Member Author

thom311 commented Dec 3, 2018

two crashes here:

Fixed by d45eed4

@lkundrak lkundrak force-pushed the th/connectivity-per-af-fixes branch 2 times, most recently from 77bd11a to ddead7c Compare December 9, 2018 14:04
Since we determine the connectivity state of each device individually,
the global connectivity state is an aggregate of all these states.

I am not sure about considering here devices that don't have the (best)
default route for their respective address family. But anyway.

When we aggregate the best connectivity, we chose the numerical largest
value. That is wrong, because PORTAL is numerically smaller than
LIMITED.

That means, if you have two devices, one with connectivity LIMITED and
one with connectivity PORTAL, then LIMITED wrongly wins.

Fixes: 6b7e9f9

https://bugzilla.redhat.com/show_bug.cgi?id=1619873
The NMDBusManager owns a reference to the system bus. Expose it, so we
can use it. Note that g_bus_get() -- as alternative to get the systembus
singleton -- is asynchronous, and g_bus_get_sync() has an API that makes
one wonder what it does. Since we already have a reference to the connection
object we want to use, expose it.
It just makes sense, that our to-char function can also handle AF_UNSPEC.
Unclear which character to return in this case, but "IPvX" seems suitable.
While at it, replace "AF_INET" with "IPv". The connectivity check
logging line is already much too long. Save a few characters. Also,
I think the meaning of "AF_INET" is less clear (to a novice user) than
"IPv4".
In most cases, we don't want the translated string (only marked
for translation, and then programatically the caller deciedes
whether to translate or not).

The few places that always call gettext() can do it explicitly.

Now, that our functions are all "no_l10n" by default, rename them.
Each time when enabling/disabling "systemd-resolved" in combination with another
plugin (which is unchanged), another pair of signal handlers was
connected. That's wrong.

Fixes: d4eb4cb
…mes first

If the user disabled systemd-resolved, two things seem apparent:

 - the user does not want us to use systemd-resolved

 - NetworkManager is not pushing the DNS configuration to
   systemd-resoved.

It seems to me, we should not consult systemd-resolved in that case.
- use cleanup attribute except explicit free/unref.

- check that the result has the expected address family.
  Arguably, it should always, unless there is a bug in systemd-resolved.
  By that reasoning, we also wouldn't have to check the address length
  either.

- don't use strndup() for values that are later freed by g_free().
  We should always agree whether to malloc/free or g_malloc/g_free.

- don't use strcasecmp(). Always use the locale independent g_ascii_strcasecmp()
  instead.

- use nm_utils_inet_ntop() instead of inet_ntop(). It's our preferred
  wrapper, which as a stricter semantic (for example, it cannot fail
  and it's input arguments are stricter defined).

- use nm_clear_g_free() instead of g_clear_pointer().
During a config change notification, we determine a "changed" value,
to know whether things significantly changed.

Also, we want to log a warning about invalid configuration,
only when the config actually changed. Previously, when the URI was
invalid, on every reload (SIGHUP) we would log an error message,
even if the configuration did not change. There is no need to
warn multiple times about the same thing.

Keep track of the original URI in priv->uri. Whenever that changed,
we know the user reconfigured something. But also, now the URI might
be set to an invalid value. That means, we need to remember whether
the URI is valid.

Also, log a warning if we fail to parse the host and port. Already
before, such an URI was considered invalid and we would effectively
not to connectivity checking.
… check

The settings of NMConnectivity can change any time, by reloading the
configuration.

When reloading the configration, we don't want to interrupt or cancel
the pending reuqests, they should just complete with the old settings with
which they started. Note, that NMDevice is smart enough, that when a
newer request completes earlier, it invalidates all older, still pending
requests.

Anyway, that means, we cannot rely on the value to stay alive. Fix that,
by adding adding a new ref-counted struct for these parameters.

Fixes: 2cec94b
If the URI does not specify a port, we always assumed "80". That is
wrong for https. Arguably, https is discouraged for connectivity checking,
but we still shouldn't break it.

Fixes: 9664f28
When we agregate the connectivity state, only devices that
have the best default route should be considered.

Since we do connectivity checking per-device, the per-device check
does not care whether traffic to the internet is really routed via this
device.

But when talking about the global connectivity state, we care mostly
about the (best) default route. So, we should not allow a device with
worse or now default route, to contribute its connectivity state.

Fixes: 6b7e9f9
@thom311
Copy link
Member Author

thom311 commented Dec 11, 2018

merged to master.

@thom311 thom311 closed this Dec 11, 2018
@lkundrak lkundrak deleted the th/connectivity-per-af-fixes branch December 11, 2018 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants