Commit Graph

16 Commits

Author SHA1 Message Date
Olivier Crête
638993f5ac networkmonitornetlink: IN6_IS_ADDR_MC_LINKLOCAL is only guaranteed to work on struct in6_addr*
https://bugzilla.gnome.org/show_bug.cgi?id=727119
2014-03-31 12:48:04 -04:00
Dan Winship
243b264fca gnetworkmonitornetlink: filter out IPv6 LL MC changes
For some reason, IPv6 link-local multicast routing changes all the
time. GNetworkMonitorBase was already ignoring them for purposes of
emitting network-changed, but GNetworkMonitorNetlink would still
trigger a re-dump after getting one, so network-changed would end up
getting emitted anyway.
2014-02-01 13:16:28 +01:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Michael Forney
75bb906e5e Add missing string.h include
Required for memset()
2013-10-01 09:00:10 -04:00
Dan Winship
c08ef6c165 gnetworkmonitornetlink: handle default route via device
If the default route is via a device rather than a particular IP
address, then neither RTA_DST nor RTA_GATEWAY will be present in the
RTM_NEWROUTE message, and so GNetworkMonitorNetlink would ignore it,
and then think there was no default route. (This could happen with
certain kinds of VPNs, if they were set to route all traffic through
the VPN.)

Fix this by recognizing routes that specify RTA_OIF ("output
interface") instead of RTA_GATEWAY.

https://bugzilla.gnome.org/show_bug.cgi?id=701609
2013-07-12 11:59:50 -04:00
Emmanuele Bassi
54cc43630d Rename the generated private data getter function
As it turns out, we have examples of internal functions called
type_name_get_private() in the wild (especially among older libraries),
so we need to use a name for the per-instance private data getter
function that hopefully won't conflict with anything.
2013-06-24 15:43:04 +01:00
Emmanuele Bassi
32747def4b gio: Use the new private instance data declaration
Use the newly added macros, and remove the explicit calls to
g_type_class_add_private().

https://bugzilla.gnome.org/show_bug.cgi?id=700035
2013-06-24 14:18:01 +01:00
Colin Walters
f398bec5bc Add g_close(), use it
There are two benefits to this:

1) We can centralize any operating system specific knowledge of
   close-vs-EINTR handling.  For example, while on Linux we should never
   retry, if someone cared enough later about HP-UX, they could come by
   and change this one spot.
2) For places that do care about the return value and want to provide
   the caller with a GError, this function makes it convenient to do so.

Note that gspawn.c had an incorrect EINTR loop-retry around close().

https://bugzilla.gnome.org/show_bug.cgi?id=682819
2013-01-29 09:46:04 -05:00
Dan Winship
5932e16acd GNetworkMonitorNetlink: make the netlink socket cloexec
Use the same code GSocket does, to try SOCK_CLOEXEC first, and then
fall back to FD_CLOEXEC if it fails. (And fix that code to not call
fcntl if SOCK_CLOEXEC worked.)

https://bugzilla.gnome.org/show_bug.cgi?id=692332
2013-01-23 08:48:32 -05:00
Dan Winship
211ed1775d gsocket: add getsockopt/setsockopt wrappers
Add g_socket_get_option() and g_socket_set_option(), wrapping
getsockopt/setsockopt for the case of integer-valued options. Update
code to use these instead of the underlying calls.

https://bugzilla.gnome.org/show_bug.cgi?id=623187
2012-12-12 15:20:22 +01:00
Dan Winship
17e95c59c9 gnetworkmonitornetlink: don't leak the list of networks
https://bugzilla.gnome.org/show_bug.cgi?id=676265
2012-05-17 13:48:56 -04:00
Dan Winship
8f558d8010 gnetworkmonitornetlink.c: Fix a gsize->gssize
https://bugzilla.gnome.org/show_bug.cgi?id=666422
2011-12-19 15:20:08 -05:00
Christophe Fergeau
f3dde2d405 gnetworkmonitornetlink.c: Fix compilation on RHEL 6.2
When trying to compile glib master on a RHEL 6.2 system, it fails with:

make[4]: Entering directory `/home/teuf/gnome/src/glib/gio'
  CC     libgio_2_0_la-gnetworkmonitornetlink.lo
In file included from gnetworkmonitornetlink.c:25:
/usr/include/linux/netlink.h:35: error: expected specifier-qualifier-list before 'sa_family_t'
gnetworkmonitornetlink.c: In function 'g_network_monitor_netlink_initable_init':
gnetworkmonitornetlink.c:99: error: 'struct sockaddr_nl' has no member named 'nl_family'
gnetworkmonitornetlink.c💯 error: 'struct sockaddr_nl' has no member named 'nl_pid'
gnetworkmonitornetlink.c💯 error: 'struct sockaddr_nl' has no member named 'nl_pad'
gnetworkmonitornetlink.c:101: error: 'struct sockaddr_nl' has no member named 'nl_groups'
make[4]: *** [libgio_2_0_la-gnetworkmonitornetlink.lo] Error 1

sa_family_t is defined in sys/socket.h, this commit makes sure this header is included before netlink.h

This fixes bgo bug #666001
2011-12-13 16:40:34 +01:00
Matthias Clasen
2d6d127c96 Whitespace fixes
And add some missing since tags.
2011-12-10 21:46:39 -05:00
Dan Winship
1f33446e1f gnetworkmonitornetlink.c: Make the error messages less geeky
This makes several different errors have identical messages, but
they're pretty much "can't happen" situations anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=664406
2011-11-29 21:45:37 +01:00
Dan Winship
fe5ba0f291 add GNetworkMonitor, for... monitoring the network
Add GNetworkMonitor and its associated extension point, provide a base
implementation that always claims the network is available, and a
netlink-based implementation built on top of that that actually tracks
the network state.

https://bugzilla.gnome.org/show_bug.cgi?id=620932
2011-11-14 13:42:30 -05:00