diff --git a/net/mpd5/Makefile b/net/mpd5/Makefile index d7e05072dd64..8c71057f346c 100644 --- a/net/mpd5/Makefile +++ b/net/mpd5/Makefile @@ -1,67 +1,67 @@ PORTNAME= mpd DISTVERSION= 5.9 -PORTREVISION= 18 +PORTREVISION= 19 CATEGORIES= net MASTER_SITES= SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION} PKGNAMESUFFIX= 5 DIST_SUBDIR= mpd5 MAINTAINER= eugen@FreeBSD.org COMMENT= Multi-link PPP daemon based on netgraph(4) WWW= https://sourceforge.net/projects/mpd/ LICENSE= BSD3CLAUSE USES= cpe MAKE_ARGS+= MANDIR=${PREFIX}/share/man/man CPE_VENDOR= mpd_project OPTIONS_DEFINE= DOCS NG_IPACCT RADIUS OPTIONS_DEFAULT= RADIUS NG_IPACCT_DESC= Use ng_ipacct kernel module from port RADIUS_DESC= Enable RADIUS support HAS_CONFIGURE= YES CONFIGURE_WRKSRC= "${WRKSRC}/src" .include MAKE_ARGS+= OSVERSION=${OSVERSION} .if ${PORT_OPTIONS:MNG_IPACCT} BUILD_DEPENDS+= ${LOCALBASE}/include/netgraph/ng_ipacct.h:net-mgmt/ng_ipacct .if exists(${KMODDIR}/ng_ipacct.ko) RUN_DEPENDS+= ${KMODDIR}/ng_ipacct.ko:net-mgmt/ng_ipacct .else RUN_DEPENDS+= /boot/modules/ng_ipacct.ko:net-mgmt/ng_ipacct .endif .else CONFIGURE_ENV+= USE_NG_IPACCT=no MAKE_ARGS+= USE_NG_IPACCT=no .endif .if ${PORT_OPTIONS:MRADIUS} PLIST_FILES= ${DATADIR}/dictionary.mpd post-install: ${MKDIR} ${STAGEDIR}${DATADIR} ${INSTALL_DATA} ${WRKSRC}/conf/dictionary.mpd ${STAGEDIR}${DATADIR} .else CONFIGURE_ENV+= USE_RADIUS=no MAKE_ARGS+= USE_RADIUS=no .endif USE_RC_SUBR= mpd5 CONFSUF= conf secret script DOCSDIR= ${PREFIX}/share/doc/mpd5 PORTDOCS= README mpd* PLIST_FILES+= ${CONFSUF:C|(.*)|"@sample etc/mpd5/mpd.\1.sample"|} \ sbin/mpd5 .if !defined(WITHOUT_MAN) PLIST_FILES+= share/man/man8/mpd5.8.gz .endif .include diff --git a/net/mpd5/files/patch-resolve-peer b/net/mpd5/files/patch-resolve-peer new file mode 100644 index 000000000000..c7ab7bb5ffbd --- /dev/null +++ b/net/mpd5/files/patch-resolve-peer @@ -0,0 +1,223 @@ +Index: src/l2tp.c +=================================================================== +--- src/l2tp.c (revision 2597) ++++ src/l2tp.c (revision 2598) +@@ -411,17 +411,24 @@ L2tpOpen(Link l) + return; + }; + +- l->state = PHYS_STATE_CONNECTING; +- strlcpy(pi->callingnum, pi->conf.callingnum, sizeof(pi->callingnum)); +- strlcpy(pi->callednum, pi->conf.callednum, sizeof(pi->callednum)); +- +- if ((!Enabled(&pi->conf.options, L2TP_CONF_RESOLVE_ONCE)) && +- (pi->conf.fqdn_peer_addr != NULL)) { ++ if ((!Enabled(&pi->conf.options, L2TP_CONF_RESOLVE_ONCE) || ++ u_addrempty(&pi->conf.peer_addr.addr)) && ++ (pi->conf.fqdn_peer_addr != NULL)) { + struct u_range rng; + if (ParseRange(pi->conf.fqdn_peer_addr, &rng, ALLOW_IPV4|ALLOW_IPV6)) + pi->conf.peer_addr = rng; ++ else { ++ Log(LG_PHYS, ("[%s] L2TP: failed to resolve peer name: %s", ++ l->name, pi->conf.fqdn_peer_addr)); ++ PhysDown(l, STR_CON_FAILED, "failed to resolve peer name"); ++ return; ++ } + } + ++ l->state = PHYS_STATE_CONNECTING; ++ strlcpy(pi->callingnum, pi->conf.callingnum, sizeof(pi->callingnum)); ++ strlcpy(pi->callednum, pi->conf.callednum, sizeof(pi->callednum)); ++ + ghash_walk_init(gL2tpTuns, &walk); + while ((tun = ghash_walk_next(gL2tpTuns, &walk)) != NULL) { + if (tun->ctrl && tun->alive && tun->active_sessions < gL2TPtunlimit && +@@ -1761,24 +1768,27 @@ L2tpSetCommand(Context ctx, int ac, const char *const + Freee(*fqdn_peer_addr); + *fqdn_peer_addr = Mstrdup(MB_PHYS, av[0]); + } +- if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) +- return(-1); + if (ac > 1) { + if ((port = atoi(av[1])) < 0 || port > 0xffff) + return(-1); + } else { + port = 0; + } ++ ++ if ((intptr_t)arg == SET_SELFADDR) ++ l2tp->conf.self_port = port; ++ else ++ l2tp->conf.peer_port = port; ++ if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) ++ return(-1); + if ((intptr_t)arg == SET_SELFADDR) { + l2tp->conf.self_addr = rng.addr; +- l2tp->conf.self_port = port; + if (l2tp->server) { + L2tpUnListen(ctx->lnk); + L2tpListen(ctx->lnk); + } + } else { + l2tp->conf.peer_addr = rng; +- l2tp->conf.peer_port = port; + } + break; + case SET_CALLINGNUM: +Index: src/pptp.c +=================================================================== +--- src/pptp.c (revision 2597) ++++ src/pptp.c (revision 2598) +@@ -360,11 +360,17 @@ PptpOriginate(Link l) + linfo.cancel = PptpCancel; + strlcpy(pptp->callingnum, pptp->conf.callingnum, sizeof(pptp->callingnum)); + strlcpy(pptp->callednum, pptp->conf.callednum, sizeof(pptp->callednum)); +- if ((!Enabled(&pptp->conf.options, PPTP_CONF_RESOLVE_ONCE)) && +- (pptp->conf.fqdn_peer_addr != NULL)) { ++ if ((!Enabled(&pptp->conf.options, PPTP_CONF_RESOLVE_ONCE) || ++ u_addrempty(&pptp->conf.peer_addr.addr)) && ++ (pptp->conf.fqdn_peer_addr != NULL)) { + struct u_range rng; + if (ParseRange(pptp->conf.fqdn_peer_addr, &rng, ALLOW_IPV4|ALLOW_IPV6)) + pptp->conf.peer_addr = rng; ++ else { ++ Log(LG_PHYS, ("[%s] PPTP: failed to resolve peer name: %s", ++ l->name, pptp->conf.fqdn_peer_addr)); ++ return(-1); ++ } + } + if (!pptp->outcall) { + int frameType = PPTP_FRAMECAP_SYNC; +@@ -1183,20 +1189,22 @@ PptpSetCommand(Context ctx, int ac, const char *const + Freee(*fqdn_peer_addr); + *fqdn_peer_addr = Mstrdup(MB_PHYS, av[0]); + } +- if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) +- return(-1); + if (ac > 1) { + if ((port = atoi(av[1])) < 0 || port > 0xffff) + return(-1); + } else { + port = 0; + } ++ if ((intptr_t)arg == SET_SELFADDR) ++ pi->conf.self_port = port; ++ else ++ pi->conf.peer_port = port; ++ if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) ++ return(-1); + if ((intptr_t)arg == SET_SELFADDR) { + pi->conf.self_addr = rng.addr; +- pi->conf.self_port = port; + } else { + pi->conf.peer_addr = rng; +- pi->conf.peer_port = port; + } + break; + case SET_CALLINGNUM: +Index: src/tcp.c +=================================================================== +--- src/tcp.c (revision 2597) ++++ src/tcp.c (revision 2598) +@@ -289,11 +289,20 @@ TcpOpen(Link l) + PhysUp(l); + return; + } +- if ((!Enabled(&pi->conf.options, TCP_CONF_RESOLVE_ONCE)) && +- (pi->conf.fqdn_peer_addr != NULL)) { ++ if ((!Enabled(&pi->conf.options, TCP_CONF_RESOLVE_ONCE) || ++ u_addrempty(&pi->conf.peer_addr.addr)) && ++ (pi->conf.fqdn_peer_addr != NULL)) { + struct u_range rng; + if (ParseRange(pi->conf.fqdn_peer_addr, &rng, ALLOW_IPV4|ALLOW_IPV6)) + pi->conf.peer_addr = rng; ++ else { ++ Log(LG_PHYS, ("[%s] TCP: failed to resolve peer name: %s", ++ l->name, pi->conf.fqdn_peer_addr)); ++ l->state = PHYS_STATE_DOWN; ++ TcpDoClose(l); ++ PhysDown(l, STR_CON_FAILED, "failed to resolve peer name"); ++ return; ++ } + } + + u_addrcopy(&pi->conf.peer_addr.addr,&pi->peer_addr); +@@ -887,20 +896,22 @@ TcpSetCommand(Context ctx, int ac, const char *const a + Freee(*fqdn_peer_addr); + *fqdn_peer_addr = Mstrdup(MB_PHYS, av[0]); + } +- if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) +- return(-1); + if (ac > 1) { + if ((port = atoi(av[1])) < 0 || port > 0xffff) + return(-1); + } else { + port = 0; + } ++ if ((intptr_t)arg == SET_SELFADDR) ++ pi->conf.self_port = port; ++ else ++ pi->conf.peer_port = port; ++ if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) ++ return(-1); + if ((intptr_t)arg == SET_SELFADDR) { + pi->conf.self_addr = rng.addr; +- pi->conf.self_port = port; + } else { + pi->conf.peer_addr = rng; +- pi->conf.peer_port = port; + } + if (pi->If) { + TcpUnListen(ctx->lnk); +Index: src/udp.c +=================================================================== +--- src/udp.c (revision 2597) ++++ src/udp.c (revision 2598) +@@ -277,11 +277,17 @@ UdpOpen(Link l) + goto fail; + } + +- if ((!Enabled(&pi->conf.options, UDP_CONF_RESOLVE_ONCE)) && +- (pi->conf.fqdn_peer_addr != NULL)) { ++ if ((!Enabled(&pi->conf.options, UDP_CONF_RESOLVE_ONCE) || ++ u_addrempty(&pi->conf.peer_addr.addr)) && ++ (pi->conf.fqdn_peer_addr != NULL)) { + struct u_range rng; + if (ParseRange(pi->conf.fqdn_peer_addr, &rng, ALLOW_IPV4|ALLOW_IPV6)) + pi->conf.peer_addr = rng; ++ else { ++ Log(LG_PHYS, ("[%s] UDP: failed to resolve peer name: %s", ++ l->name, pi->conf.fqdn_peer_addr)); ++ goto fail; ++ } + } + + /* Bind socket */ +@@ -747,20 +753,22 @@ UdpSetCommand(Context ctx, int ac, const char *const a + Freee(*fqdn_peer_addr); + *fqdn_peer_addr = Mstrdup(MB_PHYS, av[0]); + } +- if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) +- return(-1); + if (ac > 1) { + if ((port = atoi(av[1])) < 0 || port > 0xffff) + return(-1); + } else { + port = 0; + } ++ if ((intptr_t)arg == SET_SELFADDR) ++ pi->conf.self_port = port; ++ else ++ pi->conf.peer_port = port; ++ if (ac < 1 || ac > 2 || !ParseRange(av[0], &rng, ALLOW_IPV4|ALLOW_IPV6)) ++ return(-1); + if ((intptr_t)arg == SET_SELFADDR) { + pi->conf.self_addr = rng.addr; +- pi->conf.self_port = port; + } else { + pi->conf.peer_addr = rng; +- pi->conf.peer_port = port; + } + if (pi->If) { + UdpUnListen(ctx->lnk);