project/mdnsd.git
7 years agoDrop unneeded code to simplify getting hosts over ubus
Rafał Miłecki [Thu, 9 Mar 2017 21:17:32 +0000 (22:17 +0100)]
Drop unneeded code to simplify getting hosts over ubus

This code in umdns_hosts was there since ever but it seems like an
unneeded copy & paste part of umdns_browse. In this function we iterate
over *host* entries of cached services list. It means the entry field
conains values like "example.local".

In such case looking for "._" is pointless and appending ".local"
results in looking for entries like "example.local.local".

This code make sense for browsing *services* only where for entries like
"ex._ssh._tcp.local" we try dumping "ex.local" & "ex._ssh._tcp.local".

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoDrop unneeded casting of "entry" from struct cache_service
Rafał Miłecki [Thu, 9 Mar 2017 13:01:27 +0000 (14:01 +0100)]
Drop unneeded casting of "entry" from struct cache_service

Since commit 819b909b82e4 ("cache: constify entry and host pointers in
struct cache_entry") it is "const char *" so we don't need to cast it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoSet errno when refusing to send packet in interface_send_packet
Rafał Miłecki [Wed, 15 Feb 2017 10:37:57 +0000 (11:37 +0100)]
Set errno when refusing to send packet in interface_send_packet

Callers of interface_send_packet use perror and so expect errno to be
set in case of fail.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoFix error messages when sending packet fails
Rafał Miłecki [Wed, 15 Feb 2017 10:29:00 +0000 (11:29 +0100)]
Fix error messages when sending packet fails

Use perror in both cases, fix copy & paste mistake, don't use extra ":".

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoSend A in response to service discovery
Rafał Miłecki [Wed, 15 Feb 2017 10:17:04 +0000 (11:17 +0100)]
Send A in response to service discovery

This allows other mdns software to discover our hostname when they
start.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoUse A(AAA) when querying for domain on cache expire
Rafał Miłecki [Tue, 14 Feb 2017 12:55:46 +0000 (13:55 +0100)]
Use A(AAA) when querying for domain on cache expire

When cache entry is (halfly) expired we send query to get an update. So
far we were sending all queries using PTR records but for cached domains
it should be A(AAA) instead.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoDon't try sending unicast responses with multicast address
Rafał Miłecki [Tue, 14 Feb 2017 11:18:06 +0000 (12:18 +0100)]
Don't try sending unicast responses with multicast address

So far we were doing that when destination IP address wasn't specified.
Now we have all places in code cleaned up, stop accepting this and print
an error if needed.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoUse unicast IP address when sending unicast service reply
Rafał Miłecki [Tue, 14 Feb 2017 11:18:05 +0000 (12:18 +0100)]
Use unicast IP address when sending unicast service reply

For each protocol (IPv4 and IPv6) we have two interfaces (sockets): one
for unicast and one for multicast. If we noticed CLASS_UNICAST in the
multicast query we were switching to unicast interface for sending
reply.

The problem was not passing destination IP address. It was resulting in
sending packet to multicast IP using unicast interface. As we don't
set IP_MULTICAST_TTL / IPV6_MULTICAST_HOPS for unicast ones TTL was 1
and packets were ignored.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoPrepare support for sending unicast DNS answers
Rafał Miłecki [Tue, 14 Feb 2017 11:18:04 +0000 (12:18 +0100)]
Prepare support for sending unicast DNS answers

This adds extra argument to dns_send_answer & interface_send_packet
functions. For now we pass NULL-s only.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoPrint error if parsing service JSON fails
Rafał Miłecki [Wed, 15 Feb 2017 09:18:18 +0000 (10:18 +0100)]
Print error if parsing service JSON fails

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoSet TTL to 255 for outgoing IPv4 unicast packets
Rafał Miłecki [Mon, 13 Feb 2017 23:14:45 +0000 (00:14 +0100)]
Set TTL to 255 for outgoing IPv4 unicast packets

1) We SHOULD do this according to the RFC 6762 (Section 11, "Source
   Address Check").
2) We already do it for IPv6 unicast and both multicast interfaces
3) When receiving IPv4 packet we ignore it if TTL doesn't equal 255

In other words this is a requirement for working unicast communication
between 2 umdns instances (which doesn't seem to work yet though).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoFix sending replies to PTR questions
Rafał Miłecki [Mon, 13 Feb 2017 15:42:35 +0000 (16:42 +0100)]
Fix sending replies to PTR questions

When we receive PTR question it includes hostname (instance), e.g.:
mdnsd: parse_question (391): Q -> PTR lede._http._tcp.local

First of all we should check if it matches hostname we use before trying
to reply. Secondly service_reply expects service with domain appended
(without hostname/instance) so we need to strip received string out of
hostname before passing it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoAdd helper for checking if cached entry is for a host
Rafał Miłecki [Tue, 14 Feb 2017 12:31:07 +0000 (13:31 +0100)]
Add helper for checking if cached entry is for a host

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoDrop declaration of non-existing cache_lookup_name function
Rafał Miłecki [Tue, 14 Feb 2017 12:02:27 +0000 (13:02 +0100)]
Drop declaration of non-existing cache_lookup_name function

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoMake sdudp string const
Rafał Miłecki [Tue, 14 Feb 2017 11:59:10 +0000 (12:59 +0100)]
Make sdudp string const

It musn't be changed.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoRename cache scanning to updating
Rafał Miłecki [Fri, 10 Feb 2017 14:17:44 +0000 (15:17 +0100)]
Rename cache scanning to updating

What we were do is querying over all interfaces for all cached entries.
This isn't real scanning but rather updating (the cache).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoSet TTL to the new value when updating cached service entry
Rafał Miłecki [Mon, 13 Feb 2017 07:43:27 +0000 (08:43 +0100)]
Set TTL to the new value when updating cached service entry

In the simplest case host may change TTL to some different value. It's
the most important for the goodbye packets though.

Consider situation when host (for which we have no no cached entries)
restarts. First it sends goodbye with TTL 0 (we cache it), then seconds
later it announces with standard TTL values (but we keep TTL 0).
It results in wrong cache state and could cause dropping valid entries.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoLoad service JSONs from /etc/umdns/
Rafał Miłecki [Sat, 11 Feb 2017 11:00:33 +0000 (12:00 +0100)]
Load service JSONs from /etc/umdns/

It matches recent project rename & uses directory that sholud be
persistent. Using /tmp/ could result in user having to setup JSONs after
every reboot.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoRename project to umdns
Rafał Miłecki [Fri, 10 Feb 2017 23:22:31 +0000 (00:22 +0100)]
Rename project to umdns

Using mdns name is a bit confusing as it's really close to Apple's mdnsd
binary name from their mDNSResponder project.
To make things worse OpenWrt's project was hosted in the mdnsd.git repo.

Rename this project to umdns which follows other projects naming schema
and is unique enough.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoDrop one-liner service_announce function
Rafał Miłecki [Fri, 10 Feb 2017 22:37:12 +0000 (23:37 +0100)]
Drop one-liner service_announce function

Now we have service_announce simplified so much there is no reason to
keep it as a helper.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoDon't use _services._dns-sd._tcp.local
Rafał Miłecki [Fri, 10 Feb 2017 22:37:11 +0000 (23:37 +0100)]
Don't use _services._dns-sd._tcp.local

It seems mdns(d) was trying to support queries for two records with
following names:
1) _services._dns-sd._udp.local
2) _services._dns-sd._tcp.local

According to the RFC 6763 Section 9 only the first one should be used
and response PTR records should include services of both protocols: UDP
and TCP.

This fixes discovering TCP services as in practice no other software was
sending queries with _services._dns-sd._tcp.local.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoSimplify UDP vs. TCP handling in service_announce_services
Rafał Miłecki [Fri, 10 Feb 2017 21:55:00 +0000 (22:55 +0100)]
Simplify UDP vs. TCP handling in service_announce_services

Out of 3 calls of this function only one doesn't have TCP vs. UDP
hardcoded. It's easier to move string check to that place and make this
function take "int tcp" argument instead.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoCheck correct attributes when loading service from blob
Rafał Miłecki [Fri, 10 Feb 2017 13:48:36 +0000 (14:48 +0100)]
Check correct attributes when loading service from blob

We access SERVICE_TXT so we should check for this entry. Checking
SERVICE_SERVICE doesn't make sense anyway as it's verified few lines
above (in the same funcion).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoAvoid duplicated iteration over services when announcing
Rafał Miłecki [Fri, 10 Feb 2017 13:44:39 +0000 (14:44 +0100)]
Avoid duplicated iteration over services when announcing

In function service_announce_services we iterate over services and
handle every single one so calling service_reply which also iterates
doesn't make sense.

In simple cases it was just wasting CPU cycles. We got service, we were
passing its name and we were looking for it again comparing names.
In cases with one service available on few different ports it was worse.
For every iterated service we were announcing that one and all other
sharing the same name. It resulted in sending n^2 records.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoMove matching logic out of service_reply_single function
Rafał Miłecki [Fri, 10 Feb 2017 11:58:24 +0000 (12:58 +0100)]
Move matching logic out of service_reply_single function

There is only 1 place in project calling this function with the match
argument. It's easier to add prooper condition in this place and have
service_reply_single simplified by taking 1 less argument.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoSend A(AAA) records when announcing
Rafał Miłecki [Thu, 9 Feb 2017 09:11:16 +0000 (10:11 +0100)]
Send A(AAA) records when announcing

This allows device to be discovered by its local hostname.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoFix/change comment format about port 5353
Rafał Miłecki [Thu, 9 Feb 2017 08:19:05 +0000 (09:19 +0100)]
Fix/change comment format about port 5353

It wasn't ANSI C comment and there were 2 unneeded spaces.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
7 years agoDon't call dns_reply_a from service_reply
Rafał Miłecki [Wed, 8 Feb 2017 17:04:27 +0000 (18:04 +0100)]
Don't call dns_reply_a from service_reply

This simplifies code without changing any behavior. Having this call in
service_reply required checking two conditions and was making code flow
harder to follow.

There are 2 more service_reply calls in the project:
1) In service_announce_services where we iterate over &services and
   every element of this list has "service" field filled. It means match
   argument was never NULL and dns_reply_a was never called from there.
2) In parse_question which also receives some name (there is a proper
   check in the dns_handle_packet). No call there neither.

So after all there was only 1 place that was indeed calling dns_reply_a.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoRename service_reply_a to dns_reply_a and move it to proper file
Rafał Miłecki [Wed, 8 Feb 2017 15:47:52 +0000 (16:47 +0100)]
Rename service_reply_a to dns_reply_a and move it to proper file

This function doesn't really do anything service specify, it just sends
an A(AAA) records. It could probably be used even without any services
registered.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoAdd simple "Fall through" comment to the announce_timer function switch
Rafał Miłecki [Wed, 8 Feb 2017 14:20:42 +0000 (15:20 +0100)]
Add simple "Fall through" comment to the announce_timer function switch

It's a common practice to add such comments to make it clear break
instruction was skipped on purpose.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agoChange dns_send_question function arg from unicast to multicast
Rafał Miłecki [Wed, 8 Feb 2017 13:04:57 +0000 (14:04 +0100)]
Change dns_send_question function arg from unicast to multicast

This trivial patch just reverses argument logic to make it a bit more
consistent with struct interface which contains "multicast" field. This
hopefully will make typos less likely and code easier to follow.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: John Crispin <john@phrozen.org>
7 years agodo not assume that dns structs are aligned
Johannes Wegener [Wed, 25 Jan 2017 23:07:00 +0000 (00:07 +0100)]
do not assume that dns structs are aligned

They do not have a fixed alignment in the packet. ARMv5 has separate
instructions for unaligned and aligned 16-bit load/store. The aligned
ones have undefined behavior if the addresses are unaligned, and that
completely breaks packet parsing.

Signed-off-by: Johannes Wegener <mail@johanneswegener.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years agomdnsd: the service is ignoring questions
John Crispin [Mon, 19 Dec 2016 12:06:15 +0000 (13:06 +0100)]
mdnsd: the service is ignoring questions

When a question is incoming the service was incorrectly resettig the
query timeout regardless of it being the right service. This causes
the code to never answer the questions it is being asked.

Reported-by: Cristian Morales Vega <cristian@samknows.com>
Signed-off-by: John Crispin <john@phrozen.org>
7 years agocmake: Search for libjson-c
Florian Fainelli [Tue, 13 Dec 2016 22:23:53 +0000 (14:23 -0800)]
cmake: Search for libjson-c

Since we use libblobmsg_json which uses libjson-c internally, make sure
we find this library.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
7 years agoFix IPv6 read
Cristian Morales Vega [Wed, 14 Dec 2016 16:49:38 +0000 (16:49 +0000)]
Fix IPv6 read

This is a quick fix. It may still not work when the interface has
multiple IPs, and this also applies to IPv4.

Signed-off-by: Cristian Morales Vega <cristian@samknows.com>
8 years agoRevert "mdnsd: interface: enable looped back messages"
John Crispin [Mon, 24 Oct 2016 16:43:16 +0000 (18:43 +0200)]
Revert "mdnsd: interface: enable looped back messages"

This reverts commit 8a70b2b47dd328f8180e5ecaa7bdc817f574a81b.

8 years agomdnsd: interface: enable looped back messages
Eyal Birger [Sun, 22 May 2016 09:20:43 +0000 (12:20 +0300)]
mdnsd: interface: enable looped back messages

When the IP_MULTICAST_LOOP/IPV6_MULTICAST_LOOP socket options are not enabled,
locally generated queries are ignored by mdnsd; This prevents local
applications from being able to discover locally published services.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
9 years agointerface: include libubox/utils.h
Felix Fietkau [Thu, 3 Sep 2015 12:59:12 +0000 (14:59 +0200)]
interface: include libubox/utils.h

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
9 years agoservice: remove obsolete uci include statements
Felix Fietkau [Thu, 3 Sep 2015 12:58:24 +0000 (14:58 +0200)]
service: remove obsolete uci include statements

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoubus: add keep functionality to set_config-call
Steven Barth [Thu, 6 Nov 2014 20:18:54 +0000 (21:18 +0100)]
ubus: add keep functionality to set_config-call

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agocache: fix cache record refreshing
Steven Barth [Tue, 28 Oct 2014 19:50:31 +0000 (20:50 +0100)]
cache: fix cache record refreshing

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agoubus: add ubus fetch call
Steven Barth [Tue, 28 Oct 2014 19:11:35 +0000 (20:11 +0100)]
ubus: add ubus fetch call

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agodns: use different buffers for encoding and decoding names
Steven Barth [Tue, 28 Oct 2014 18:41:13 +0000 (19:41 +0100)]
dns: use different buffers for encoding and decoding names

dns_send_question was ocassionally called with a name from name_buf

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agocache: also cache PTR records
Steven Barth [Tue, 28 Oct 2014 11:29:13 +0000 (12:29 +0100)]
cache: also cache PTR records

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agocache: cache rdata of SRV-records as well
Steven Barth [Tue, 28 Oct 2014 10:57:09 +0000 (11:57 +0100)]
cache: cache rdata of SRV-records as well

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agoUse monotonic clock for timeouts
Steven Barth [Tue, 28 Oct 2014 08:57:24 +0000 (09:57 +0100)]
Use monotonic clock for timeouts

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agoAdd query ubus call
Steven Barth [Sun, 26 Oct 2014 19:00:21 +0000 (20:00 +0100)]
Add query ubus call

Signed-off-by: Steven Barth <steven@midlink.org>
10 years agoadd a basic cache refresh logic
John Crispin [Thu, 4 Sep 2014 20:37:41 +0000 (22:37 +0200)]
add a basic cache refresh logic

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd a iface pointer to services and records
John Crispin [Thu, 4 Sep 2014 20:35:48 +0000 (22:35 +0200)]
add a iface pointer to services and records

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoentry->service
John Crispin [Thu, 4 Sep 2014 19:23:07 +0000 (21:23 +0200)]
entry->service

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoprint ttl when receiving a PTR record
John Crispin [Thu, 4 Sep 2014 19:01:48 +0000 (21:01 +0200)]
print ttl when receiving a PTR record

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agobasic support for the cache flush bit
John Crispin [Thu, 4 Sep 2014 18:26:43 +0000 (20:26 +0200)]
basic support for the cache flush bit

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd src ip validation
John Crispin [Thu, 4 Sep 2014 17:34:18 +0000 (19:34 +0200)]
add src ip validation

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosilently drop unicast questions that dont originate from port 5353
John Crispin [Thu, 4 Sep 2014 15:44:46 +0000 (17:44 +0200)]
silently drop unicast questions that dont originate from port 5353

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agopropagate sockaddr and port form the receive function to the parser
John Crispin [Thu, 4 Sep 2014 15:42:21 +0000 (17:42 +0200)]
propagate sockaddr and port form the receive function to the parser

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix free after use on shutdown
John Crispin [Tue, 2 Sep 2014 19:25:19 +0000 (21:25 +0200)]
fix free after use on shutdown

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd good bye messages
John Crispin [Tue, 2 Sep 2014 18:37:24 +0000 (20:37 +0200)]
add good bye messages

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd SO_BINDTODEVICE support
John Crispin [Tue, 2 Sep 2014 18:20:10 +0000 (20:20 +0200)]
add SO_BINDTODEVICE support

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosaner debug output
John Crispin [Tue, 2 Sep 2014 18:15:43 +0000 (20:15 +0200)]
saner debug output

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoipv6 cleanup
John Crispin [Tue, 2 Sep 2014 14:41:51 +0000 (16:41 +0200)]
ipv6 cleanup

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agopropagate unicast bit
John Crispin [Tue, 2 Sep 2014 13:23:57 +0000 (15:23 +0200)]
propagate unicast bit

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agonicer debug output on rx
John Crispin [Tue, 2 Sep 2014 13:15:23 +0000 (15:15 +0200)]
nicer debug output on rx

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd unicast listener sockets
John Crispin [Tue, 2 Sep 2014 12:44:16 +0000 (14:44 +0200)]
add unicast listener sockets

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agointerface.c cleanup
John Crispin [Tue, 2 Sep 2014 12:24:12 +0000 (14:24 +0200)]
interface.c cleanup

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoremove debug code
John Crispin [Sat, 30 Aug 2014 11:55:03 +0000 (13:55 +0200)]
remove debug code

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agovalidate incoming interface
John Crispin [Sat, 30 Aug 2014 11:17:02 +0000 (13:17 +0200)]
validate incoming interface

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosane error message when read fails
John Crispin [Sat, 30 Aug 2014 10:24:52 +0000 (12:24 +0200)]
sane error message when read fails

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd pktinfo to rx path
John Crispin [Fri, 29 Aug 2014 19:28:45 +0000 (21:28 +0200)]
add pktinfo to rx path

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd -4 and -6 options
John Crispin [Fri, 29 Aug 2014 19:24:35 +0000 (21:24 +0200)]
add -4 and -6 options

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoload service info from procd
John Crispin [Fri, 29 Aug 2014 12:02:31 +0000 (14:02 +0200)]
load service info from procd

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosplit the service_load() function into 2. this allows us to reuse the parsing
John Crispin [Fri, 29 Aug 2014 11:53:11 +0000 (13:53 +0200)]
split the service_load() function into 2. this allows us to reuse the parsing
code when reading services via ubus

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agochange the service json format this allows one instance to register multiple services...
John Crispin [Fri, 29 Aug 2014 11:42:20 +0000 (13:42 +0200)]
change the service json format this allows one instance to register multiple services of the same kind but with different ports

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agosend unsolicitated answers when a new service appears
John Crispin [Fri, 29 Aug 2014 07:01:31 +0000 (09:01 +0200)]
send unsolicitated answers when a new service appears

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoremove some debug code
John Crispin [Thu, 28 Aug 2014 10:43:22 +0000 (12:43 +0200)]
remove some debug code

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agodont delete records but set ttl to 1
John Crispin [Thu, 28 Aug 2014 10:40:12 +0000 (12:40 +0200)]
dont delete records but set ttl to 1

-> 10.2.  Announcements to Flush Outdated Cache Entries

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd the rfc
John Crispin [Thu, 28 Aug 2014 10:29:41 +0000 (12:29 +0200)]
add the rfc

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd goodbye messages when service disappear
John Crispin [Thu, 28 Aug 2014 10:29:01 +0000 (12:29 +0200)]
add goodbye messages when service disappear

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agomore ttl related changes. prereq for goodbye messages
John Crispin [Thu, 28 Aug 2014 10:14:37 +0000 (12:14 +0200)]
more ttl related changes. prereq for goodbye messages

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agodns_add_answer() now has a ttl parameter
John Crispin [Thu, 28 Aug 2014 08:15:21 +0000 (10:15 +0200)]
dns_add_answer() now has a ttl parameter

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoproperly announce all ips of an interface when asked
John Crispin [Thu, 28 Aug 2014 08:01:33 +0000 (10:01 +0200)]
properly announce all ips of an interface when asked

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoadd ipv6 support
John Crispin [Thu, 28 Aug 2014 02:20:58 +0000 (04:20 +0200)]
add ipv6 support

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix potential null pointer deref when packets are forged
John Crispin [Wed, 27 Aug 2014 17:51:07 +0000 (19:51 +0200)]
fix potential null pointer deref when packets are forged

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix potential buffer overflow when txt records are forged
John Crispin [Wed, 27 Aug 2014 17:49:04 +0000 (19:49 +0200)]
fix potential buffer overflow when txt records are forged

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoabort the reply parsing if an error is encountered
John Crispin [Wed, 27 Aug 2014 16:10:20 +0000 (18:10 +0200)]
abort the reply parsing if an error is encountered

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agogracefully exit if the cmdline is bogus
John Crispin [Wed, 27 Aug 2014 14:09:08 +0000 (16:09 +0200)]
gracefully exit if the cmdline is bogus

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoremove now unused service-types index
John Crispin [Fri, 27 Jun 2014 01:07:17 +0000 (02:07 +0100)]
remove now unused service-types index

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix entry duplication bug
John Crispin [Wed, 25 Jun 2014 03:06:54 +0000 (04:06 +0100)]
fix entry duplication bug

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix off by one in record find code
John Crispin [Wed, 25 Jun 2014 02:32:22 +0000 (03:32 +0100)]
fix off by one in record find code

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agofix use after free
John Crispin [Wed, 25 Jun 2014 01:09:02 +0000 (02:09 +0100)]
fix use after free

Signed-off-by: John Crispin <blogic@openwrt.org>
10 years agoremove linux specific includes
Felix Fietkau [Wed, 25 Jun 2014 08:02:11 +0000 (10:02 +0200)]
remove linux specific includes

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomdns: remove dependencies on asm/byteorder.h, fix constant endian swap initialization
Felix Fietkau [Wed, 25 Jun 2014 08:00:25 +0000 (10:00 +0200)]
mdns: remove dependencies on asm/byteorder.h, fix constant endian swap initialization

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoservice.c: remove unused service_attr_list
Felix Fietkau [Wed, 25 Jun 2014 07:58:13 +0000 (09:58 +0200)]
service.c: remove unused service_attr_list

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agorename set_interfaces to set_config, more stuff can be added here
Felix Fietkau [Wed, 11 Jun 2014 14:58:19 +0000 (16:58 +0200)]
rename set_interfaces to set_config, more stuff can be added here

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoallow starting without an active interface
Felix Fietkau [Wed, 11 Jun 2014 14:40:38 +0000 (16:40 +0200)]
allow starting without an active interface

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoadd support for dynamic reconfiguration of interfaces
Felix Fietkau [Wed, 11 Jun 2014 14:40:24 +0000 (16:40 +0200)]
add support for dynamic reconfiguration of interfaces

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agofix segfault while dumping records
Felix Fietkau [Mon, 9 Jun 2014 22:42:10 +0000 (00:42 +0200)]
fix segfault while dumping records

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agosimplify memory management for dns answers: use a blob_buf to cache entries
Felix Fietkau [Mon, 9 Jun 2014 22:35:52 +0000 (00:35 +0200)]
simplify memory management for dns answers: use a blob_buf to cache entries

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agouse lookup array for dns_type_string()
Felix Fietkau [Mon, 9 Jun 2014 22:11:50 +0000 (00:11 +0200)]
use lookup array for dns_type_string()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agoreuse mdns_buf for cache_answer()
Felix Fietkau [Mon, 9 Jun 2014 22:07:49 +0000 (00:07 +0200)]
reuse mdns_buf for cache_answer()

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 years agomove signal_setup() to main.c
Felix Fietkau [Mon, 9 Jun 2014 22:00:08 +0000 (00:00 +0200)]
move signal_setup() to main.c

Signed-off-by: Felix Fietkau <nbd@openwrt.org>