[LEDE-DEV] umdns - TTL restricted to 255

2017-09-25 Thread Philipp Meier

Hi,

When using umdns I was wondering why my mDNS query did not get any answer.

I found the following reason:

My mDNS query has TTL field set to 1. But LEDE umdns package expects a 
TTL value of 255 (see interface.c function read_socket4).


According 
https://www.systutorials.com/docs/linux/man/5-avahi-daemon.conf/ (see 
check-response-ttl) this was necessary security behavior in older mDNS 
versions but will be incompatible with newer versions of mDNS 
implementations.


Therefore my question here is: Is this by purpose restricted to 255 by 
LEDE umdns package or could this be changed?


Regards
Philipp


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] umdns - TTL restricted to 255

2017-09-25 Thread Philipp Meier
My question is about query (not response). LEDE is ignoring query when 
TTL != 255.


Philipp


On 09/25/2017 05:16 PM, John Crispin wrote:

Hi,

rfc6762 has the following ...

11.  Source Address Check

   All Multicast DNS responses (including responses sent via unicast)
   SHOULD be sent with IP TTL set to 255.  This is recommended to
   provide backwards-compatibility with older Multicast DNS queriers
   (implementing a draft version of this document, posted in February
   2004) that check the IP TTL on reception to determine whether the
   packet originated on the local link.  These older queriers discard
   all packets with TTLs other than 255.

    John



On 25/09/17 16:44, Philipp Meier wrote:

Hi,

When using umdns I was wondering why my mDNS query did not get any 
answer.


I found the following reason:

My mDNS query has TTL field set to 1. But LEDE umdns package expects 
a TTL value of 255 (see interface.c function read_socket4).


According 
https://www.systutorials.com/docs/linux/man/5-avahi-daemon.conf/ (see 
check-response-ttl) this was necessary security behavior in older 
mDNS versions but will be incompatible with newer versions of mDNS 
implementations.


Therefore my question here is: Is this by purpose restricted to 255 
by LEDE umdns package or could this be changed?


Regards
Philipp


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] Remove ttl==255 restriction for queries

2017-09-26 Thread Philipp Meier

This commit removes ttl==255 restriction for queries.

Newer mDNS implementations use ttl != 255 when sending queries.


Signed-off-by: Philipp Meier 
---
 interface.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/interface.c b/interface.c
index 3904c89..7f814d2 100644
--- a/interface.c
+++ b/interface.c
@@ -233,9 +233,6 @@ read_socket4(struct uloop_fd *u, unsigned int events)
     }
 }

-    if (ttl != 255)
-        return;
-
 if (debug > 1) {
     char buf[256];

@@ -310,9 +307,6 @@ read_socket6(struct uloop_fd *u, unsigned int events)
     }
 }

-    if (ttl != 255)
-        return;
-
 if (debug > 1) {
     char buf[256];

--
2.7.4



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] umdns: Remove incorrect comma in http service json config

2017-09-26 Thread Philipp Meier

Remove trailing comma in http service json configuration file

Signed-off-by: Philipp Meier 
---
json/http.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/json/http.json b/json/http.json
index cf60532..2a7b50a 100644
--- a/json/http.json
+++ b/json/http.json
@@ -1,3 +1,3 @@
{
-"http_80": { "service": "_http._tcp.local", "port": 80, "txt": 
[ "foo=bar"] },
+"http_80": { "service": "_http._tcp.local", "port": 80, "txt": 
[ "foo=bar"] }

}
--
2.7.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] umdns: Add debug output for service_timeout

2017-09-26 Thread Philipp Meier

Debug output for case where no response is sent out due to service_timeout.
This would have saved me some ours in finding out why an mDNS query did 
not get any response.


Signed-off-by: Philipp Meier 
---
 service.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/service.c b/service.c
index 0a9e25d..97b6f91 100644
--- a/service.c
+++ b/service.c
@@ -121,8 +121,10 @@ service_timeout(struct service *s)
 {
 time_t t = monotonic_time();

-if (t - s->t <= TOUT_LOOKUP)
+if (t - s->t <= TOUT_LOOKUP) {
+DBG(2, "t=%lu, s->t=%lu, t - s->t = %lu\n", t, s->t, t 
- s->t);

 return 0;
+}

 return t;
 }
--
2.7.4

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] umdns - TTL restricted to 255

2017-09-26 Thread Philipp Meier
OK - I provided a patch for this change ([PATCH] Remove ttl==255 
restriction for queries).


Additionally I sent two other patches:
1. [PATCH] umdns: Remove incorrect comma in hhtp service json config
2. [PATCH] umdns: Add debug output for service_timeout

Philipp

On 09/25/2017 06:45 PM, John Crispin wrote:
in that case its a bug and the code should be changed to only have that 
restriction on queries


     John


On 25/09/17 17:21, Philipp Meier wrote:
My question is about query (not response). LEDE is ignoring query when 
TTL != 255.


Philipp


On 09/25/2017 05:16 PM, John Crispin wrote:

Hi,

rfc6762 has the following ...

11.  Source Address Check

   All Multicast DNS responses (including responses sent via unicast)
   SHOULD be sent with IP TTL set to 255.  This is recommended to
   provide backwards-compatibility with older Multicast DNS queriers
   (implementing a draft version of this document, posted in February
   2004) that check the IP TTL on reception to determine whether the
   packet originated on the local link.  These older queriers discard
   all packets with TTLs other than 255.

    John



On 25/09/17 16:44, Philipp Meier wrote:

Hi,

When using umdns I was wondering why my mDNS query did not get any 
answer.


I found the following reason:

My mDNS query has TTL field set to 1. But LEDE umdns package expects 
a TTL value of 255 (see interface.c function read_socket4).


According 
https://www.systutorials.com/docs/linux/man/5-avahi-daemon.conf/ 
(see check-response-ttl) this was necessary security behavior in 
older mDNS versions but will be incompatible with newer versions of 
mDNS implementations.


Therefore my question here is: Is this by purpose restricted to 255 
by LEDE umdns package or could this be changed?


Regards
Philipp


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] umdns: query response only every 60s

2017-09-26 Thread Philipp Meier

Hi

When using umdns I experience the follow not expected behavior:

There is no mDNS response sent for a service where an announcement or a 
response has been sent in the last 60 seconds (see service.c function 
service_timeout).


1. I started the LEDE device
2. Then I started a PC application
3. In the PC app I sent out an mDNS query
4. I wondered why I did not get a response

Then by looking at the source code I detected the service_timeout 
function in service.c and now see that when I wait long enough with 
above step 3, then I get the expected response from LEDE.


In the mDSN RFC I cannot directly see any such requirement. But I might 
interpret it wrong.


Why is LEDE umdns only answering queries for a certain service every 60s?

Regards
Philipp

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 2/3] Remove incorrect comma in http service json config

2017-09-28 Thread Philipp Meier
Signed-off-by: Philipp Meier 
---
 json/http.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/json/http.json b/json/http.json
index cf60532..2a7b50a 100644
--- a/json/http.json
+++ b/json/http.json
@@ -1,3 +1,3 @@
 {
-   "http_80": { "service": "_http._tcp.local", "port": 80, "txt": [ 
"foo=bar"] },
+   "http_80": { "service": "_http._tcp.local", "port": 80, "txt": [ 
"foo=bar"] }
 }
-- 
2.7.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/3] Remove ttl==255 restriction for queries

2017-09-28 Thread Philipp Meier
Signed-off-by: Philipp Meier 
---
 interface.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/interface.c b/interface.c
index 3904c89..7f814d2 100644
--- a/interface.c
+++ b/interface.c
@@ -233,9 +233,6 @@ read_socket4(struct uloop_fd *u, unsigned int events)
}
}
 
-   if (ttl != 255)
-   return;
-
if (debug > 1) {
char buf[256];
 
@@ -310,9 +307,6 @@ read_socket6(struct uloop_fd *u, unsigned int events)
}
}
 
-   if (ttl != 255)
-   return;
-
if (debug > 1) {
char buf[256];
 
-- 
2.7.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 3/3] Add debug output for service_timeout

2017-09-28 Thread Philipp Meier
Signed-off-by: Philipp Meier 
---
 service.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/service.c b/service.c
index 0a9e25d..97b6f91 100644
--- a/service.c
+++ b/service.c
@@ -121,8 +121,10 @@ service_timeout(struct service *s)
 {
time_t t = monotonic_time();
 
-   if (t - s->t <= TOUT_LOOKUP)
+   if (t - s->t <= TOUT_LOOKUP) {
+   DBG(2, "t=%lu, s->t=%lu, t - s->t = %lu\n", t, s->t, t - s->t);
return 0;
+   }
 
return t;
 }
-- 
2.7.4


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] umdns: Remove incorrect comma in http service json config

2017-09-28 Thread Philipp Meier



On 26/09/17 10:55, Philipp Meier wrote:

Remove trailing comma in http service json configuration file

Signed-off-by: Philipp Meier 
---
json/http.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/json/http.json b/json/http.json
index cf60532..2a7b50a 100644
--- a/json/http.json
+++ b/json/http.json
@@ -1,3 +1,3 @@
{
-"http_80": { "service": "_http._tcp.local", "port": 80, 
"txt": [ "foo=bar"] },
+"http_80": { "service": "_http._tcp.local", "port": 80, 
"txt": [ "foo=bar"] }

}
--
2.7.4

Hi Philipp,

your mail client chewed up all tabs and replaced them with spaces on 
patches that you sent. please resend them using git send-email.


     John

Hi John,

I resent all 3 patches for umdns using git send-email as you requested 
for the http.json minor fix.
I have seen that the subject now misses the "umdns: ...". If this is a 
problem please tell me.


Philipp

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH] umdns: Remove incorrect comma in http service json config

2017-09-28 Thread Philipp Meier



On 26/09/17 10:55, Philipp Meier wrote:

Remove trailing comma in http service json configuration file

Signed-off-by: Philipp Meier 
---
json/http.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/json/http.json b/json/http.json
index cf60532..2a7b50a 100644
--- a/json/http.json
+++ b/json/http.json
@@ -1,3 +1,3 @@
{
-"http_80": { "service": "_http._tcp.local", "port": 80, 
"txt": [ "foo=bar"] },
+"http_80": { "service": "_http._tcp.local", "port": 80, 
"txt": [ "foo=bar"] }

}
--
2.7.4

Hi Philipp,

your mail client chewed up all tabs and replaced them with spaces on 
patches that you sent. please resend them using git send-email.


 John

Hi John,

I resent all 3 patches for umdns using git send-email as you requested 
for the http.json minor fix.
I have seen that the subject now misses the "umdns: ...". If this is a 
problem please tell me.


Philipp

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev

Hi John,

would it help you if I resend the patch mails once again with better 
subject ("umdns: " in front of subject line) and not as series of patch 
but as 3 single patch mails?


Philipp

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 3/3] Add debug output for service_timeout

2017-10-02 Thread Philipp Meier



On 09/28/2017 09:35 PM, Philip Prindeville wrote:

Inline

Sent from my iPhone

On Sep 28, 2017, at 1:09 AM, Philipp Meier  wrote:

Signed-off-by: Philipp Meier 
---
service.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/service.c b/service.c
index 0a9e25d..97b6f91 100644
--- a/service.c
+++ b/service.c
@@ -121,8 +121,10 @@ service_timeout(struct service *s)
{
time_t t = monotonic_time();

-if (t - s->t <= TOUT_LOOKUP)
+if (t - s->t <= TOUT_LOOKUP) {
+DBG(2, "t=%lu, s->t=%lu, t - s->t = %lu\n", t, s->t, t - s->t);


Do you need to write "t - s->t" or would "elapsed", "remaining", or even 
"delta" be more descriptive?



return 0;
+}

return t;
}
--
2.7.4




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev



Hi Philip,

No - I do not "need" to write "t - s->t" - if John (maintainer) would 
like to have a more descriptive debug message I would be happy to 
provide a patch with these changes.
If not: it's anyway a debug only message which is only meaningful for 
people looking at the source code.


Regards,
Philipp

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev