mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-24 00:45:52 +00:00
MFH: r545507, r546343, r546946, r547867:
net/mpd5: import r2272 from upstream net/mpd5: improve logging in rare case of libpdel failure. net/mpd5: remove required_files from startup script net/mpd5: update to version 5.9 Approved by: ports-secteam Security: CVE-2020-7465, CVE-2020-7466
This commit is contained in:
parent
22d9b1f92f
commit
06884a2287
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/branches/2020Q3/; revision=547914
@ -2,8 +2,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= mpd
|
||||
DISTVERSION= 5.8
|
||||
PORTREVISION= 10
|
||||
DISTVERSION= 5.9
|
||||
CATEGORIES= net
|
||||
MASTER_SITES= SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION}
|
||||
PKGNAMESUFFIX= 5
|
||||
@ -35,7 +34,7 @@ RUN_DEPENDS+= /boot/modules/ng_ipacct.ko:net-mgmt/ng_ipacct
|
||||
.endif
|
||||
.else
|
||||
CONFIGURE_ENV+= USE_NG_IPACCT=no
|
||||
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-no-ng_ipacct
|
||||
MAKE_ARGS+= USE_NG_IPACCT=no
|
||||
.endif
|
||||
|
||||
USE_RC_SUBR= mpd5
|
||||
|
@ -1,2 +1,3 @@
|
||||
SIZE (mpd5/mpd-5.8.tar.gz) = 597043
|
||||
SHA256 (mpd5/mpd-5.8.tar.gz) = 8c59e01c79c5d35ecfd0d540ddf37dd1eed8da9c980fa4c5b01ed50bb53e7665
|
||||
TIMESTAMP = 1599406684
|
||||
SHA256 (mpd5/mpd-5.9.tar.gz) = 1f2cda9b3e610713f94e90f3826bbb0d638c6fb678986b1eaa9cd9930b0d66ba
|
||||
SIZE (mpd5/mpd-5.9.tar.gz) = 627566
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- src/Makefile.orig 2018-11-25 14:23:23.317174000 +0700
|
||||
+++ src/Makefile 2018-11-25 14:26:24.356555000 +0700
|
||||
@@ -56,7 +56,6 @@
|
||||
USE_NG_BPF= yes
|
||||
USE_NG_CAR= yes
|
||||
USE_NG_DEFLATE= yes
|
||||
-USE_NG_IPACCT= yes
|
||||
USE_NG_MPPC= yes
|
||||
USE_NG_NAT= yes
|
||||
USE_NG_NETFLOW= yes
|
@ -27,7 +27,6 @@ load_rc_config ${name}
|
||||
|
||||
pidfile="/var/run/${name}.pid"
|
||||
command="%%PREFIX%%/sbin/${name}"
|
||||
required_files="%%PREFIX%%/etc/${name}/mpd.conf"
|
||||
|
||||
case "${mpd_flags}" in
|
||||
*-p\ *)
|
||||
|
@ -1,23 +0,0 @@
|
||||
Index: configure
|
||||
===================================================================
|
||||
--- src/configure (revision 2259)
|
||||
+++ src/configure (working copy)
|
||||
@@ -33,7 +33,9 @@ else
|
||||
fi
|
||||
|
||||
echo -n "Looking for ng_ipacct ..."
|
||||
-if [ -e /usr/include/netgraph/ng_ipacct.h \
|
||||
+if [ "$USE_NG_IPACCT" = no ]; then
|
||||
+ echo " disabled."
|
||||
+else if [ -e /usr/include/netgraph/ng_ipacct.h \
|
||||
-o -e /usr/local/include/netgraph/ng_ipacct.h ]
|
||||
then
|
||||
echo " found."
|
||||
@@ -41,6 +43,7 @@ then
|
||||
else
|
||||
echo " not found."
|
||||
fi
|
||||
+fi
|
||||
|
||||
echo -n "Looking for ng_mppc ..."
|
||||
if [ -e /usr/include/netgraph/ng_mppc.h \
|
@ -1,76 +0,0 @@
|
||||
--- src/console.h.orig 2016-01-06 22:42:06.000000000 +0700
|
||||
+++ src/console.h 2017-06-16 21:12:59.268715000 +0700
|
||||
@@ -119,6 +119,7 @@
|
||||
extern int ConsoleStat(Context ctx, int ac, char *av[], void *arg);
|
||||
extern Context StdConsoleConnect(Console c);
|
||||
extern void ConsoleShutdown(Console c);
|
||||
+ extern void ConsoleCancelCleanup(void *rwlock);
|
||||
|
||||
extern int UserCommand(Context ctx, int ac, char *av[], void *arg);
|
||||
extern int UserStat(Context ctx, int ac, char *av[], void *arg);
|
||||
--- src/console.c.orig 2016-01-06 22:42:06.000000000 +0700
|
||||
+++ src/console.c 2017-06-16 21:54:48.919442000 +0700
|
||||
@@ -175,6 +175,14 @@ ConsoleClose(Console c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+void
|
||||
+ConsoleCancelCleanup(void *rwlock)
|
||||
+{
|
||||
+ pthread_rwlock_t p = (pthread_rwlock_t)rwlock;
|
||||
+
|
||||
+ RWLOCK_UNLOCK(p);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* ConsoleStat()
|
||||
*/
|
||||
@@ -192,13 +200,14 @@ ConsoleStat(Context ctx, int ac, char *a
|
||||
Printf("\tIP-Address : %s\r\n", u_addrtoa(&c->addr,addrstr,sizeof(addrstr)));
|
||||
Printf("\tPort : %d\r\n", c->port);
|
||||
|
||||
+ pthread_cleanup_push(ConsoleCancelCleanup, c->lock);
|
||||
RWLOCK_RDLOCK(c->lock);
|
||||
Printf("Active sessions:\r\n");
|
||||
SLIST_FOREACH(s, &c->sessions, next) {
|
||||
Printf("\tUsername: %s\tFrom: %s\r\n",
|
||||
s->user.username, u_addrtoa(&s->peer_addr,addrstr,sizeof(addrstr)));
|
||||
}
|
||||
- RWLOCK_UNLOCK(c->lock);
|
||||
+ pthread_cleanup_pop(1);
|
||||
|
||||
Printf("Global options:\r\n");
|
||||
OptStat(ctx, &c->options, gConfList);
|
||||
@@ -905,13 +914,14 @@ UserStat(Context ctx, int ac, char *av[]
|
||||
ConsoleUser u;
|
||||
|
||||
Printf("Configured users:\r\n");
|
||||
+ pthread_cleanup_push(ConsoleCancelCleanup, gUsersLock);
|
||||
RWLOCK_RDLOCK(gUsersLock);
|
||||
ghash_walk_init(gUsers, &walk);
|
||||
while ((u = ghash_walk_next(gUsers, &walk)) != NULL) {
|
||||
Printf("\tUsername: %-15s Priv: %s\r\n", u->username,
|
||||
((u->priv == 2)?"admin":((u->priv == 1)?"operator":"user")));
|
||||
}
|
||||
- RWLOCK_UNLOCK(gUsersLock);
|
||||
+ pthread_cleanup_pop(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- src/log.c.orig 2016-01-06 22:42:06.000000000 +0700
|
||||
+++ src/log.c 2017-06-16 21:16:19.643625000 +0700
|
||||
@@ -256,12 +256,13 @@ vLogPrintf(const char *fmt, va_list args
|
||||
#ifdef SYSLOG_FACILITY
|
||||
syslog(LOG_INFO, "%s", buf);
|
||||
#endif
|
||||
+ pthread_cleanup_push(ConsoleCancelCleanup, gConsole.lock);
|
||||
RWLOCK_RDLOCK(gConsole.lock);
|
||||
SLIST_FOREACH(s, &gConsole.sessions, next) {
|
||||
if (Enabled(&s->options, CONSOLE_LOGGING))
|
||||
s->write(s, "%s\r\n", buf);
|
||||
}
|
||||
- RWLOCK_UNLOCK(gConsole.lock);
|
||||
+ pthread_cleanup_pop(1);
|
||||
#ifdef SYSLOG_FACILITY
|
||||
} else {
|
||||
vsyslog(LOG_INFO, fmt, args);
|
@ -1,158 +0,0 @@
|
||||
Index: src/iface.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/mpd/mpd/src/iface.c,v
|
||||
retrieving revision 1.228
|
||||
retrieving revision 1.230
|
||||
diff -u -p -r1.228 -r1.230
|
||||
--- src/iface.c 17 May 2017 08:47:53 -0000 1.228
|
||||
+++ src/iface.c 1 Jul 2017 21:32:07 -0000 1.230
|
||||
@@ -141,6 +141,7 @@
|
||||
static int IfaceAllocACL (struct acl_pool ***ap, int start, char * ifname, int number);
|
||||
static int IfaceFindACL (struct acl_pool *ap, char * ifname, int number);
|
||||
static char * IfaceParseACL (char * src, IfaceState iface);
|
||||
+ static char * IfaceFixAclForDelete(char *r, char *buf, size_t len);
|
||||
#endif
|
||||
|
||||
static int IfaceSetName(Bund b, const char * ifname);
|
||||
@@ -602,18 +603,18 @@ IfaceUp(Bund b, int ready)
|
||||
while (acls != NULL) {
|
||||
/* allow both %aX and `peer_addr` macros */
|
||||
buf = IfaceParseACL(acls->rule, iface);
|
||||
- strcpy(acls->rule, buf);
|
||||
+ acl = Mdup2(MB_IPFW, acls, sizeof(struct acl), sizeof(struct acl) + strlen(buf));
|
||||
+ strcpy(acl->rule, buf);
|
||||
Freee(buf);
|
||||
- acl = Mdup(MB_IPFW, acls, sizeof(struct acl) + strlen(acls->rule));
|
||||
acl->next = iface->tables;
|
||||
iface->tables = acl;
|
||||
- if (strncmp(acls->rule, "peer_addr", 9) == 0) {
|
||||
+ if (strncmp(acl->rule, "peer_addr", 9) == 0) {
|
||||
char hisaddr[20];
|
||||
ExecCmd(LG_IFACE2, b->name, "%s table %d add %s",
|
||||
- PATH_IPFW, acls->real_number,
|
||||
+ PATH_IPFW, acl->real_number,
|
||||
u_addrtoa(&iface->peer_addr, hisaddr, sizeof(hisaddr)));
|
||||
} else {
|
||||
- ExecCmd(LG_IFACE2, b->name, "%s table %d add %s", PATH_IPFW, acls->real_number, acls->rule);
|
||||
+ ExecCmd(LG_IFACE2, b->name, "%s table %d add %s", PATH_IPFW, acl->real_number, acl->rule);
|
||||
}
|
||||
acls = acls->next;
|
||||
};
|
||||
@@ -697,8 +698,10 @@ IfaceDown(Bund b)
|
||||
PATH_IPFW, acl->real_number,
|
||||
u_addrtoa(&iface->peer_addr, hisaddr, sizeof(hisaddr)));
|
||||
} else {
|
||||
+ char buf[ACL_LEN];
|
||||
ExecCmd(LG_IFACE2, b->name, "%s table %d delete %s",
|
||||
- PATH_IPFW, acl->real_number, acl->rule);
|
||||
+ PATH_IPFW, acl->real_number,
|
||||
+ IfaceFixAclForDelete(acl->rule, buf, sizeof(buf)));
|
||||
}
|
||||
aclnext = acl->next;
|
||||
Freee(acl);
|
||||
@@ -946,6 +949,60 @@ IfaceParseACL (char * src, IfaceState if
|
||||
Freee(buf1);
|
||||
return(buf);
|
||||
}
|
||||
+
|
||||
+/*
|
||||
+ * IfaceFixAclForDelete()
|
||||
+ *
|
||||
+ * Removes values from ipfw 'table-key value [...]' expression r, if any.
|
||||
+ * Returns buf pointer for modified expression or original r pointer
|
||||
+ * if no modifications were performed when no values were found or
|
||||
+ * buf found too short.
|
||||
+ *
|
||||
+ * len is size of buf. Strings are zero-terminated.
|
||||
+ * r and buf must point to non-overlapping memory areas.
|
||||
+ */
|
||||
+
|
||||
+static char*
|
||||
+IfaceFixAclForDelete(char *r, char *buf, size_t len)
|
||||
+{
|
||||
+ static const char sep[] = " \t";
|
||||
+ char *limit, *s;
|
||||
+ int i, state = 0;
|
||||
+
|
||||
+/*
|
||||
+ * Possible state values:
|
||||
+ *
|
||||
+ * -1: skip value (otherwise copy);
|
||||
+ * 0: first iteration, do copy;
|
||||
+ * 1: not first iteration, do copy.
|
||||
+*/
|
||||
+
|
||||
+ s = buf;
|
||||
+ limit = buf + len;
|
||||
+
|
||||
+ for (r += strspn(r, sep); /* Skip leading spaces. */
|
||||
+ *r; /* Check for end of string. */
|
||||
+ r += i, r += strspn(r, sep)) /* Advance and skip spaces again. */
|
||||
+ {
|
||||
+ i = strcspn(r, sep); /* Find separator or end of string. */
|
||||
+ if (state == 0 && r[i] == '\0') /* No separators in the rule? */
|
||||
+ return r;
|
||||
+ if (state < 0) { /* Skip value. */
|
||||
+ state = 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (limit - s < i + 1 + state) /* Check space. */
|
||||
+ return r;
|
||||
+ if (state != 0) /* Insert separator. */
|
||||
+ *s++ = ' ';
|
||||
+ memcpy(s, r, i); /* Copy IP address from the rule. */
|
||||
+ s += i;
|
||||
+ state = -1;
|
||||
+ }
|
||||
+ *s = '\0';
|
||||
+
|
||||
+ return buf;
|
||||
+}
|
||||
#endif /* USE_IPFW */
|
||||
|
||||
/*
|
||||
Index: src/mbuf.c
|
||||
===================================================================
|
||||
RCS file: /cvsroot/mpd/mpd/src/mbuf.c,v
|
||||
retrieving revision 1.30
|
||||
retrieving revision 1.31
|
||||
diff -u -p -r1.30 -r1.31
|
||||
--- src/mbuf.c 14 Jun 2011 10:40:19 -0000 1.30
|
||||
+++ src/mbuf.c 29 Jun 2017 08:21:35 -0000 1.31
|
||||
@@ -55,6 +55,20 @@ Mdup(const char *type, const void *src,
|
||||
}
|
||||
|
||||
void *
|
||||
+Mdup2(const char *type, const void *src, size_t oldsize, size_t newsize)
|
||||
+{
|
||||
+ const char **memory;
|
||||
+ if ((memory = MALLOC(type, sizeof(char *) + newsize)) == NULL) {
|
||||
+ Perror("Mdup2: malloc");
|
||||
+ DoExit(EX_ERRDEAD);
|
||||
+ }
|
||||
+
|
||||
+ memory[0] = type;
|
||||
+ memcpy(memory + 1, src, oldsize < newsize ? oldsize : newsize);
|
||||
+ return(memory + 1);
|
||||
+}
|
||||
+
|
||||
+void *
|
||||
Mstrdup(const char *type, const void *src)
|
||||
{
|
||||
return (Mdup(type, src, strlen(src) + 1));
|
||||
Index: src/mbuf.h
|
||||
===================================================================
|
||||
RCS file: /cvsroot/mpd/mpd/src/mbuf.h,v
|
||||
retrieving revision 1.25
|
||||
retrieving revision 1.26
|
||||
diff -u -p -r1.25 -r1.26
|
||||
--- src/mbuf.h 7 Oct 2013 11:52:35 -0000 1.25
|
||||
+++ src/mbuf.h 29 Jun 2017 08:21:35 -0000 1.26
|
||||
@@ -73,6 +73,7 @@
|
||||
|
||||
extern void *Malloc(const char *type, size_t size) __malloc_like;
|
||||
extern void *Mdup(const char *type, const void *src, size_t size) __malloc_like;
|
||||
+ extern void *Mdup2(const char *type, const void *src, size_t oldsize, size_t newsize) __malloc_like;
|
||||
extern void *Mstrdup(const char *type, const void *src) __malloc_like;
|
||||
extern void Freee(void *ptr);
|
||||
|
@ -1,30 +0,0 @@
|
||||
Index: src/bund.c
|
||||
===================================================================
|
||||
--- src/bund.c (revision 2246)
|
||||
+++ src/bund.c (revision 2247)
|
||||
@@ -1394,9 +1394,9 @@ BundUpdateStats(Bund b)
|
||||
b->stats.runts += abs(stats.runts - b->oldStats.runts);
|
||||
b->stats.dupFragments += abs(stats.dupFragments - b->oldStats.dupFragments);
|
||||
b->stats.dropFragments += abs(stats.dropFragments - b->oldStats.dropFragments);
|
||||
+ b->oldStats = stats;
|
||||
}
|
||||
|
||||
- b->oldStats = stats;
|
||||
#else
|
||||
NgFuncGetStats64(b, l, &b->stats);
|
||||
#endif
|
||||
Index: src/link.c
|
||||
===================================================================
|
||||
--- src/link.c (revision 2246)
|
||||
+++ src/link.c (revision 2247)
|
||||
@@ -1359,9 +1359,9 @@ LinkUpdateStats(Link l)
|
||||
l->stats.runts += abs(stats.runts - l->oldStats.runts);
|
||||
l->stats.dupFragments += abs(stats.dupFragments - l->oldStats.dupFragments);
|
||||
l->stats.dropFragments += abs(stats.dropFragments - l->oldStats.dropFragments);
|
||||
+ l->oldStats = stats;
|
||||
}
|
||||
|
||||
- l->oldStats = stats;
|
||||
#else
|
||||
NgFuncGetStats64(l->bund, l->bundleIndex, &l->stats);
|
||||
#endif
|
@ -1,121 +0,0 @@
|
||||
Index: src/iface.h
|
||||
===================================================================
|
||||
--- src/iface.h (revision 2246)
|
||||
+++ src/iface.h (working copy)
|
||||
@@ -107,6 +107,7 @@
|
||||
u_char traffic[IFACE_IDLE_SPLIT]; /* Mark any traffic */
|
||||
u_short mtu; /* Interface MTU */
|
||||
u_short max_mtu; /* Configured maximum MTU */
|
||||
+ u_short mtu_override; /* Configured MTU override */
|
||||
struct optinfo options; /* Configuration options */
|
||||
u_int idle_timeout; /* Idle timeout */
|
||||
u_int session_timeout; /* Session timeout */
|
||||
Index: src/iface.c
|
||||
===================================================================
|
||||
--- src/iface.c (revision 2246)
|
||||
+++ src/iface.c (working copy)
|
||||
@@ -162,7 +162,7 @@
|
||||
IfaceSetCommand, NULL, 2, (void *) SET_ADDRS },
|
||||
{ "route {dest}[/{width}]", "Add IP route",
|
||||
IfaceSetCommand, NULL, 2, (void *) SET_ROUTE },
|
||||
- { "mtu {size}", "Set max allowed interface MTU",
|
||||
+ { "mtu {size} [override]", "Set max allowed or override interface MTU",
|
||||
IfaceSetCommand, NULL, 2, (void *) SET_MTU },
|
||||
{ "name [{name}]", "Set interface name",
|
||||
IfaceSetCommand, NULL, 2, (void *) SET_NAME },
|
||||
@@ -289,6 +289,7 @@ IfaceInit(Bund b)
|
||||
/* Default configuration */
|
||||
iface->mtu = NG_IFACE_MTU_DEFAULT;
|
||||
iface->max_mtu = NG_IFACE_MTU_DEFAULT;
|
||||
+ iface->mtu_override = 0;
|
||||
#ifdef SIOCSIFDESCR
|
||||
iface->ifdescr = NULL;
|
||||
iface->conf.ifdescr = NULL;
|
||||
@@ -1606,15 +1607,30 @@ IfaceSetCommand(Context ctx, int ac, cha
|
||||
case SET_MTU:
|
||||
{
|
||||
int max_mtu;
|
||||
+ int override;
|
||||
|
||||
/* Check */
|
||||
- if (ac != 1)
|
||||
+ if (ac < 1 || ac > 2)
|
||||
return(-1);
|
||||
|
||||
max_mtu = atoi(av[0]);
|
||||
+ override = 0;
|
||||
+
|
||||
+ if (ac == 2 && av[1][0]) {
|
||||
+ if (strcmp(av[1], "override") == 0)
|
||||
+ override = 1;
|
||||
+ else
|
||||
+ Error("Invalid keyword %s", av[1]);
|
||||
+ }
|
||||
+
|
||||
if (max_mtu < IFACE_MIN_MTU || max_mtu > IFACE_MAX_MTU)
|
||||
- Error("Invalid interface mtu %d", max_mtu);
|
||||
- iface->max_mtu = max_mtu;
|
||||
+ if (!override || max_mtu != 0)
|
||||
+ Error("Invalid interface mtu %d", max_mtu);
|
||||
+
|
||||
+ if (max_mtu != 0)
|
||||
+ iface->max_mtu = max_mtu;
|
||||
+ if (override)
|
||||
+ iface->mtu_override = max_mtu;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1743,6 +1759,7 @@ IfaceStat(Context ctx, int ac, char *av[
|
||||
Printf("\tGroup : %s\r\n", iface->conf.ifgroup);
|
||||
#endif
|
||||
Printf("\tMaximum MTU : %d bytes\r\n", iface->max_mtu);
|
||||
+ Printf("\tMTU override : %d bytes\r\n", iface->mtu_override);
|
||||
Printf("\tIdle timeout : %d seconds\r\n", iface->idle_timeout);
|
||||
Printf("\tSession timeout : %d seconds\r\n", iface->session_timeout);
|
||||
if (!u_rangeempty(&iface->conf.self_addr)) {
|
||||
@@ -1873,14 +1890,18 @@ IfaceSetMTU(Bund b, int mtu)
|
||||
return;
|
||||
}
|
||||
|
||||
- if ((b->params.mtu > 0) && (mtu > b->params.mtu)) {
|
||||
+ if (!iface->mtu_override && (b->params.mtu > 0) && (mtu > b->params.mtu)) {
|
||||
mtu = b->params.mtu;
|
||||
Log(LG_IFACE2, ("[%s] IFACE: forcing MTU of auth backend: %d bytes",
|
||||
b->name, mtu));
|
||||
}
|
||||
|
||||
- /* Limit MTU to configured maximum */
|
||||
- if (mtu > iface->max_mtu)
|
||||
+ /* Limit MTU to configured maximum/override */
|
||||
+ if (iface->mtu_override) {
|
||||
+ mtu = iface->mtu_override;
|
||||
+ Log(LG_IFACE2, ("[%s] IFACE: forcing MTU override: %d bytes",
|
||||
+ b->name, mtu));
|
||||
+ } else if (mtu > iface->max_mtu)
|
||||
mtu = iface->max_mtu;
|
||||
|
||||
/* Set MTU on interface */
|
||||
@@ -3061,6 +3082,9 @@ IfaceSetupMSS(Bund b, uint16_t maxMSS)
|
||||
memset(&tcpmsscfg, 0, sizeof(tcpmsscfg));
|
||||
tcpmsscfg.maxMSS = maxMSS;
|
||||
|
||||
+ Log(LG_IFACE2, ("[%s] IFACE: Configuring ng_tcpmss %s %u",
|
||||
+ b->name, path, (unsigned)tcpmsscfg.maxMSS));
|
||||
+
|
||||
snprintf(tcpmsscfg.inHook, sizeof(tcpmsscfg.inHook), "in");
|
||||
snprintf(tcpmsscfg.outHook, sizeof(tcpmsscfg.outHook), "out");
|
||||
if (NgSendMsg(gLinksCsock, path, NGM_TCPMSS_COOKIE, NGM_TCPMSS_CONFIG,
|
||||
Index: src/bund.c
|
||||
===================================================================
|
||||
--- src/bund.c (revision 2253)
|
||||
+++ src/bund.c (revision 2254)
|
||||
@@ -328,7 +328,8 @@ BundJoin(Link l)
|
||||
|
||||
/* Configure this link */
|
||||
b->pppConfig.links[l->bundleIndex].enableLink = 1;
|
||||
- b->pppConfig.links[l->bundleIndex].mru = lcp->peer_mru;
|
||||
+ b->pppConfig.links[l->bundleIndex].mru = b->iface.mtu_override ?
|
||||
+ b->iface.mtu_override : lcp->peer_mru;
|
||||
b->pppConfig.links[l->bundleIndex].enableACFComp = lcp->peer_acfcomp;
|
||||
b->pppConfig.links[l->bundleIndex].enableProtoComp = lcp->peer_protocomp;
|
||||
b->pppConfig.links[l->bundleIndex].bandwidth =
|
@ -1,279 +0,0 @@
|
||||
--- src/Makefile.orig
|
||||
+++ src/Makefile
|
||||
@@ -9,11 +9,12 @@
|
||||
|
||||
PROG?= mpd5
|
||||
PREFIX?= /usr/local
|
||||
+LOCALBASE?= ${PREFIX}
|
||||
BINDIR?= ${PREFIX}/sbin
|
||||
VERSION= 5.8
|
||||
-NOMAN=
|
||||
-NO_MAN=
|
||||
|
||||
+MAN=
|
||||
+
|
||||
BINOWN!= /usr/bin/id -n -u
|
||||
BINGRP!= /usr/bin/id -n -g
|
||||
|
||||
@@ -59,9 +60,6 @@
|
||||
USE_AUTH_PAM= yes
|
||||
USE_AUTH_SYSTEM= yes
|
||||
|
||||
-# Build with builtin libpdel
|
||||
-NOLIBPDEL= yes
|
||||
-
|
||||
# Build without builtin web server.
|
||||
#NOWEB= yes
|
||||
|
||||
@@ -71,7 +69,7 @@
|
||||
|
||||
# Print wide protocol names instead of short names.
|
||||
# Comment this line, to save about 10 KB space
|
||||
-COPTS+= -DPROTO_NAME_LIST
|
||||
+CFLAGS+= -DPROTO_NAME_LIST
|
||||
|
||||
# Reduce some internal structures size to save more memory
|
||||
# This is to limit amount of active sessions
|
||||
@@ -83,27 +81,27 @@
|
||||
## filter TCP accept connections
|
||||
LDADD+= -lwrap
|
||||
DPADD+= ${LIBWRAP}
|
||||
-COPTS+= -DUSE_WRAP
|
||||
+CFLAGS+= -DUSE_WRAP
|
||||
.endif
|
||||
|
||||
## authentication methods: opie, pam, /etc/password
|
||||
.if defined ( USE_AUTH_OPIE )
|
||||
LDADD+= -lopie
|
||||
DPADD+= ${LIBOPIE}
|
||||
-COPTS+= -DUSE_OPIE
|
||||
+CFLAGS+= -DUSE_OPIE
|
||||
.endif
|
||||
|
||||
.if exists ( /usr/lib/libpam.so ) && defined ( USE_AUTH_PAM )
|
||||
LDADD+= -lpam
|
||||
DPADD+= ${LIBPAM}
|
||||
-COPTS+= -DUSE_PAM
|
||||
+CFLAGS+= -DUSE_PAM
|
||||
.endif
|
||||
|
||||
.if defined ( USE_AUTH_SYSTEM )
|
||||
## based on /etc/password
|
||||
LDADD+= -lcrypt
|
||||
DPADD+= ${LIBCRYPT} ${LIBUTIL}
|
||||
-COPTS+= -DUSE_SYSTEM
|
||||
+CFLAGS+= -DUSE_SYSTEM
|
||||
.endif
|
||||
|
||||
LDADD+= -lnetgraph -lutil
|
||||
@@ -112,19 +110,12 @@
|
||||
LDADD+= -L/usr/lib -lradius
|
||||
DPADD+= ${LIBRADIUS}
|
||||
|
||||
-## libpdel needs ssl and libexpat (libxml2 cannot be used)
|
||||
-.if !defined ( NOLIBPDEL )
|
||||
-LDADD+= -L${PREFIX}/lib
|
||||
-LDADD+= -lpdel
|
||||
-LDADD+= -lexpat
|
||||
-.endif
|
||||
-
|
||||
MPD_VERSION!= echo -n "${VERSION} (`id -un`@`uname -n` `LC_TIME=C date +'%R %v'`)"
|
||||
|
||||
-COPTS+= -DPATH_CONF_DIR='"${MPD_CONF_DIR}"'
|
||||
-COPTS+= -DMPD_VERSION='"${MPD_VERSION}"'
|
||||
-COPTS+= -g
|
||||
-COPTS+= -Wall \
|
||||
+CFLAGS+= -DPATH_CONF_DIR='"${MPD_CONF_DIR}"'
|
||||
+CFLAGS+= -DMPD_VERSION='"${MPD_VERSION}"'
|
||||
+CFLAGS+= -g
|
||||
+CFLAGS+= -Wall \
|
||||
-Wcast-align \
|
||||
-Wchar-subscripts \
|
||||
-Wformat \
|
||||
@@ -134,15 +125,14 @@
|
||||
-Wnested-externs \
|
||||
-Wpointer-arith \
|
||||
-Wwrite-strings \
|
||||
- -pthread \
|
||||
- -I${PREFIX}/include
|
||||
+ -pthread
|
||||
|
||||
.if defined ( MPD_VENDOR )
|
||||
-COPTS+= -DMPD_VENDOR='"${MPD_VENDOR}"'
|
||||
+CFLAGS+= -DMPD_VENDOR='"${MPD_VENDOR}"'
|
||||
.endif
|
||||
|
||||
.if defined ( SYSLOG_FACILITY )
|
||||
-COPTS+= -DSYSLOG_FACILITY='"${SYSLOG_FACILITY}"'
|
||||
+CFLAGS+= -DSYSLOG_FACILITY='"${SYSLOG_FACILITY}"'
|
||||
.endif
|
||||
|
||||
# Standard sources
|
||||
@@ -154,14 +144,13 @@
|
||||
util.c vars.c eap.c msoft.c ippool.c
|
||||
|
||||
.if defined ( NOWEB )
|
||||
-COPTS+= -DNOWEB
|
||||
+CFLAGS+= -DNOWEB
|
||||
.else
|
||||
STDSRCS+= web.c
|
||||
LDADD+= -lssl
|
||||
.endif
|
||||
|
||||
-.if defined ( NOLIBPDEL )
|
||||
-COPTS+= -DNOLIBPDEL -I./contrib/libpdel
|
||||
+CFLAGS+= -DNOLIBPDEL -I./contrib/libpdel
|
||||
PDPATH1= contrib/libpdel/util:contrib/libpdel/structs
|
||||
PDPATH2= contrib/libpdel/structs/type
|
||||
.if defined ( NOWEB )
|
||||
@@ -199,60 +188,59 @@
|
||||
string_fp.c \
|
||||
timeout_fp.c
|
||||
.endif
|
||||
-.endif
|
||||
|
||||
# Add sources and flags for the various physical layer types
|
||||
|
||||
.if defined ( PHYSTYPE_MODEM )
|
||||
SRCS+= modem.c chat.c
|
||||
-COPTS+= -DPHYSTYPE_MODEM
|
||||
+CFLAGS+= -DPHYSTYPE_MODEM
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_UDP )
|
||||
SRCS+= udp.c
|
||||
-COPTS+= -DPHYSTYPE_UDP
|
||||
+CFLAGS+= -DPHYSTYPE_UDP
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_TCP )
|
||||
SRCS+= tcp.c
|
||||
-COPTS+= -DPHYSTYPE_TCP
|
||||
+CFLAGS+= -DPHYSTYPE_TCP
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_NG_SOCKET )
|
||||
SRCS+= ng.c
|
||||
-COPTS+= -DPHYSTYPE_NG_SOCKET
|
||||
+CFLAGS+= -DPHYSTYPE_NG_SOCKET
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_PPTP )
|
||||
SRCS+= pptp.c pptp_ctrl.c
|
||||
-COPTS+= -DPHYSTYPE_PPTP
|
||||
-COPTS+= -DRANDOMIZE_CID
|
||||
-#COPTS+= -DLOOK_LIKE_NT
|
||||
+CFLAGS+= -DPHYSTYPE_PPTP
|
||||
+CFLAGS+= -DRANDOMIZE_CID
|
||||
+#CFLAGS+= -DLOOK_LIKE_NT
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_PPPOE )
|
||||
SRCS+= pppoe.c
|
||||
-COPTS+= -DPHYSTYPE_PPPOE
|
||||
+CFLAGS+= -DPHYSTYPE_PPPOE
|
||||
.endif
|
||||
.if defined ( PHYSTYPE_L2TP )
|
||||
SRCS+= l2tp.c l2tp_avp.c l2tp_ctrl.c
|
||||
-COPTS+= -DPHYSTYPE_L2TP
|
||||
+CFLAGS+= -DPHYSTYPE_L2TP
|
||||
.endif
|
||||
|
||||
# CCP
|
||||
|
||||
.if defined ( CCP_DEFLATE ) && defined ( USE_NG_DEFLATE )
|
||||
SRCS+= ccp_deflate.c
|
||||
-COPTS+= -DCCP_DEFLATE
|
||||
-COPTS+= -DUSE_NG_DEFLATE
|
||||
+CFLAGS+= -DCCP_DEFLATE
|
||||
+CFLAGS+= -DUSE_NG_DEFLATE
|
||||
.endif
|
||||
|
||||
.if defined ( CCP_MPPC ) && defined ( USE_NG_MPPC )
|
||||
SRCS+= ccp_mppc.c
|
||||
-COPTS+= -DCCP_MPPC
|
||||
-COPTS+= -DUSE_NG_MPPC
|
||||
+CFLAGS+= -DCCP_MPPC
|
||||
+CFLAGS+= -DUSE_NG_MPPC
|
||||
.endif
|
||||
|
||||
.if defined ( CCP_PRED1 )
|
||||
SRCS+= ccp_pred1.c
|
||||
-COPTS+= -DCCP_PRED1
|
||||
+CFLAGS+= -DCCP_PRED1
|
||||
.if defined ( USE_NG_PRED1 )
|
||||
-COPTS+= -DUSE_NG_PRED1
|
||||
+CFLAGS+= -DUSE_NG_PRED1
|
||||
.endif
|
||||
.endif
|
||||
|
||||
@@ -261,46 +249,46 @@
|
||||
.if defined ( ECP_DES )
|
||||
SRCS+= ecp_dese.c
|
||||
SRCS+= ecp_dese_bis.c
|
||||
-COPTS+= -DECP_DES
|
||||
+CFLAGS+= -DECP_DES
|
||||
NEED_DES= yes
|
||||
.endif
|
||||
|
||||
# Features
|
||||
|
||||
.if defined ( USE_NG_BPF )
|
||||
-COPTS+= -DUSE_NG_BPF
|
||||
+CFLAGS+= -DUSE_NG_BPF
|
||||
LDADD+= -lpcap
|
||||
DPADD+= ${LIBPCAP}
|
||||
.endif
|
||||
.if defined ( USE_NG_CAR )
|
||||
-COPTS+= -DUSE_NG_CAR
|
||||
+CFLAGS+= -DUSE_NG_CAR
|
||||
.endif
|
||||
.if defined ( USE_NG_IPACCT )
|
||||
-COPTS+= -DUSE_NG_IPACCT
|
||||
+CFLAGS+= -DUSE_NG_IPACCT -nostdinc -I/usr/include -I${LOCALBASE}/include
|
||||
.endif
|
||||
.if defined ( USE_NG_NAT )
|
||||
SRCS+= nat.c
|
||||
-COPTS+= -DUSE_NG_NAT
|
||||
+CFLAGS+= -DUSE_NG_NAT
|
||||
.endif
|
||||
.if defined ( USE_NG_NETFLOW )
|
||||
-COPTS+= -DUSE_NG_NETFLOW
|
||||
+CFLAGS+= -DUSE_NG_NETFLOW
|
||||
.endif
|
||||
.if defined ( USE_NG_TCPMSS )
|
||||
-COPTS+= -DUSE_NG_TCPMSS
|
||||
+CFLAGS+= -DUSE_NG_TCPMSS
|
||||
.endif
|
||||
.if defined ( USE_NG_VJC )
|
||||
-COPTS+= -DUSE_NG_VJC
|
||||
+CFLAGS+= -DUSE_NG_VJC
|
||||
.endif
|
||||
.if defined ( USE_IPFW )
|
||||
-COPTS+= -DUSE_IPFW
|
||||
+CFLAGS+= -DUSE_IPFW
|
||||
.endif
|
||||
.if defined ( USE_FETCH )
|
||||
-COPTS+= -DUSE_FETCH
|
||||
+CFLAGS+= -DUSE_FETCH
|
||||
LDADD+= -lfetch
|
||||
DPADD+= ${LIBFETCH}
|
||||
.endif
|
||||
.if defined ( SMALL_SYSTEM )
|
||||
-COPTS+= -DSMALL_SYSTEM
|
||||
+CFLAGS+= -DSMALL_SYSTEM
|
||||
.endif
|
||||
|
||||
# Add in required support files and libraries
|
||||
@@ -309,15 +297,12 @@
|
||||
|
||||
.if exists ( /usr/lib/libexecinfo.so )
|
||||
LDADD+= -lexecinfo
|
||||
-COPTS+= -DUSE_BACKTRACE
|
||||
+CFLAGS+= -DUSE_BACKTRACE
|
||||
.endif
|
||||
|
||||
# Now add standard sources
|
||||
|
||||
SRCS+= ${STDSRCS}
|
||||
-
|
||||
-.if defined ( NOLIBPDEL )
|
||||
SRCS+= ${PDELSRCS}
|
||||
-.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
@ -1,126 +0,0 @@
|
||||
--- src/pppoe.c.orig 2016-01-06 15:42:06 UTC
|
||||
+++ src/pppoe.c
|
||||
@@ -71,6 +71,7 @@
|
||||
|
||||
/* Per link private info */
|
||||
struct pppoeinfo {
|
||||
+ char iface[IFNAMSIZ]; /* PPPoE interface name */
|
||||
char path[MAX_PATH]; /* PPPoE node path */
|
||||
char hook[NG_HOOKSIZ]; /* hook on that node */
|
||||
char session[MAX_SESSION]; /* session name */
|
||||
@@ -165,7 +166,7 @@ static int PppoeListen(Link l);
|
||||
static int PppoeUnListen(Link l);
|
||||
static void PppoeNodeUpdate(Link l);
|
||||
static void PppoeListenEvent(int type, void *arg);
|
||||
-static int CreatePppoeNode(struct PppoeIf *PIf, const char *path, const char *hook);
|
||||
+static int CreatePppoeNode(struct PppoeIf *PIf, const char *iface, const char *path, const char *hook);
|
||||
|
||||
static void PppoeDoClose(Link l);
|
||||
|
||||
@@ -282,6 +283,7 @@ PppoeInit(Link l)
|
||||
pe = (PppoeInfo)(l->info = Malloc(MB_PHYS, sizeof(*pe)));
|
||||
pe->incoming = 0;
|
||||
pe->opened = 0;
|
||||
+ snprintf(pe->iface, sizeof(pe->iface), "undefined");
|
||||
snprintf(pe->path, sizeof(pe->path), "undefined:");
|
||||
snprintf(pe->hook, sizeof(pe->hook), "undefined");
|
||||
snprintf(pe->session, sizeof(pe->session), "*");
|
||||
@@ -660,6 +662,16 @@ PppoeCtrlReadEvent(int type, void *arg)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
+#ifdef NGM_PPPOE_PADM_COOKIE
|
||||
+ case NGM_PPPOE_HURL:
|
||||
+ Log(LG_PHYS, ("PPPoE: rec'd HURL \"%s\"",
|
||||
+ ((struct ngpppoe_padm *)u.resp.data)->msg));
|
||||
+ break;
|
||||
+ case NGM_PPPOE_MOTM:
|
||||
+ Log(LG_PHYS, ("PPPoE: rec'd MOTM \"%s\"",
|
||||
+ ((struct ngpppoe_padm *)u.resp.data)->msg));
|
||||
+ break;
|
||||
+#endif
|
||||
default:
|
||||
Log(LG_PHYS, ("PPPoE: rec'd command %lu from \"%s\"",
|
||||
(u_long)u.resp.header.cmd, path));
|
||||
@@ -695,6 +707,7 @@ PppoeStat(Context ctx)
|
||||
}
|
||||
|
||||
Printf("PPPoE configuration:\r\n");
|
||||
+ Printf("\tIface Name : %s\r\n", pe->iface);
|
||||
Printf("\tIface Node : %s\r\n", pe->path);
|
||||
Printf("\tIface Hook : %s\r\n", pe->hook);
|
||||
Printf("\tSession : %s\r\n", pe->session);
|
||||
@@ -748,12 +761,8 @@ static int
|
||||
PppoePeerIface(Link l, void *buf, size_t buf_len)
|
||||
{
|
||||
PppoeInfo const pppoe = (PppoeInfo)l->info;
|
||||
- char iface[IFNAMSIZ];
|
||||
|
||||
- strlcpy(iface, pppoe->path, sizeof(iface));
|
||||
- if (iface[strlen(iface) - 1] == ':')
|
||||
- iface[strlen(iface) - 1] = '\0';
|
||||
- strlcpy(buf, iface, buf_len);
|
||||
+ strlcpy(buf, pppoe->iface, buf_len);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -880,7 +889,7 @@ PppoeGetMru(Link l, int conf)
|
||||
}
|
||||
|
||||
static int
|
||||
-CreatePppoeNode(struct PppoeIf *PIf, const char *path, const char *hook)
|
||||
+CreatePppoeNode(struct PppoeIf *PIf, const char *iface, const char *path, const char *hook)
|
||||
{
|
||||
union {
|
||||
u_char buf[sizeof(struct ng_mesg) + 2048];
|
||||
@@ -892,11 +901,6 @@ CreatePppoeNode(struct PppoeIf *PIf, con
|
||||
uint32_t f;
|
||||
|
||||
/* Make sure interface is up. */
|
||||
- char iface[IFNAMSIZ];
|
||||
-
|
||||
- strlcpy(iface, path, sizeof(iface));
|
||||
- if (iface[strlen(iface) - 1] == ':')
|
||||
- iface[strlen(iface) - 1] = '\0';
|
||||
if (ExecCmdNosh(LG_PHYS2, iface, "%s %s up", _PATH_IFCONFIG, iface) != 0) {
|
||||
Log(LG_ERR, ("PPPoE: can't bring up interface %s",
|
||||
iface));
|
||||
@@ -1501,7 +1505,7 @@ PppoeGetNode(Link l)
|
||||
l->name));
|
||||
return;
|
||||
}
|
||||
- if (CreatePppoeNode(&PppoeIfs[free], pi->path, pi->hook)) {
|
||||
+ if (CreatePppoeNode(&PppoeIfs[free], pi->iface, pi->path, pi->hook)) {
|
||||
strlcpy(PppoeIfs[free].ifnodepath,
|
||||
pi->path,
|
||||
sizeof(PppoeIfs[free].ifnodepath));
|
||||
@@ -1673,7 +1677,7 @@ PppoeSetCommand(Context ctx, int ac, cha
|
||||
{
|
||||
const PppoeInfo pi = (PppoeInfo) ctx->lnk->info;
|
||||
const char *hookname = ETHER_DEFAULT_HOOK;
|
||||
- const char *colon;
|
||||
+ int i;
|
||||
#ifdef NGM_PPPOE_SETMAXP_COOKIE
|
||||
int ap;
|
||||
#endif
|
||||
@@ -1684,9 +1688,17 @@ PppoeSetCommand(Context ctx, int ac, cha
|
||||
hookname = av[1];
|
||||
/* fall through */
|
||||
case 1:
|
||||
- colon = (av[0][strlen(av[0]) - 1] == ':') ? "" : ":";
|
||||
- snprintf(pi->path, sizeof(pi->path),
|
||||
- "%s%s", av[0], colon);
|
||||
+ strlcpy(pi->iface, av[0], sizeof(pi->iface));
|
||||
+ strlcpy(pi->path, pi->iface, sizeof(pi->path) - 1);
|
||||
+ for (i = 0; i < sizeof(pi->path) - 1; i++) {
|
||||
+ if (pi->path[i] == '.' || pi->path[i] == ':')
|
||||
+ pi->path[i] = '_';
|
||||
+ else if (pi->path[i] == '\0') {
|
||||
+ pi->path[i] = ':';
|
||||
+ pi->path[i + 1] = '\0';
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
strlcpy(pi->hook, hookname, sizeof(pi->hook));
|
||||
break;
|
||||
default:
|
Loading…
Reference in New Issue
Block a user