[PATCH] 6to4: No need to initialize variable unnecessarily

2015-09-07 Thread Saurav Babu
docs/coding-style.txt M7: Don't initialize variable unnecessarily
socket function will always return a valid file descriptor for the new
socket or -1 on failure, so no need to explicitly initalize fd with -1.
---
 src/6to4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/6to4.c b/src/6to4.c
index 0e3a7a1..71a2882 100644
--- a/src/6to4.c
+++ b/src/6to4.c
@@ -63,7 +63,7 @@ static int tunnel_create(struct in_addr *addr)
 {
struct ip_tunnel_parm p;
struct ifreq ifr;
-   int fd = -1;
+   int fd;
int ret;
 
/* ip tunnel add tun6to4 mode sit remote any local 1.2.3.4 ttl 64 */
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v2] agent-connman: Type check dbus messages for dbus_message_iter_get_basic

2015-09-07 Thread Patrik Flykt
On Fri, 2015-09-04 at 10:34 +0200, Marcus Folkesson wrote:
> dbus library calls abort() if it got a non-expected type passed to it.
> ---
> Changelog:
> v2: Check against specific type instead of all basic types
> 
>  src/agent-connman.c | 63 
> ++---
>  1 file changed, 60 insertions(+), 3 deletions(-)
> 
> diff --git a/src/agent-connman.c b/src/agent-connman.c
> index 2d714b5..9b67db6 100644
> --- a/src/agent-connman.c
> +++ b/src/agent-connman.c
> @@ -110,7 +110,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;
> +
>   dbus_message_iter_recurse(, );
> + if (dbus_message_iter_get_arg_type( != 
> DBUS_TYPE_STRING) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
> + break;
> + }
> +

An ')' is missing here:

  CC   src/src_connmand-agent-connman.o
src/agent-connman.c: In function ‘request_input_passphrase_reply’:
src/agent-connman.c:115:46: error: comparison between pointer and integer 
[-Werror]
if (dbus_message_iter_get_arg_type( != DBUS_TYPE_STRING) {
  ^

Cheers,

Patrik


>   dbus_message_iter_get_basic(, );
>  
>   } else if (g_str_equal(key, "Passphrase")) {
> @@ -118,7 +125,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;
> +
>   dbus_message_iter_recurse(, );
> + if (dbus_message_iter_get_arg_type( != 
> DBUS_TYPE_STRING) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
> + break;
> + }
> +
>   dbus_message_iter_get_basic(, );
>  
>   } else if (g_str_equal(key, "WPS")) {
> @@ -128,7 +142,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;
> +
>   dbus_message_iter_recurse(, );
> + if (dbus_message_iter_get_arg_type( != 
> DBUS_TYPE_STRING) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
> + break;
> + }
> +
>   dbus_message_iter_get_basic(, );
>   break;
>   } else if (g_str_equal(key, "Name")) {
> @@ -136,7 +157,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;
> +
>   dbus_message_iter_recurse(, );
> + if (dbus_message_iter_get_arg_type( != 
> DBUS_TYPE_STRING) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
> + break;
> + }
> +
>   dbus_message_iter_get_basic(, );
>   name_len = strlen(name);
>   } else if (g_str_equal(key, "SSID")) {
> @@ -144,16 +172,25 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>  
>   dbus_message_iter_next();
>   if (dbus_message_iter_get_arg_type()
> - != DBUS_TYPE_VARIANT)
> + != DBUS_TYPE_VARIANT) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
>   break;
> + }
>   dbus_message_iter_recurse(, );
>   if (dbus_message_iter_get_arg_type()
> - != DBUS_TYPE_ARRAY)
> + != DBUS_TYPE_ARRAY) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
>

Re: problem after suspend/resume using connman and switch

2015-09-07 Thread laurent vaudoit
Hi Patrick,
 thank you for your answer


> Hi,
>
> On Thu, 2015-09-03 at 11:52 +0200, laurent vaudoit wrote:
> > Hi all,
> > we are working on a board integrating a switch with 2 port.
> > We use DSA kernel framework.
> >
> > On the distribution, we use systemd and connman (version 1.29)
> > kernel is a 3.10.17.
> >
> > when the board boot, we have 3 interfaces appearing with ifconfig,
> > the 3 has the same MAC ADRESS
>
> If the three interface have the same MAC address, ConnMan will get
> confused latest when saving settings for these networks. If the idea is
> that ConnMan sees three different ethernet networks here, they better
> have different MAC addresses also.
>
> > eth0, lan1, lan2.
> >
> > lan1 and lan2 automatically get IP through dhcp.
> > Everything works well until we go to suspend.
> >
> > When we resume, ifconfig only show eth0.
> > lan1 and lan2 are not displayed, and we have to manually set lan1/lan2
> up.
> >
> > Is there any reason for this behaviour?
>
> Interfaces are handled entirely by the Linux kernel. ConnMan enumerates
> them via rtnetlink messages. At suspend a dellink rtnetlink is received
> which removes the interface from ConnMan and at resume a newlink rtnl
> message is received, which re-creates the interface in ConnMan. Regular
> ethernet interfaces will be connected as soon as a network cable is
> connected and carrier detected on the interface.
>
> Start by checking the flags of the interface with 'ip link show' or
> 'ifocnfig' before and after suspend/resume. Most likely lan1 and lan2
> exist, but aren't automatically set UP and RUNNING on a resume. Are lan1
> and lan2 interfaces that needed some action to be created in the first
> place by the switch? Which/what actions?
>

I've made some more debug, and now, i'm able to have lan1/lan2 up after
suspend/resume procedure.
I just have one more problem.
After resume, lan1 is shown as UP (checked by ip link show), but have no IP
adress.
After boot, lan1 get an IP through DHCP.
after suspend/resume, i do not get an IP (if i launch udhcpc command, ip is
get and everything works).

I'm trying to analyse the log of the command connmand -d -n, but i'm a
little lost
If you have some advice, i would appreciate.


>
> Cheers,
>
> Patrik
>
> Regards
Laurent

> ___
> connman mailing list
> connman@connman.net
> https://lists.connman.net/mailman/listinfo/connman
>
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] 6to4: No need to initialize variable unnecessarily

2015-09-07 Thread Patrik Flykt
On Mon, 2015-09-07 at 12:33 +0530, Saurav Babu wrote:
> docs/coding-style.txt M7: Don't initialize variable unnecessarily
> socket function will always return a valid file descriptor for the new
> socket or -1 on failure, so no need to explicitly initalize fd with -1.

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] inet: Remove unnecessary variable

2015-09-07 Thread Patrik Flykt
On Wed, 2015-09-02 at 17:52 +0530, Saurav Babu wrote:
> ---
>  src/inet.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks!

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: problem after suspend/resume using connman and switch

2015-09-07 Thread Patrik Flykt

Hi,

On Thu, 2015-09-03 at 11:52 +0200, laurent vaudoit wrote:
> Hi all,
> we are working on a board integrating a switch with 2 port.
> We use DSA kernel framework.
> 
> On the distribution, we use systemd and connman (version 1.29)
> kernel is a 3.10.17.
> 
> when the board boot, we have 3 interfaces appearing with ifconfig,
> the 3 has the same MAC ADRESS

If the three interface have the same MAC address, ConnMan will get
confused latest when saving settings for these networks. If the idea is
that ConnMan sees three different ethernet networks here, they better
have different MAC addresses also.

> eth0, lan1, lan2.
> 
> lan1 and lan2 automatically get IP through dhcp.
> Everything works well until we go to suspend.
> 
> When we resume, ifconfig only show eth0.
> lan1 and lan2 are not displayed, and we have to manually set lan1/lan2 up.
> 
> Is there any reason for this behaviour?

Interfaces are handled entirely by the Linux kernel. ConnMan enumerates
them via rtnetlink messages. At suspend a dellink rtnetlink is received
which removes the interface from ConnMan and at resume a newlink rtnl
message is received, which re-creates the interface in ConnMan. Regular
ethernet interfaces will be connected as soon as a network cable is
connected and carrier detected on the interface.

Start by checking the flags of the interface with 'ip link show' or
'ifocnfig' before and after suspend/resume. Most likely lan1 and lan2
exist, but aren't automatically set UP and RUNNING on a resume. Are lan1
and lan2 interfaces that needed some action to be created in the first
place by the switch? Which/what actions?

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] gsupplicant: move supplicant debug after NULL check

2015-09-07 Thread Patrik Flykt

Hi,

On Thu, 2015-09-03 at 18:41 +0530, Harish Jenny K N wrote:
> Moved the supplicant debug in bss_property after NULL
> check for const char *key variable.
> 
> ---
>  gsupplicant/supplicant.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c
> index 98ca94b..5d3be8b 100644
> --- a/gsupplicant/supplicant.c
> +++ b/gsupplicant/supplicant.c
> @@ -1738,11 +1738,11 @@ static void bss_property(const char *key, 
> DBusMessageIter *iter,
>   if (!bss->interface)
>   return;
>  
> - SUPPLICANT_DBG("key %s", key);
> -
>   if (!key)
>   return;
>  
> + SUPPLICANT_DBG("key %s", key);
> +
>   if (g_strcmp0(key, "BSSID") == 0) {
>   DBusMessageIter array;
>   unsigned char *addr;

This merely prints out "key (null)" without further side effects. It's a
useful printout when there is something fishy going on.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH v3] agent-connman: Type check dbus messages for dbus_message_iter_get_basic

2015-09-07 Thread Marcus Folkesson
dbus library calls abort() if it got a non-expected type passed to it.
---
Changelog:
v3: Fix embarrassing typo
v2: Check against specific type instead of all basic types

 src/agent-connman.c | 63 ++---
 1 file changed, 60 insertions(+), 3 deletions(-)

diff --git a/src/agent-connman.c b/src/agent-connman.c
index 2d714b5..341e253 100644
--- a/src/agent-connman.c
+++ b/src/agent-connman.c
@@ -110,7 +110,14 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
if (dbus_message_iter_get_arg_type()
!= DBUS_TYPE_VARIANT)
break;
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
+   break;
+   }
+
dbus_message_iter_get_basic(, );
 
} else if (g_str_equal(key, "Passphrase")) {
@@ -118,7 +125,14 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
if (dbus_message_iter_get_arg_type()
!= DBUS_TYPE_VARIANT)
break;
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
+   break;
+   }
+
dbus_message_iter_get_basic(, );
 
} else if (g_str_equal(key, "WPS")) {
@@ -128,7 +142,14 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
if (dbus_message_iter_get_arg_type()
!= DBUS_TYPE_VARIANT)
break;
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
+   break;
+   }
+
dbus_message_iter_get_basic(, );
break;
} else if (g_str_equal(key, "Name")) {
@@ -136,7 +157,14 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
if (dbus_message_iter_get_arg_type()
!= DBUS_TYPE_VARIANT)
break;
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
+   break;
+   }
+
dbus_message_iter_get_basic(, );
name_len = strlen(name);
} else if (g_str_equal(key, "SSID")) {
@@ -144,16 +172,25 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
 
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   != DBUS_TYPE_VARIANT) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
break;
+   }
dbus_message_iter_recurse(, );
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_ARRAY)
+   != DBUS_TYPE_ARRAY) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
break;
+   }
dbus_message_iter_recurse(, _iter);
if (dbus_message_iter_get_arg_type(_iter)
-   != DBUS_TYPE_BYTE)
+   != DBUS_TYPE_BYTE) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   values_received = false;
 

Re: [PATCH] resolver: allow writing to /etc/resolv.conf to be disabled

2015-09-07 Thread Patrik Flykt

Hi,

On Fri, 2015-09-04 at 14:29 +, Sam Nazarko wrote:

> When OSMC uses an nfsroot, we ignore the primary interface (eth0), as
> the kernel is handling the network connection itself. Currently,
> without this patch, ConnMan will try and update /etc/resolv.conf, but
> may not have sufficient 'knowlege' to be able to accurately do so. We
> still want ConnMan to handle other technologies on the system, such as
> Bluetooth. Whether we used DHCP for DNS servers or configured it
> statically, it is obtainable from procfs. For DHCP we can
> use /proc/net/pnp and for static configuration we can populate
> via /proc/cmdline.

How is DNS handled when ConnMan uses Bluetooh, WiFi etc. other networks
than the primary eth0 ethernet? /proc/net/pnp and /proc/cmdline are only
relevant for the primary eth0 nfsroot interface.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH] resolver: allow writing to /etc/resolv.conf to be disabled

2015-09-07 Thread Sam Nazarko
Hi Patrik,

We do not need DNS on other interfaces when ConnMan is running on an nfsroot. 
We cannot tether as eth0 is ignored, so this is less of a concern for us. For 
now, DNS is not handled by ConnMan properly so we get a blank /etc/resolv.conf 
with 'Generated by Connection Manager' which will overwrite our 
/etc/resolv.conf which was previously populated from procfs. 

I have submitted an alternate patch which allows /etc/resolv.conf to be saved 
in another location

Sam

From: connman  on behalf of Patrik Flykt 

Sent: 07 September 2015 13:36
To: connman@connman.net
Subject: Re: [PATCH] resolver: allow writing to /etc/resolv.conf to be disabled

Hi,

On Fri, 2015-09-04 at 14:29 +, Sam Nazarko wrote:

> When OSMC uses an nfsroot, we ignore the primary interface (eth0), as
> the kernel is handling the network connection itself. Currently,
> without this patch, ConnMan will try and update /etc/resolv.conf, but
> may not have sufficient 'knowlege' to be able to accurately do so. We
> still want ConnMan to handle other technologies on the system, such as
> Bluetooth. Whether we used DHCP for DNS servers or configured it
> statically, it is obtainable from procfs. For DHCP we can
> use /proc/net/pnp and for static configuration we can populate
> via /proc/cmdline.

How is DNS handled when ConnMan uses Bluetooh, WiFi etc. other networks
than the primary eth0 ethernet? /proc/net/pnp and /proc/cmdline are only
relevant for the primary eth0 nfsroot interface.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: [PATCH v3] agent-connman: Type check dbus messages for dbus_message_iter_get_basic

2015-09-07 Thread Patrik Flykt

Hi,

On Mon, 2015-09-07 at 09:56 +0200, Marcus Folkesson wrote:
> dbus library calls abort() if it got a non-expected type passed to it.
> ---
> Changelog:
> v3: Fix embarrassing typo
> v2: Check against specific type instead of all basic types
> 
>  src/agent-connman.c | 63 
> ++---
>  1 file changed, 60 insertions(+), 3 deletions(-)
> 
> diff --git a/src/agent-connman.c b/src/agent-connman.c
> index 2d714b5..341e253 100644
> --- a/src/agent-connman.c
> +++ b/src/agent-connman.c
> @@ -110,7 +110,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;
> +
>   dbus_message_iter_recurse(, );
> + if (dbus_message_iter_get_arg_type() != 
> DBUS_TYPE_STRING) {
> + error = CONNMAN_ERROR_INTERFACE 
> ".InvalidArguments";
> + values_received = false;
> + break;
> + }
> +
>   dbus_message_iter_get_basic(, );

Down here the basic value we're extracting is from , which should
be the one tested for DBUS_TYPE_STRING. But the DBUS_TYPE_STRING test
was conducted on  above, which is always false as the  is a
DBUS_TYPE_VARIANT.

>  
>   } else if (g_str_equal(key, "Passphrase")) {
> @@ -118,7 +125,14 @@ static void request_input_passphrase_reply(DBusMessage 
> *reply, void *user_data)
>   if (dbus_message_iter_get_arg_type()
>   != DBUS_TYPE_VARIANT)
>   break;

The already existing error handling skips entries that are not variants,
so it should also have error set. Can you add this to the patch?

Looking at the code, values_received is not very useful either here or
in src/service.c request_input_cb(), so I was thinking it need not be
touched at all but rather removed in some upcoming future patch set.

A few lines below, wps = true should be set only if WPS information was
successfully received. Can you add this to the patch also?

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Re: problem after suspend/resume using connman and switch

2015-09-07 Thread laurent vaudoit
Hi,

On Mon, Sep 7, 2015 at 2:46 PM, Patrik Flykt 
wrote:

>
> Hi,
>
> On Mon, 2015-09-07 at 10:34 +0200, laurent vaudoit wrote:
>
> > I've made some more debug, and now, i'm able to have lan1/lan2 up after
> > suspend/resume procedure.
>
> Sharing the solution with us would help quite a lot. What did you do to
> have lan1 and lan2 up after resume?
>

In fact, before entering in suspend mode, our software was doing an
ifconfig lan1/2 down, and i was not aware of this.
So, behaviour was "normal".
If in our software, we suppress this step, interface are up after resume.

>
> > I just have one more problem.
> > After resume, lan1 is shown as UP (checked by ip link show), but have no
> IP
> > adress.
> > After boot, lan1 get an IP through DHCP.
> > after suspend/resume, i do not get an IP (if i launch udhcpc command, ip
> is
> > get and everything works).
>
> If you leave udhcpc installed and running as well, nothing will work
> reliably. For the above I assume you started udhcpc manually just to
> check that the connection works.
>

yes, udhcpc command is just used for checking that connection available.

>
> Please give more information on what you were seeing and which actions
> you took. Starting for example with the output of 'ip link show'. And
> also explain what other networking or switch software you have enabled
> and/or running.
>

after boot, ip link show give this:

ifconfig lan1
lan1  Link encap:Ethernet  HWaddr 00:10:02:5F:00:46
  inet addr:172.24.239.127  Bcast:172.24.255.255  Mask:255.255.0.0
  inet6 addr: fe80::210:2ff:fe5f:46/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:327 errors:0 dropped:108 overruns:0 frame:0
  TX packets:25 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:31029 (30.3 KiB)  TX bytes:3421 (3.3 KiB)

root@gad-pcm-mx6solo-dev:~# ip link show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN mode
DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: can0:  mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10
link/can
j1939 off
3: can1:  mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10
link/can
j1939 off
4: can2:  mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10
link/can
j1939 off
5: can3:  mtu 16 qdisc noop state DOWN mode DEFAULT qlen 10
link/can
j1939 off
6: eth0:  mtu 1500 qdisc
pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:10:02:5f:00:46 brd ff:ff:ff:ff:ff:ff
7: lan1@eth0:  mtu 1500 qdisc
noqueue state UP mode DEFAULT
link/ether 00:10:02:5f:00:46 brd ff:ff:ff:ff:ff:ff
8: lan2@eth0:  mtu 1500 qdisc
noqueue state UP mode DEFAULT
link/ether 00:10:02:5f:00:46 brd ff:ff:ff:ff:ff:ff

after ifconfig lan1 down /up (i have the same problem with this
manipulation as with suspend/resume)


ifconfig lan1 down
connmand[800]: lan1 {RX} 3656 packets 324125 bytes
connmand[800]: lan1 {TX} 25 packets 3421 bytes
connmand[800]: lan1 {update} flags 36866 
connmand[800]: lan1 {newlink} index 7 address 00:10:02:5F:00:46 mtu 1500
connmand[800]: lan1 {newlink} indehrtimer: interrupt took 13334 ns
x 7 operstate 2 
connmand[800]: Failed to connect to serveIPv6: ADDRCONF(NETDEV_UP): lan1:
link is not ready
r 172.22.200.200
connmand[800]: lan1 {del} route fe80:: gw :: scope 0 
connmand[800]: lan1 {del} route ff00:: gw :: scope 0 
connmand[800]: lan1 {del} address 172.24.239.127/16 label lan1
root@gad-pcm-mx6solo-dev:~# ifconfig lan1 downdsa dsa.26 lan1: link down

root@gad-pcm-mx6solo-dev:~#
root@gad-pcm-mx6solo-dev:~# ifconfig lan1 up
connmand[800]: lan1 {RX} 4235 packets 368693 bytes
connmand[800]IPv6: ADDRCONF(NETDEV_UP): lan1: link is not ready
: lan1 {TX} 25 packets 3421 bytes
connmand[800]: lan1 {update} flags 36867 
connmand[800]: lan1 {newlink} index 7 address 00:10:02:5F:00:46 mtu 1500
connmand[800]: lan1 {newlink} index 7 operstate 3 
root@gad-pcm-mx6solo-dev:~# dsa dsa.26 lan1: link up, 100 Mb/s, full duplex
IPv6: ADDRCONF(NETDEV_CHANGE): lan1: link becomes ready
connmand[800]: lan1 {add} route ff00:: gw :: scope 0 
connmand[800]: lan1 {add} route fe80:: gw :: scope 0 
connmand[800]: lan1 {RX} 4238 packets 368903 bytes
connmand[800]: lan1 {TX} 25 packets 3421 bytes
connmand[800]: lan1 {update} flags 102467 
connmand[800]: lan1 {newlink} index 7 address 00:10:02:5F:00:46 mtu 1500
connmand[800]: lan1 {newlink} index 7 operstate 6 

root@gad-pcm-mx6solo-dev:~#
root@gad-pcm-mx6solo-dev:~# ifconfig lan1
lan1  Link encap:Ethernet  HWaddr 00:10:02:5F:00:46
  inet6 addr: fe80::210:2ff:fe5f:46/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:4434 errors:0 dropped:1236 overruns:0 frame:0
  TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
   

Re: [PATCH] resolver: allow writing to /etc/resolv.conf to be disabled

2015-09-07 Thread Patrik Flykt

Hi,

On Mon, 2015-09-07 at 12:40 +, Sam Nazarko wrote:

> We do not need DNS on other interfaces when ConnMan is running on an
> nfsroot. We cannot tether as eth0 is ignored, so this is less of a
> concern for us.

If you use ConnMan with either patch of yours applied, using the DNS
servers for the primary nfsroot interface will always work properly,
even for any other Bluetooth or WiFi network, right? Or you use ConnMan
only for tethering Bluetooth and WiFi? 

> For now, DNS is not handled by ConnMan properly so we get a
> blank /etc/resolv.conf with 'Generated by Connection Manager' which
> will overwrite our /etc/resolv.conf which was previously populated
> from procfs.

You are running connman with the --nodnsproxy option with no networks
connected when the resolv.conf file contains only the "# Generated by
Connection Manager" line. If you connect a network using ConnMan, it
will overwrite the nameserver information in /etc/resolv.conf with the
information obtained from DHCP for the newly connected network... This
without either of your patch applied, of course.

So your use of ConnMan is either or both:
- tethering of other interfaces
- connecting other interfaces but using the primary nfsroot interface
  nameservers

Is this what is happening?

> I have submitted an alternate patch which allows /etc/resolv.conf to
> be saved in another location

Yes, I saw them, thanks for both variants. After I have figured out what
OSMC is up to, there is perhaps an optimal way of making this work well
for both OSMC and the rest of the "road warrior" setups.

Cheers,

Patrik

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH v4] agent-connman: Type check dbus messages for dbus_message_iter_get_basic

2015-09-07 Thread Marcus Folkesson
dbus library calls abort() if it got a non-expected type passed to it.
---
Changelog:
v4: - Do not touch values_received
- Set wps=true only if WPS info is successfully received
- Set error on all failing type-checks
v3: Fix embarrassing typo
v2: Check against specific type instead of all basic types

 src/agent-connman.c | 92 +
 1 file changed, 79 insertions(+), 13 deletions(-)

diff --git a/src/agent-connman.c b/src/agent-connman.c
index 2d714b5..fca7cc1 100644
--- a/src/agent-connman.c
+++ b/src/agent-connman.c
@@ -100,43 +100,77 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
DBusMessageIter entry, value;
 
dbus_message_iter_recurse(, );
-   if (dbus_message_iter_get_arg_type() != DBUS_TYPE_STRING)
+   if (dbus_message_iter_get_arg_type() != DBUS_TYPE_STRING) 
{
+   error = CONNMAN_ERROR_INTERFACE ".InvalidArguments";
break;
+   }
 
dbus_message_iter_get_basic(, );
 
if (g_str_equal(key, "Identity")) {
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   != DBUS_TYPE_VARIANT) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
break;
+   }
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   break;
+   }
+
dbus_message_iter_get_basic(, );
 
} else if (g_str_equal(key, "Passphrase")) {
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   != DBUS_TYPE_VARIANT) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
break;
+   }
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   break;
+   }
+
dbus_message_iter_get_basic(, );
 
} else if (g_str_equal(key, "WPS")) {
-   wps = true;
 
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   != DBUS_TYPE_VARIANT) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
break;
+   }
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   break;
+   }
+
+   wps = true;
dbus_message_iter_get_basic(, );
break;
} else if (g_str_equal(key, "Name")) {
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   != DBUS_TYPE_VARIANT) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
break;
+   }
+
dbus_message_iter_recurse(, );
+   if (dbus_message_iter_get_arg_type() != 
DBUS_TYPE_STRING) {
+   error = CONNMAN_ERROR_INTERFACE 
".InvalidArguments";
+   break;
+   }
+
dbus_message_iter_get_basic(, );
name_len = strlen(name);
} else if (g_str_equal(key, "SSID")) {
@@ -144,16 +178,22 @@ static void request_input_passphrase_reply(DBusMessage 
*reply, void *user_data)
 
dbus_message_iter_next();
if (dbus_message_iter_get_arg_type()
-   != DBUS_TYPE_VARIANT)
+   !=