Re: [PATCH 1/1] platform: extract common fields of IPv4/IPv6 addresses and routes to base struct

2014-04-04 Thread Thomas Haller
On Fri, 2014-04-04 at 16:24 -0500, Dan Williams wrote:
> On Fri, 2014-04-04 at 23:02 +0200, Thomas Haller wrote:
> > On Fri, 2014-04-04 at 15:13 -0500, Dan Williams wrote:
> > > On Thu, 2014-04-03 at 14:23 +0200, Thomas Haller wrote:
> > > > Especially the calculation of timestamps is identicall for addresses.
> > > > By creating a "base struct", we can use the same code for that, because
> > > > NMPlatformIP4Address and NMPlatformIP6Address can now both be treated as
> > > > NMPlatformIPAddress (and the same for routes).
> > > 
> > > Is the only reason for the #define of the common fields so that you
> > > don't have to do another level of indirection?  It looks somewhat ugly
> > > and my personal preference would be to just declare the base struct in
> > > the functions you want to use it in and up-cast if you need the v4 or v6
> > > version...  kinda like we do with objects.  So I certainly agree with
> > > the principle, but lets see what other people say about the
> > > implementation...
> > 
> > 
> > Hi Dan,
> > 
> > could you elaborate an what would be your preference? I don't
> > understand.
> 
> Sorry :)  I mean that I'm not wild about the #define of the common
> fields,  but I'm OK with it if others think its fine.  Typically it be
> something more like this:
> 
> typedef struct {
>NMPlatformIPAddress p;
>
> } NMPlatformIP4Address;
> 
> typedef struct {
>NMPlatformIPAddress p;
>
> } NMPlatformIP6Address;
> 
> void option1 (NMPlatformIP4Address *addr)
> {
> NMPlatformIPAddress *parent = (NMPlatformIP4Address *) addr;
> addr->address = xxx;
> }
> 
> void option2 (NMPlatformIP4Address *addr)
> {
> addr->p.address = xxx;
> }
> 
> which is more in line with kernel/glibc style I think.  It does mean a
> bit more typing though.
> 
> Dan
> 


I see, but the disadvantage is, that I would have to fixup *many*
occurrences in existing code. Also, it is more typing.

This way is also how libnl3 does it with the NLHDR_COMMON define (just
to compete with your glib role model :) )


Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH 1/1] platform: extract common fields of IPv4/IPv6 addresses and routes to base struct

2014-04-04 Thread Dan Williams
On Fri, 2014-04-04 at 23:02 +0200, Thomas Haller wrote:
> On Fri, 2014-04-04 at 15:13 -0500, Dan Williams wrote:
> > On Thu, 2014-04-03 at 14:23 +0200, Thomas Haller wrote:
> > > Especially the calculation of timestamps is identicall for addresses.
> > > By creating a "base struct", we can use the same code for that, because
> > > NMPlatformIP4Address and NMPlatformIP6Address can now both be treated as
> > > NMPlatformIPAddress (and the same for routes).
> > 
> > Is the only reason for the #define of the common fields so that you
> > don't have to do another level of indirection?  It looks somewhat ugly
> > and my personal preference would be to just declare the base struct in
> > the functions you want to use it in and up-cast if you need the v4 or v6
> > version...  kinda like we do with objects.  So I certainly agree with
> > the principle, but lets see what other people say about the
> > implementation...
> 
> 
> Hi Dan,
> 
> could you elaborate an what would be your preference? I don't
> understand.

Sorry :)  I mean that I'm not wild about the #define of the common
fields,  but I'm OK with it if others think its fine.  Typically it be
something more like this:

typedef struct {
   NMPlatformIPAddress p;
   
} NMPlatformIP4Address;

typedef struct {
   NMPlatformIPAddress p;
   
} NMPlatformIP6Address;

void option1 (NMPlatformIP4Address *addr)
{
NMPlatformIPAddress *parent = (NMPlatformIP4Address *) addr;
addr->address = xxx;
}

void option2 (NMPlatformIP4Address *addr)
{
addr->p.address = xxx;
}

which is more in line with kernel/glibc style I think.  It does mean a
bit more typing though.

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


[applet PATCH] wwan: make sure MM1 object signals are disconnected (rh #1083727)

2014-04-04 Thread Dan Williams
Otherwise if something else holds a reference to info->mm_modem, we
could end up triggering signal handlers after we've disposed of
'info'.
---
 src/applet-device-broadband.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 6790993..4e9f205 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -948,16 +948,18 @@ broadband_device_info_free (BroadbandDeviceInfo *info)
 
g_free (info->operator_name);
if (info->mpd)
g_object_unref (info->mpd);
 
if (info->mm_sim)
g_object_unref (info->mm_sim);
-   if (info->mm_modem)
+   if (info->mm_modem) {
+   g_signal_handlers_disconnect_matched (info->mm_modem, 
G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, info);
g_object_unref (info->mm_modem);
+   }
if (info->mm_object)
g_object_unref (info->mm_object);
 
if (info->dialog)
unlock_dialog_destroy (info);
g_object_unref (info->cancellable);
 
-- 
1.9.0


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] core: log when removing devices

2014-04-04 Thread Thomas Haller
On Fri, 2014-04-04 at 15:09 -0500, Dan Williams wrote:
> Nothing logs when and why devices get removed, if they never
> change from the UNMANAGED state.
> 
> ---
>  src/nm-manager.c | 23 +--
>  1 file changed, 17 insertions(+), 6 deletions(-)



I like this patch


Acked-by: Thomas Haller 


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH 1/1] platform: extract common fields of IPv4/IPv6 addresses and routes to base struct

2014-04-04 Thread Thomas Haller
On Fri, 2014-04-04 at 15:13 -0500, Dan Williams wrote:
> On Thu, 2014-04-03 at 14:23 +0200, Thomas Haller wrote:
> > Especially the calculation of timestamps is identicall for addresses.
> > By creating a "base struct", we can use the same code for that, because
> > NMPlatformIP4Address and NMPlatformIP6Address can now both be treated as
> > NMPlatformIPAddress (and the same for routes).
> 
> Is the only reason for the #define of the common fields so that you
> don't have to do another level of indirection?  It looks somewhat ugly
> and my personal preference would be to just declare the base struct in
> the functions you want to use it in and up-cast if you need the v4 or v6
> version...  kinda like we do with objects.  So I certainly agree with
> the principle, but lets see what other people say about the
> implementation...


Hi Dan,

could you elaborate an what would be your preference? I don't
understand.

Thomas


signature.asc
Description: This is a digitally signed message part
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH 1/1] platform: extract common fields of IPv4/IPv6 addresses and routes to base struct

2014-04-04 Thread Dan Williams
On Thu, 2014-04-03 at 14:23 +0200, Thomas Haller wrote:
> Especially the calculation of timestamps is identicall for addresses.
> By creating a "base struct", we can use the same code for that, because
> NMPlatformIP4Address and NMPlatformIP6Address can now both be treated as
> NMPlatformIPAddress (and the same for routes).

Is the only reason for the #define of the common fields so that you
don't have to do another level of indirection?  It looks somewhat ugly
and my personal preference would be to just declare the base struct in
the functions you want to use it in and up-cast if you need the v4 or v6
version...  kinda like we do with objects.  So I certainly agree with
the principle, but lets see what other people say about the
implementation...

Dan

> Signed-off-by: Thomas Haller 
> ---
>  I think introducing this "base class" could help us to put similar
>  code for IPv4 and IPv6 types into a function. Especially handling of
>  the timestamps/expiration.
> 
>  src/platform/nm-platform.h | 50 
> +-
>  1 file changed, 32 insertions(+), 18 deletions(-)
> 
> diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
> index 356af1f..dd56977 100644
> --- a/src/platform/nm-platform.h
> +++ b/src/platform/nm-platform.h
> @@ -143,19 +143,32 @@ typedef enum {
>   NM_PLATFORM_SOURCE_USER,
>  } NMPlatformSource;
>  
> +#define __NMPlatformIPAddress_COMMON \
> + int ifindex; \
> + NMPlatformSource source; \
> + guint32 timestamp;  /* nm_utils_get_monotonic_timestamp_s() */ \
> + guint32 lifetime;   /* seconds */ \
> + guint32 preferred;  /* seconds */ \
> + ;
> +
> +/**
> + * NMPlatformIPAddress:
> + *
> + * Common parts of NMPlatformIP4Address and NMPlatformIP6Address.
> + **/
> +typedef struct {
> + __NMPlatformIPAddress_COMMON
> +} NMPlatformIPAddress;
> +
>  /**
>   * NMPlatformIP4Address:
>   * @timestamp: timestamp as returned by nm_utils_get_monotonic_timestamp_s()
>   **/
>  typedef struct {
> - int ifindex;
> - NMPlatformSource source;
> + __NMPlatformIPAddress_COMMON
>   in_addr_t address;
>   in_addr_t peer_address;  /* PTP peer address */
>   int plen;
> - guint32 timestamp;
> - guint32 lifetime;   /* seconds */
> - guint32 preferred;  /* seconds */
>   char label[IFNAMSIZ];
>  } NMPlatformIP4Address;
>  
> @@ -164,37 +177,38 @@ typedef struct {
>   * @timestamp: timestamp as returned by nm_utils_get_monotonic_timestamp_s()
>   **/
>  typedef struct {
> - int ifindex;
> - NMPlatformSource source;
> + __NMPlatformIPAddress_COMMON
>   struct in6_addr address;
>   struct in6_addr peer_address;
>   int plen;
> - guint32 timestamp;  /* seconds */
> - guint32 lifetime;   /* seconds */
> - guint32 preferred;
>   guint flags; /* ifa_flags from , field type "unsigned 
> int" is as used in rtnl_addr_get_flags. */
>  } NMPlatformIP6Address;
>  
>  #define NM_PLATFORM_ROUTE_METRIC_DEFAULT 1024
>  
> +#define __NMPlatformIPRoute_COMMON \
> + int ifindex; \
> + NMPlatformSource source; \
> + guint metric; \
> + guint mss; \
> + ;
> +
>  typedef struct {
> - int ifindex;
> - NMPlatformSource source;
> + __NMPlatformIPRoute_COMMON
> +} NMPlatformIPRoute;
> +
> +typedef struct {
> + __NMPlatformIPRoute_COMMON
>   in_addr_t network;
>   int plen;
>   in_addr_t gateway;
> - guint metric;
> - guint mss;
>  } NMPlatformIP4Route;
>  
>  typedef struct {
> - int ifindex;
> - NMPlatformSource source;
> + __NMPlatformIPRoute_COMMON
>   struct in6_addr network;
>   int plen;
>   struct in6_addr gateway;
> - guint metric;
> - guint mss;
>  } NMPlatformIP6Route;
>  
>  typedef struct {


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH] core: log when removing devices

2014-04-04 Thread Dan Williams
Nothing logs when and why devices get removed, if they never
change from the UNMANAGED state.

---
 src/nm-manager.c | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/nm-manager.c b/src/nm-manager.c
index 9d08b89..255113c 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -127,15 +127,18 @@ static void impl_manager_get_logging (NMManager *manager,
 
 static void impl_manager_check_connectivity (NMManager *manager,
  DBusGMethodInvocation *context);
 
 #include "nm-manager-glue.h"
 
 static void add_device (NMManager *self, NMDevice *device, gboolean 
generate_con);
-static void remove_device (NMManager *self, NMDevice *device, gboolean 
quitting);
+static void remove_device (NMManager *self,
+   NMDevice *device,
+   gboolean quitting,
+   const char *reason);
 
 static void hostname_provider_init (NMHostnameProvider *provider_class);
 
 static NMActiveConnection *_new_active_connection (NMManager *self,
NMConnection *connection,
const char *specific_object,
NMDevice *device,
@@ -737,18 +740,26 @@ device_has_pending_action_changed (NMDevice *device,
GParamSpec *pspec,
NMManager *self)
 {
check_if_startup_complete (self);
 }
 
 static void
-remove_device (NMManager *manager, NMDevice *device, gboolean quitting)
+remove_device (NMManager *manager,
+   NMDevice *device,
+   gboolean quitting,
+   const char *reason)
 {
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
 
+   nm_log_info (LOGD_DEVICE,
+"(%s): removing device (%s)",
+nm_device_get_iface (device),
+reason);
+
if (nm_device_get_managed (device)) {
/* Leave configured interfaces up when quitting so they can be
 * taken over again if NM starts up, and to ensure connectivity 
while
 * NM is gone.  Assumed connections don't get taken down even 
if they
 * haven't been fully activated.
 */
 
@@ -774,15 +785,15 @@ remove_device (NMManager *manager, NMDevice *device, 
gboolean quitting)
if (priv->startup)
check_if_startup_complete (manager);
 }
 
 static void
 device_removed_cb (NMDevice *device, gpointer user_data)
 {
-   remove_device (NM_MANAGER (user_data), device, FALSE);
+   remove_device (NM_MANAGER (user_data), device, FALSE, "device request");
 }
 
 static void
 aipd_handle_event (DBusGProxy *proxy,
const char *event,
const char *iface,
const char *address,
@@ -1772,15 +1783,15 @@ add_device (NMManager *self, NMDevice *device, gboolean 
generate_con)
 */
for (iter = priv->devices; iter; iter = iter->next) {
iface = nm_device_get_ip_iface (iter->data);
if (nm_device_owns_iface (device, iface))
remove = g_slist_prepend (remove, iter->data);
}
for (iter = remove; iter; iter = iter->next)
-   remove_device (self, NM_DEVICE (iter->data), FALSE);
+   remove_device (self, NM_DEVICE (iter->data), FALSE, "parent 
request");
g_slist_free (remove);
 
priv->devices = g_slist_append (priv->devices, g_object_ref (device));
 
g_signal_connect (device, "state-changed",
  G_CALLBACK (manager_device_state_changed),
  self);
@@ -2203,15 +2214,15 @@ platform_link_removed_cb (NMPlatform *platform,
   gpointer user_data)
 {
NMManager *self = NM_MANAGER (user_data);
NMDevice *device;
 
device = find_device_by_ifindex (self, ifindex);
if (device)
-   remove_device (self, device, FALSE);
+   remove_device (self, device, FALSE, "link removed");
 }
 
 static void
 rfkill_manager_rfkill_changed_cb (NMRfkillManager *rfkill_mgr,
   RfKillType rtype,
   RfKillState udev_state,
   gpointer user_data)
@@ -4969,15 +4980,15 @@ dispose (GObject *object)
g_slist_free_full (priv->auth_chains, (GDestroyNotify) 
nm_auth_chain_unref);
priv->auth_chains = NULL;
 
nm_auth_changed_func_unregister (authority_changed_cb, manager);
 
/* Remove all devices */
while (priv->devices)
-   remove_device (manager, NM_DEVICE (priv->devices->data), TRUE);
+   remove_device (manager, NM_DEVICE (priv->devices->data), TRUE, 
"quitting");
 
if (priv->ac_cleanup_id) {
g_source_r

Re: NetworkManager-0.8.1 and computerauthentication

2014-04-04 Thread Dan Winship
On 04/04/2014 10:23 AM, Omer Faruk SEN wrote:
> Hello Dan,
> 
> AFAIK this EAP identity package was sent by 802.1x supplicant so as far
> as I know it is Network Manager to do this so i think it is NM that
> sends user/pass or machine name as "host/machine.name "

Ah. I don't know all the details of all the various Windows-specific
protocols. At any rate, no, NetworkManager does not support this.

-- Dan

> On Fri, Apr 4, 2014 at 3:26 PM, Dan Winship  > wrote:
> 
> On 04/03/2014 10:00 AM, Omer Faruk SEN wrote:
> > Hello,
> >
> > I want to ask how can i use "Computer Authentication" on
> > NetworkManager-0.8.1. Is this a supported mode? If so where can i
> > configure it on the NM GUI?
> 
> I think that's something you'd do with samba (probably specifically the
> samba-winbind package), not NetworkManager.
> 
> -- Dan
> 
> 
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NetworkManager-0.8.1 and computerauthentication

2014-04-04 Thread Omer Faruk SEN
Hello Dan,

AFAIK this EAP identity package was sent by 802.1x supplicant so as far as
I know it is Network Manager to do this so i think it is NM that sends
user/pass or machine name as "host/machine.name"

Regards


On Fri, Apr 4, 2014 at 3:26 PM, Dan Winship  wrote:

> On 04/03/2014 10:00 AM, Omer Faruk SEN wrote:
> > Hello,
> >
> > I want to ask how can i use "Computer Authentication" on
> > NetworkManager-0.8.1. Is this a supported mode? If so where can i
> > configure it on the NM GUI?
>
> I think that's something you'd do with samba (probably specifically the
> samba-winbind package), not NetworkManager.
>
> -- Dan
>
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NetworkManager-0.8.1 and computerauthentication

2014-04-04 Thread Dan Winship
On 04/03/2014 10:00 AM, Omer Faruk SEN wrote:
> Hello,
> 
> I want to ask how can i use "Computer Authentication" on
> NetworkManager-0.8.1. Is this a supported mode? If so where can i
> configure it on the NM GUI?

I think that's something you'd do with samba (probably specifically the
samba-winbind package), not NetworkManager.

-- Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NetworkManager-0.8.1 and computerauthentication

2014-04-04 Thread Omer Faruk SEN
 Hello all,

I see that Ubuntu mistakenly do that.
http://ubuntuforums.org/showthread.php?t=2202941 Sending
"host/machine_name" mistakenly then I see that it is achieved
NetworkManager but i am trying to figure out how can i do that on rhel
since rhel NetworkManager on RHEL6 uses at
/etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifcfg-rh


which uses /etc/sysconfig/network-scripts/ifcfg-* script files.

Regards.


On Fri, Apr 4, 2014 at 5:53 AM, Michael Butash  wrote:

>  Not as far as I have been able to tell per how windoze handles it.  I
> asked this a while back, and short answer is no.
>
> Working in an enterprise wireless environment, of course windoze does this
> (only at boot/logout), macs do this too (somewhat poorly), but there is
> nothing analogous in linux directly.  I worked with setting up a
> system-level profile (using the "All users may connect to this network"
> setting under the profile) for machine certs gotten from M$ Ent CA that
> would be used by default, but honestly I couldn't get NM to work right with
> the certs and gave up before leaving the company.
>
> I found prior ubuntu 12.04 wouldn't for whatever reason invoke that
> profile without login, bumping it up to 13.10 fixed it, so ymmv here too.
> In theory, using a general "machine" or system profile should get the
> system online, and if doing role derivation ala Clearpass/ISE, should stick
> you in a suitable quarantine/restricted access to AD, and then once a user
> logs in, would then switch profiles to theirs specifically for full
> access.  I never got to see this fully work due to apparently certificate
> bugs with NM for eap-tls, but that's another discussion.
>
> I'd love to see this work, we had to do some hacks to get linux users on
> wireless, as part of our eap server policy was verifying the asset by
> machine auth, or an MDM in it's place.  Since linux really doesn't do or
> have either, we ended up fudging it in as an MDM-trusted asset for blind
> trust and staying with PEAP passwords, but in a 3500 user company with 10
> linux users, it was good enough.
>
> Using machine authentication is almost worse anyways, as no client handles
> the transition well when role determines vlan access at the controller at a
> L2 level, even windoze without specifically coa bouncing the association
> hard (dhcp needs a link down/up to readdress).  The whole business was
> messy honestly, and just taught me not to rely on machine auth.
>
> It's be great to see this work still, but maybe something a company like
> Likewise/Powerbroker or Centrify can handle to emulate gpo-ish machine auth
> function like that for enterprise desktop linux to transition back and
> forth from computer or user credentials, hopefully working better than
> either win or mac.
>
> -mb
>
>
>
> On 04/03/2014 07:00 AM, Omer Faruk SEN wrote:
>
>   Hello,
>
>  I want to ask how can i use "Computer Authentication" on
> NetworkManager-0.8.1. Is this a supported mode? If so where can i configure
> it on the NM GUI?
>
>  I am using RHEL 6.5 and I use NetworkManager-0.8.1-66.el6.x86_64
>
>  I want to state that RHEL 6.5 has joined to Microsoft AD environment. On
> Windows environment we have :
>
>
>
>  As far as I see this is not possible on NM on any version but wanted to
> check it.
>
>  Regards.
>
>
>
>
> ___
> networkmanager-list mailing 
> listnetworkmanager-list@gnome.orghttps://mail.gnome.org/mailman/listinfo/networkmanager-list
>
>
>
> ___
> networkmanager-list mailing list
> networkmanager-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/networkmanager-list
>
>
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list