dns/openmdns: add new port

OpenMDNS is a full implementation of MDNS/DNS-SD, it aims to be a light
replacement for Avahi/Bonjour. Currently OpenMDNS is about 10% of the size
of Avahi.

http://www.haesbaert.org/openmdns/
This commit is contained in:
Jan Beich 2016-10-26 02:43:32 +00:00
parent 43479d1c24
commit b5353dd37c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=424664
11 changed files with 232 additions and 2 deletions

2
GIDs
View File

@ -118,7 +118,7 @@ polipo:*:173:
flowtools:*:174:
twms:*:175:
mlvpn:*:176:
# free: 177
_mdnsd:*:177:
otpw:*:178:
gdnsd:*:179:
rt:*:180:

2
UIDs
View File

@ -123,7 +123,7 @@ polipo:*:173:173::0:0:polipo web cache:/nonexistent:/usr/sbin/nologin
flowtools:*:174:174::0:0:Flow-tools collector pseudo-user:/nonexistent:/usr/sbin/nologin
twms:*:175:175::0:0:tWMS pseudo-user:/nonexistent:/usr/sbin/nologin
mlvpn:*:176:176::0:0:mlVPN pseudo-user:/var/run/mlvpn:/usr/sbin/nologin
# free: 177
_mdnsd:*:177:177::0:0:Multicast DNS Daemon:/var/empty:/usr/sbin/nologin
otpw:*:178:178::0:0:OTPW pseudo-user:/var/lib/otpw:/usr/sbin/nologin
gdnsd:*:179:179::0:0:gDNSd pseudo-user:/nonexistent:/usr/sbin/nologin
# free: 180

View File

@ -108,6 +108,7 @@
SUBDIR += opendnssec
SUBDIR += opendnssec13
SUBDIR += opendnssec2
SUBDIR += openmdns
SUBDIR += openresolv
SUBDIR += p5-AnyEvent-CacheDNS
SUBDIR += p5-AnyEvent-DNS-EtcHosts

51
dns/openmdns/Makefile Normal file
View File

@ -0,0 +1,51 @@
# $FreeBSD$
PORTNAME= openmdns
DISTVERSION= 0.6-8
DISTVERSIONSUFFIX= -g07cf5c1
CATEGORIES= dns
MAINTAINER= jbeich@FreeBSD.org
COMMENT= Multicast DNS and Service Discovery daemon
LICENSE= ISCL
USE_GITHUB= yes
GH_ACCOUNT= haesbaert
GH_PROJECT= mdnsd
USES= localbase uidfix
USE_RC_SUBR= mdnsd
MAKE_ENV= LDADD="${LIBS}"
MAKE_ARGS= BINDIR="${PREFIX}/sbin" \
MANDIR="${PREFIX}/man/man"
CFLAGS+= -D__dead=__dead2
LDFLAGS+= -Wl,--as-needed # -lutil
LIBS+= -lopenbsd
SUB_LIST= COMMENT="${COMMENT}"
PLIST_FILES= sbin/mdnsctl \
sbin/mdnsd \
man/man8/mdnsctl.8.gz \
man/man8/mdnsd.8.gz
PORTDOCS= *
USERS= _mdnsd
GROUPS= _mdnsd
OPTIONS_DEFINE= DOCS STATIC
STATIC_BUILD_DEPENDS= ${LOCALBASE}/lib/libevent.a:devel/libevent2 \
${LOCALBASE}/lib/libopenbsd.a:devel/libopenbsd
STATIC_MAKE_ENV= NO_SHARED=1
STATIC_LIB_DEPENDS_OFF= libevent.so:devel/libevent2 \
libopenbsd.so:devel/libopenbsd
post-patch:
# warning: duplicate script for target "maninstall" ignored
@${REINPLACE_CMD} '/bsd\.man\.mk/d' ${WRKSRC}/*/Makefile
post-install-DOCS-on:
(cd ${WRKSRC}/docs && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})
${INSTALL_MAN} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

5
dns/openmdns/distinfo Normal file
View File

@ -0,0 +1,5 @@
TIMESTAMP = 1477213204
SHA256 (libopenbsd-r298107.tar.xz) = f2acd6156d948a4f9a73d9dce65a6f23b3969f87026100edb35c31fc10abc307
SIZE (libopenbsd-r298107.tar.xz) = 13536
SHA256 (haesbaert-mdnsd-0.6-8-g07cf5c1_GH0.tar.gz) = f04c0d77d900490cb7429a076ddba0b279b999db2faf299d5880522fa37f865c
SIZE (haesbaert-mdnsd-0.6-8-g07cf5c1_GH0.tar.gz) = 2935405

View File

@ -0,0 +1,19 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mdnsd
# REQUIRE: LOGIN FILESYSTEMS
# KEYWORD: shutdown
. /etc/rc.subr
name="mdnsd"
desc="%%COMMENT%%"
rcvar="${name}_enable"
command="%%PREFIX%%/sbin/${name}"
command_args="em0"
extra_commands="reload"
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,62 @@
--- mdnsd/mdns.h.orig 2015-05-29 14:18:11 UTC
+++ mdnsd/mdns.h
@@ -31,6 +31,37 @@
#include <event.h>
#include <string.h>
+#ifndef T_NSEC
+#define T_NSEC 47 /* from OpenBSD */
+#endif
+
+#ifndef IFT_CARP
+#define IFT_CARP 0xf8 /* from DragonFly and NetBSD */
+#endif
+
+#ifndef LINK_STATE_IS_UP /* from DragonFly and OpenBSD */
+#define LINK_STATE_IS_UP(_s) ((_s) >= LINK_STATE_UP)
+#endif
+
+/* Copied from <sys/time.h> on OpenBSD */
+#ifndef timespeccmp
+#define timespeccmp(tsp, usp, cmp) \
+ (((tsp)->tv_sec == (usp)->tv_sec) ? \
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
+#endif
+#ifndef timespecsub
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+#endif
+
#define MAXCHARSTR MAXHOSTNAMELEN
#define MAXLABELLEN 64
#define MAXPROTOLEN 4
--- mdnsd/mdnsd.c.orig 2015-05-29 14:18:11 UTC
+++ mdnsd/mdnsd.c
@@ -46,7 +46,9 @@ void fetchmyname(char [MAXHOSTNAMELEN])
void fetchhinfo(struct hinfo *);
struct mdnsd_conf *conf = NULL;
+#ifdef __OpenBSD__
extern char *malloc_options;
+#endif
__dead void
usage(void)
@@ -230,7 +232,9 @@ main(int argc, char *argv[])
switch (ch) {
case 'd':
debug = 1;
+#ifdef __OpenBSD__
malloc_options = "AFGJPX";
+#endif
break;
case 'v':
display_version();

View File

@ -0,0 +1,18 @@
In file included from kiface.c:25:0:
kiface.c:67:1: error: expected ';', identifier or '(' before 'void'
RB_GENERATE(kif_tree, kif_node, entry, kif_compare)
^
--- mdnsd/kiface.c.orig 2015-05-29 14:18:11 UTC
+++ mdnsd/kiface.c
@@ -63,8 +63,8 @@ struct {
RB_HEAD(kif_tree, kif_node) kit;
-RB_PROTOTYPE(kif_tree, kif_node, entry, kif_compare)
-RB_GENERATE(kif_tree, kif_node, entry, kif_compare)
+RB_PROTOTYPE(kif_tree, kif_node, entry, kif_compare);
+RB_GENERATE(kif_tree, kif_node, entry, kif_compare);
int
kif_init(void)

View File

@ -0,0 +1,25 @@
In file included from log.c:33:
In file included from mdnsd/log.h:24:
In file included from mdnsd/mdnsd.h:30:
/usr/local/include/imsg.h:31:2: error: type name requires a specifier or qualifier
TAILQ_ENTRY(ibuf) entry;
^
/usr/local/include/imsg.h:31:14: error: a parameter list without types is only allowed in a function
definition
TAILQ_ENTRY(ibuf) entry;
^
/usr/local/include/imsg.h:31:19: error: expected ';' at end of declaration list
TAILQ_ENTRY(ibuf) entry;
^
[...]
--- mdnsd/mdnsd.h.orig 2015-05-29 14:18:11 UTC
+++ mdnsd/mdnsd.h
@@ -18,6 +18,7 @@
#define _MDNSD_H_
#include <sys/param.h>
+#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/tree.h>
#include <sys/types.h>

View File

@ -0,0 +1,44 @@
packet.c:919:22: error: passing 'u_char [64]' to parameter of type 'const char *' converts between
pointers to integer types with different sign [-Werror=pointer-sign]
if (strlcat(dname, label, MAXHOSTNAMELEN) >= MAXHOSTNAMELEN) {
^~~~~
/usr/include/string.h:92:59: note: passing argument to parameter here
size_t strlcat(char * __restrict, const char * __restrict, size_t);
^
packet.c:986:7: error: assigning to 'char *' from 'u_int8_t *' (aka 'unsigned char *') converts
between pointers to integer types with different sign [-Werror=pointer-sign]
buf = *pbuf;
^ ~~~~~
packet.c:1025:7: error: assigning to 'char *' from 'u_int8_t *' (aka 'unsigned char *') converts
between pointers to integer types with different sign [-Werror=pointer-sign]
buf = *pbuf;
^ ~~~~~
packet.c:1033:22: error: passing 'char *' to parameter of type 'u_int8_t *' (aka 'unsigned char *')
converts between pointers to integer types with different sign [-Werror=pointer-sign]
if (rr_parse_dname(buf, tmplen, rr->rdata.SRV.target) == -1)
^~~
packet.c:71:32: note: passing argument to parameter here
int rr_parse_dname(u_int8_t *, u_int16_t, char [MAXHOSTNAMELEN]);
^
4 errors generated.
--- mdnsd/packet.c.orig 2015-05-29 14:18:11 UTC
+++ mdnsd/packet.c
@@ -853,7 +853,7 @@ pkt_parse_dname(u_int8_t *buf, u_int16_t
int jumped = 0;
u_int16_t oldlen = len;
size_t slen;
- u_char label[MAXLABELLEN];
+ char label[MAXLABELLEN];
/* be extra safe */
bzero(dname, MAXHOSTNAMELEN);
@@ -948,7 +948,7 @@ pkt_parse_rr(u_int8_t **pbuf, u_int16_t
u_int16_t us, rdlen, tmplen;
u_int32_t ul;
ssize_t n;
- char *buf;
+ u_char *buf;
n = pkt_parse_dname(*pbuf, *len, rr->rrs.dname);
if (n == -1)

5
dns/openmdns/pkg-descr Normal file
View File

@ -0,0 +1,5 @@
OpenMDNS is a full implementation of MDNS/DNS-SD, it aims to be a light
replacement for Avahi/Bonjour. Currently, OpenMDNS is about 10% of the size
of Avahi.
WWW: http://www.haesbaert.org/openmdns/