Commit graph

184 commits

Author SHA1 Message Date
Jiří Klimeš
edb85e9720 core: fix NM_IS_*_CLASS(klass) macros
The argument is 'klass' not 'obj'.
2012-07-27 13:15:54 +02:00
Tore Anderson
eb460b70da dhcp: use /128 as prefix length for IPv6 IA_NA assignments (bgo #656610) (debian #661885)
DHCPv6 IA_NA assignments do not contain a prefix length, they are for a
single address (/128) only. However, the ISC DHCPv6 client incorrectly
assumes IA_NA assignments come with a implicit prefix length of /64, and
passes this incorrect information on to NetworkManager, which adds this
prefix as a on-link route. This will cause communication failures in
certain networks, for example NBMA networks, and in organisations using
longer prefix lengths than /64 for their LANs. For more discussion
regarding this problem, see RFC 5942 section 5.

This patch makes NM ignore the false prefix length attribute provided by
the ISC DHCPv6 client, instead setting it to a /128 (single address) in
all cases. Note that this does not preclude an on-link prefix from being
added by NM if it is being advertised in the correct way, i.e., by
including a Prefix Information Option with the L flag set in an ICMPv6
Router Advertisement.

For what it's worth I've also sent a patch to ISC to change the hard-
coded implicit prefix length value from /64 to /128 in [ISC-Bugs #29468].
2012-05-31 15:47:55 -05:00
Dan Williams
228224a072 dhcp: don't leak dhclient config file contents when merging
If there was an existing dhclient config file, don't leak it when
merging to the new configuration.

Found by Mathieu Trudel-Lapierre <mathieu@canonical.com>
2012-05-23 12:58:05 -05:00
Jiří Klimeš
78dda3b093 core: unblock signals for child processes we spawn out of NM (rh #739836)
Commit 217c5bf6ac fixed processing of unix
signals: signals are blocked in all threads and a dedicated thread handles the
signals using sigwait().
However, the commit forgot that child processes inherit signal mask as well.
That is why we have to unblock signals for child processes we spawn from NM, so
that they can receive signals.
2012-05-21 15:00:51 +02:00
Dan Williams
a531f0d4ea dhcp: allow some same-state transitions (rh #801744)
The DHCP code usually ignores dhclient state transitions to the
same state it's currently in.  This turns out to be wrong, since
dhclient will use the same reason code (which NM uses for the
state value) for operations like RENEW and REBIND.  i.e. you'll
see states like this:

BOUND
RENEW (first renew)
RENEW (second renew)
RENEW (third renew)
etc

Therefore to ensure we trigger dispatcher scripts and internal
housekeeping code for renewals we need to make sure we process
these events even though they use the same state as the previous
event.
2012-05-15 22:54:42 -05:00
Dan Williams
a843431236 Revert "dhcp: allow some same-state transitions (rh #810744)"
This reverts commit a5dfb5a482.

Screwed up the bug #.  Dyslexia?  Maybe...
2012-05-15 22:54:14 -05:00
Dan Williams
a5dfb5a482 dhcp: allow some same-state transitions (rh #810744)
The DHCP code usually ignores dhclient state transitions to the
same state it's currently in.  This turns out to be wrong, since
dhclient will use the same reason code (which NM uses for the
state value) for operations like RENEW and REBIND.  i.e. you'll
see states like this:

BOUND
RENEW (first renew)
RENEW (second renew)
RENEW (third renew)
etc

Therefore to ensure we trigger dispatcher scripts and internal
housekeeping code for renewals we need to make sure we process
these events even though they use the same state as the previous
event.
2012-05-15 22:50:36 -05:00
Dan Winship
54ef8f3224 Fix names of error enum values
When NM was registering all of its enum types by hand, it was using
NamesLikeThis rather than the default names-like-this for the "nick"
values. When we switched to using glib-mkenums, this resulted in
dbus-glib using different strings for the D-Bus error names, causing
compatibility problems.

Fix this by using glib-mkenums annotations to manually fix all the
enum values back to what they were before. (This can't be done in a
more automated way, because the old names aren't 100% consistent. Eg,
"UNKNOWN" frequently becomes "UnknownError" rather than just
"Unknown".)
2012-03-12 15:29:52 -04:00
Jiří Klimeš
74d962e8c4 trivial: spacing fix 2012-03-05 13:19:47 +01:00
Colin Walters
74ec56d956 build: fix srcdir != builddir for new generated headers 2012-02-22 16:27:28 -06:00
Dan Winship
839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Colin Walters
dab7dfaf35 build: fix srcdir != builddir
nm-version.h is in ${top_builddir}/include.
2012-01-09 14:20:36 -06:00
David Rothlisberger
acadb7da8b dhclient: pass DBUS_SYSTEM_BUS_ADDRESS environment variable
So that dhclient will, in turn, pass it to the action script
(the action script tries to send a DBus signal to NetworkManager
over the system bus).

Dhclient "execve"s the action script with a hand-constructed environment
that only includes specific variables, plus whatever is passed to
dhclient with "-e".

As far as I know, dhcpcd has no option equivalent to dhclient's "-e".
2011-11-09 11:17:04 -06:00
Thomas Bechtold
184d01c27f trivial: set correct log domain in dhcp client
just set the correct log domain
2011-11-01 16:00:36 -05:00
Jiří Klimeš
29a4c359d2 dhcp: fix key for dhcp options without "new_" prefix
There are none at present, but still tmp_key has to be key, not value.
2011-10-20 18:09:42 +02:00
Jiří Klimeš
5737573314 dhclient: only send hostname without domain as host-name option (rh #694758) 2011-05-13 11:44:22 +02:00
Dan Williams
90b478e905 trivial: fix format type of DHCP client logging messages 2011-03-21 16:17:49 -05:00
Dan Williams
d815cb9f33 logging: fix format string/argument disagreement
Now that the logging fixes make format checking actually work, fix
the issues it brings up.
2011-03-19 12:44:14 -05:00
Kjartan Maraas
c2b4b9c1d7 build: fix return types (bgo #644665)
Some functions were returning FALSE or 0 instead of NULL.
2011-03-14 01:05:51 -05:00
Kjartan Maraas
6d0d302916 build: do the right thing with config.h (bgo #644664)
1) it shouldn't be included in headers
2) it should be the first thing included in source files
3) it's needed for getting translation right
2011-03-14 01:01:22 -05:00
Dan Williams
eae0e8de61 dhcp: don't quit if we can't find a usable DHCP client (bgo #643575) 2011-03-02 23:33:43 -06:00
Dan Williams
9917da2c71 dhcp: add DHCP lease release capability 2011-01-05 16:23:00 -06:00
Dan Williams
71adbcbb20 Revert "wimax: if the device is connected at startup, force it to disconnect"
This reverts commit 9c99066d6c.

Yay for finger-memory of git commit -a...
2011-01-05 15:38:03 -06:00
Dan Williams
9c99066d6c wimax: if the device is connected at startup, force it to disconnect
Otherwise it doesn't auto-scan and we get no network list.  As a later
optimization, we could detect this, call iwmx_sdk_get_connected_network()
to get the current NSP, match that up with a connection, and "assume"
the connection like we do for Ethernet devices.
2011-01-05 15:30:59 -06:00
Dan Williams
08ba12929d dhclient: add testcase for multiline 'also require' statements 2010-12-19 12:10:57 -06:00
Dan Williams
e079f25a2b dhclient: explicitly request WPAD option (bgo #368423) 2010-12-17 23:09:20 -06:00
Dan Williams
297e3c6463 dhclient: split out dhclient config merging and add testcases 2010-12-17 23:09:20 -06:00
Mikhail Efremov
92b58e56f5 dhcp: ensure that dhcp client is exited
On restart ensure that the client we're trying to kill has
actually exited even if it's not our child.
2010-11-19 16:52:55 -06:00
Dan Williams
3992c7db50 dhcpcd: prevent dhcpcd from messing with routing (bgo #634983)
Since NM is already handling that.
2010-11-18 16:30:00 -06:00
Dan Williams
8b006f331d dhcp: add support for Fedora dhclient RFC3442 routes (rh #639935)
Add support for Fedora's dhclient's built-in RFC3442 classless static
routes format.

Since the Fedora format uses the same name as the dhcpcd format, we
need to refactor a bunch of the code to ensure we can distinguish
between the types.  Do this at runtime now by consolidating the
classless static routes parsing code into the DHCP Client base class
and rework the unit tests so that we can test all variations of the
classless static route parsing code at the same time.

This also fixes a bug with the dhcpcd classless static route
gateway handling that would return the wrong gateway address.

Many thanks to Jiri Popelka from Red Hat for the initial patch
and explanations.
2010-10-21 13:34:40 -05:00
Dan Williams
be97e7f104 build: include <config.h> for kill(2), isblank(3), and isascii(3)
config.h defines _GNU_SOURCE, which in turn defines the bits necessary
for kill, isblank, and isascii.  So wherever we use those, we need
to make sure config.h is included.
2010-10-08 22:46:55 -05:00
Martin Pitt
61e86600d5 dhcp: fix uninitialized variable usage with dhcp3 2010-10-06 17:12:10 -05:00
Dan Williams
b80f31e191 trivial: typo fixes
Sent by a Debian user to Michael Biebl.  No other attribution
information available.  Thanks Debian user!
2010-09-25 00:34:10 -05:00
Dan Williams
9b2b809aae core: rename NMNamedManager -> NMDnsManager 2010-09-07 22:08:18 -05:00
Mathieu Trudel-Lapierre
d39fda7722 dhcp: don't fail with dhclient v3 2010-08-12 17:52:20 -05:00
Dan Williams
c050e036c3 dhcp: make sure disabled DHCP clients aren't used (gentoo #330319)
If the client was disabled with --with-dhclient=no or
--with-dhcpcd=no, then it's corresponding _PATH will be an empty
string.  In that case we want to ignore that client completely
since it was disabled at build time.
2010-08-05 15:29:23 -05:00
Dan Williams
e780145a8f dhcp4: handle NIS servers and domains 2010-07-16 11:28:39 -07:00
Michael Biebl
c8c161780a dhcp: use ISC DHCPv4 paths now that v4 is nominally required 2010-07-09 11:33:27 -07:00
Dan Williams
26312c087e core: simplify DHCP hostname handling
Reduce memory usage by not duplicating the IP4 setting.
2010-06-28 17:17:24 -07:00
Dan Williams
3d4b6163b9 dhcp: try /etc/dhcp too for !SUSE && !DEBIAN && !GENTOO (rh #607759) 2010-06-28 11:18:12 -07:00
Dan Williams
28d2c5592b dhcp: ensure getting DHCP IP config fails if the client died early
If the client never delivered any options to NM, make sure we don't
return a valid IP config object to callers when they request one.
2010-05-02 00:24:50 -07:00
Dan Williams
c34cc017ba dhcp: handle client early exit correctly
When the client	exits it may take a short amount of time for the
dhclient hook script to	deliver	the options to NetworkManager; so
we need	to keep	the client object around a bit (so we know what
NMDHCPClient the options getting delivered are for).  If we don't,
the DHCPManager will dispose of	the DHCPClient object and then
when the options come in, it can't match up the	PID from the
options with the PID of	an existing NMDHCPClient.  So put the
clients	on a removal timer that	keeps them around for a	bit before
we let the manager dispose of them.

Since we're keeping the	PID around too instead of zeroing it when
the client exits (for the reason above), track whether the client
is really dead yet so we don't indiscriminately	kill a random
process	that happens to re-use the PID.
2010-05-02 00:24:40 -07:00
Dan Williams
39c2797848 dhcp: don't reset pid on client exit
Clients in IPv6 info-only mode may exit after getting a response
from the server, since there are no leases involved in info-only
mode.  To ensure that the client's options are received when the
event comes in (which could be after we get the child watch
callback for the exit) we still need the client's PID.
2010-05-01 10:12:25 -07:00
Dan Williams
07de58bbeb dhcp: clean up client spawn return value 2010-05-01 09:53:49 -07:00
Dan Williams
8398ccba59 dhcp: simplify option iteration
Also removes the failure return when the lease isn't bound,
because nothing was respecting the return value anyway.
2010-05-01 09:48:31 -07:00
Dan Williams
41f3a67092 dhcp: fix client end state when it exits normally 2010-05-01 09:27:32 -07:00
Dan Williams
d1be3793a1 dhcp6: info-only requests don't require addresses
They aren't actual leases so an info-only request doesn't return
an address.
2010-05-01 08:10:49 -07:00
Dan Williams
e3de3b65ef logging: print DHCP client pid in warnings 2010-05-01 08:09:12 -07:00
Dan Williams
9830c60d11 dhcp: fix superclass type of dhcpcd plugin
From Mikhail Efremov <sem@altlinux.org>
2010-04-29 11:31:43 -07:00
Dan Williams
eaa750dda9 dhcp: add missing DHCPv6 client states 2010-04-23 15:30:46 -07:00