Re: NMClient.IP4Config get_addresses() not always populated when signal 'notify::ip4-config' is fired

2015-03-18 Thread Dan Williams
On Sun, 2015-03-15 at 12:46 +0100, Sylvain Garaud wrote:
> Hello,
> 
> I am writing a small javascript for gnome to grab the ip addresses of my
> network interfaces using imports.gi.NMClient;
> Basically I get the devices and connect each device to the
> notify::ip4-config signal to be able to update the ip address value when it
> changes

Which version of NM are you using?

> this.client = NMC.Client.new();
> this.devices = this.client.get_devices();
> for each (let device in this.devices) {
> device.connect('notify::ip4-config',Lang.bind(this,this._update));
> }
> 
> It works fine for the wifi connection but there is a problem with the
> ethernet connection.
> After turning my ethernet connection up,  the signal 'notify::ip4-config'
> is fired, the device state is ACTIVATED, so I try to get the ip4 config.
> with ipcfg = device.get_ip4_config();
> I get a not null ipcfg object, unfortunately ipcfg.get_addresses() is not
> defined yet.

So that we can narrow the issue down, could you run:

dbus-monitor --system "type='signal',sender='org.freedesktop.NetworkManager'"

and reproduce the problem?  This will let us know the sequence of D-BUs
events that come directly from NetworkManager, so that we can see the
raw data that libnm/libnm-glib is getting.

Dan

> I see in my journalctl log few seconds later, some dhcp network manager
> message.
> 
>  _update: function(device) {
>   let ipcfg = device.get_ip4_config();
>   if (ipcfg != null) {
>  for each(let addr in ipcfg.get_addresses()){
> let num = addr.get_address();
>  }
>   }
>},
> 
> How to be sure ipcfg.get_addresses() will return something ?
> Could someone tell me which signal to use for being sure the ip address is
> set when calling ipcfg.get_addresses()? I tried using the
> 'notify::dhcp4-config' signal instead 'notify::ip4-config' without much
> success.
> 
> Thank you very much for your help,
> 
> Sylvain
> ___
> 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


[PATCH 1/1] examples: bash: print errors int stderr

2015-03-18 Thread Petr Vorel
+ whitespace

Signed-off-by: Petr Vorel 
---
 examples/shell/active-wifi.sh   | 2 +-
 examples/shell/disconnect-device.sh | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/shell/active-wifi.sh b/examples/shell/active-wifi.sh
index 1c9466b..2ff5419 100755
--- a/examples/shell/active-wifi.sh
+++ b/examples/shell/active-wifi.sh
@@ -76,7 +76,7 @@ show_active_ssids()
 BSSID=`get_property $ACTIVE_AP $ACCESS_POINT_IFACE "HwAddress"`
 echo "Device '$INTERFACE' is connected to '$SSID' (BSSID=$BSSID)"
   else
-echo "No active AP on device '$INTERFACE'"
+echo "No active AP on device '$INTERFACE'" >&2
   fi
 fi
   done
diff --git a/examples/shell/disconnect-device.sh 
b/examples/shell/disconnect-device.sh
index 045d64d..e8af42f 100755
--- a/examples/shell/disconnect-device.sh
+++ b/examples/shell/disconnect-device.sh
@@ -61,7 +61,7 @@ disconnect_device ()
 fi
   done
 
-  echo "Device with interface '$1' not found."
+  echo "Device with interface '$1' not found." >&2
   return 1
 }
 
@@ -70,7 +70,7 @@ disconnect_device ()
 if [ ! -n "$1" ]; then
   echo "Usage: `basename $0` "
   exit 2
-fi 
+fi
 
 # disconnect device
 disconnect_device $1
-- 
2.1.4

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


Re: [PATCH 1/1] examples: bash: print errors int stderr

2015-03-18 Thread Dan Williams
On Wed, 2015-03-18 at 20:37 +0100, Petr Vorel wrote:
> + whitespace
> 
> Signed-off-by: Petr Vorel 

Thanks!  Pushed to git master and nm-1-0.

Dan

> ---
>  examples/shell/active-wifi.sh   | 2 +-
>  examples/shell/disconnect-device.sh | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/examples/shell/active-wifi.sh b/examples/shell/active-wifi.sh
> index 1c9466b..2ff5419 100755
> --- a/examples/shell/active-wifi.sh
> +++ b/examples/shell/active-wifi.sh
> @@ -76,7 +76,7 @@ show_active_ssids()
>  BSSID=`get_property $ACTIVE_AP $ACCESS_POINT_IFACE "HwAddress"`
>  echo "Device '$INTERFACE' is connected to '$SSID' (BSSID=$BSSID)"
>else
> -echo "No active AP on device '$INTERFACE'"
> +echo "No active AP on device '$INTERFACE'" >&2
>fi
>  fi
>done
> diff --git a/examples/shell/disconnect-device.sh 
> b/examples/shell/disconnect-device.sh
> index 045d64d..e8af42f 100755
> --- a/examples/shell/disconnect-device.sh
> +++ b/examples/shell/disconnect-device.sh
> @@ -61,7 +61,7 @@ disconnect_device ()
>  fi
>done
>  
> -  echo "Device with interface '$1' not found."
> +  echo "Device with interface '$1' not found." >&2
>return 1
>  }
>  
> @@ -70,7 +70,7 @@ disconnect_device ()
>  if [ ! -n "$1" ]; then
>echo "Usage: `basename $0` "
>exit 2
> -fi 
> +fi
>  
>  # disconnect device
>  disconnect_device $1


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