diff options
author | Renato Botelho <garga@FreeBSD.org> | 2015-12-31 17:13:42 -0200 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2015-12-31 17:13:42 -0200 |
commit | 3a71c8b0fad8f6a21abb231eccf666bd21a5041f (patch) | |
tree | bba53267df33d97b5625d40d3fd6ad1a6ae0a7f1 | |
parent | f5bdd559139a09b8d1849c3585830aba1b41d66e (diff) | |
download | FreeBSD-ports-END-OF-2015Q4.zip FreeBSD-ports-END-OF-2015Q4.tar.gz |
Update mpd5 to last patch from https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=203695END-OF-2015Q4
-rw-r--r-- | net/mpd5/Makefile | 16 | ||||
-rw-r--r-- | net/mpd5/files/rfc4638/patch-src_bund.c | 11 | ||||
-rw-r--r-- | net/mpd5/files/rfc4638/patch-src_lcp.c | 26 | ||||
-rw-r--r-- | net/mpd5/files/rfc4638/patch-src_phys.c | 55 | ||||
-rw-r--r-- | net/mpd5/files/rfc4638/patch-src_phys.h | 20 | ||||
-rw-r--r-- | net/mpd5/files/rfc4638/patch-src_pppoe.c | 234 | ||||
-rw-r--r-- | net/mpd5/pkg-descr | 17 |
7 files changed, 362 insertions, 17 deletions
diff --git a/net/mpd5/Makefile b/net/mpd5/Makefile index 8d0bccc..e47bd41 100644 --- a/net/mpd5/Makefile +++ b/net/mpd5/Makefile @@ -3,7 +3,7 @@ PORTNAME= mpd DISTVERSION= 5.7 -PORTREVISION= 3 +PORTREVISION= 5 CATEGORIES= net MASTER_SITES= SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION} PKGNAMESUFFIX= 5 @@ -12,6 +12,8 @@ DIST_SUBDIR= mpd5 MAINTAINER= mav@FreeBSD.org COMMENT= Multi-link PPP daemon based on netgraph(4) +LICENSE= BSD3CLAUSE + OPTIONS_DEFINE= NG_IPACCT NG_IPACCT_DESC= Use ng_ipacct kernel module from port @@ -43,4 +45,16 @@ PLIST_FILES= ${CONFSUF:S/^/etc\/mpd5\/mpd./:S/$/.sample/} sbin/mpd5 PLIST_FILES+= man/man8/mpd5.8.gz .endif +# RFC 4638 support - requires kernel support introduced in: +# FreeBSD 10.x base r288918 (${OSVERSION} bumped to 1002501 in base r289005) +# FreeBSD 11.x and later base r287654 (${OSVERSION} bumped to 1100080 in base r288943) +.if (${OPSYS} == FreeBSD && ((${OSVERSION} >= 1002501 && ${OSVERSION} < 1100000) || ${OSVERSION} >= 1100080)) +EXTRA_PATCHES+= ${PATCHDIR}/rfc4638/patch-src_bund.c +EXTRA_PATCHES+= ${PATCHDIR}/rfc4638/patch-src_lcp.c +EXTRA_PATCHES+= ${PATCHDIR}/rfc4638/patch-src_phys.c +EXTRA_PATCHES+= ${PATCHDIR}/rfc4638/patch-src_phys.h +EXTRA_PATCHES+= ${PATCHDIR}/rfc4638/patch-src_pppoe.c +COMMENT+= (with RFC 4638 support) +.endif + .include <bsd.port.mk> diff --git a/net/mpd5/files/rfc4638/patch-src_bund.c b/net/mpd5/files/rfc4638/patch-src_bund.c new file mode 100644 index 0000000..0eb6859 --- /dev/null +++ b/net/mpd5/files/rfc4638/patch-src_bund.c @@ -0,0 +1,11 @@ +--- src/bund.c.orig 2013-06-11 09:00:00 UTC ++++ src/bund.c +@@ -891,7 +891,7 @@ BundUpdateParams(Bund b) + + } else if (!b->peer_mrru) { /* If no multilink, use peer MRU */ + mtu = MIN(b->links[the_link]->lcp.peer_mru, +- b->links[the_link]->type->mtu); ++ PhysGetMtu(b->links[the_link], 0)); + + } else { /* Multilink, use peer MRRU */ + mtu = MIN(b->peer_mrru, MP_MAX_MRRU); diff --git a/net/mpd5/files/rfc4638/patch-src_lcp.c b/net/mpd5/files/rfc4638/patch-src_lcp.c new file mode 100644 index 0000000..4e9cc83 --- /dev/null +++ b/net/mpd5/files/rfc4638/patch-src_lcp.c @@ -0,0 +1,26 @@ +--- src/lcp.c.orig 2013-06-11 09:00:00 UTC ++++ src/lcp.c +@@ -226,10 +226,10 @@ LcpConfigure(Fsm fp) + lcp->peer_reject = 0; + + /* Initialize normal LCP stuff */ +- lcp->peer_mru = l->conf.mtu; +- lcp->want_mru = l->conf.mru; +- if (l->type && (lcp->want_mru > l->type->mru)) +- lcp->want_mru = l->type->mru; ++ lcp->peer_mru = PhysGetMtu(l, 1); ++ lcp->want_mru = PhysGetMru(l, 1); ++ if (l->type && (lcp->want_mru > PhysGetMru(l, 0))) ++ lcp->want_mru = PhysGetMru(l, 0); + lcp->peer_accmap = 0xffffffff; + lcp->want_accmap = l->conf.accmap; + lcp->peer_acfcomp = FALSE; +@@ -793,7 +793,7 @@ LcpDecodeConfig(Fsm fp, FsmOption list, + + /* If we have got request, forget the previous values */ + if (mode == MODE_REQ) { +- lcp->peer_mru = l->conf.mtu; ++ lcp->peer_mru = PhysGetMtu(l, 1); + lcp->peer_accmap = 0xffffffff; + lcp->peer_acfcomp = FALSE; + lcp->peer_protocomp = FALSE; diff --git a/net/mpd5/files/rfc4638/patch-src_phys.c b/net/mpd5/files/rfc4638/patch-src_phys.c new file mode 100644 index 0000000..084b71a --- /dev/null +++ b/net/mpd5/files/rfc4638/patch-src_phys.c @@ -0,0 +1,55 @@ +--- src/phys.c.orig 2013-06-11 09:00:00 UTC ++++ src/phys.c +@@ -466,6 +466,52 @@ PhysGetCalledNum(Link l, char *buf, size + } + + /* ++ * PhysGetMtu() ++ */ ++ ++u_short ++PhysGetMtu(Link l, int conf) ++{ ++ PhysType const pt = l->type; ++ ++ if (pt) { ++ if (pt->getmtu) ++ return ((*pt->getmtu)(l, conf)); ++ if (conf == 0) { ++ if (pt->mtu) ++ return (pt->mtu); ++ else ++ return (0); ++ } else ++ return (l->conf.mtu); ++ } else ++ return (0); ++} ++ ++/* ++ * PhysGetMru() ++ */ ++ ++u_short ++PhysGetMru(Link l, int conf) ++{ ++ PhysType const pt = l->type; ++ ++ if (pt) { ++ if (pt->getmru) ++ return ((*pt->getmru)(l, conf)); ++ if (conf == 0) { ++ if (pt->mru) ++ return (pt->mru); ++ else ++ return (0); ++ } else ++ return (l->conf.mru); ++ } else ++ return (0); ++} ++ ++/* + * PhysIsBusy() + * + * This returns 1 if link is busy diff --git a/net/mpd5/files/rfc4638/patch-src_phys.h b/net/mpd5/files/rfc4638/patch-src_phys.h new file mode 100644 index 0000000..b6a856b --- /dev/null +++ b/net/mpd5/files/rfc4638/patch-src_phys.h @@ -0,0 +1,20 @@ +--- src/phys.h.orig 2013-06-11 09:00:00 UTC ++++ src/phys.h +@@ -64,6 +64,8 @@ + /* returns the calling number (IP, MAC, whatever) */ + int (*callednum)(Link l, void *buf, size_t buf_len); + /* returns the called number (IP, MAC, whatever) */ ++ u_short (*getmtu)(Link l, int conf); /* returns actual MTU */ ++ u_short (*getmru)(Link l, int conf); /* returns actual MRU */ + }; + typedef struct phystype *PhysType; + +@@ -99,6 +101,8 @@ + extern int PhysGetPeerIface(Link l, char *buf, size_t buf_len); + extern int PhysGetCallingNum(Link l, char *buf, size_t buf_len); + extern int PhysGetCalledNum(Link l, char *buf, size_t buf_len); ++ extern u_short PhysGetMtu(Link l, int conf); ++ extern u_short PhysGetMru(Link l, int conf); + extern int PhysIsBusy(Link l); + + extern int PhysInit(Link l); diff --git a/net/mpd5/files/rfc4638/patch-src_pppoe.c b/net/mpd5/files/rfc4638/patch-src_pppoe.c new file mode 100644 index 0000000..95dc95c --- /dev/null +++ b/net/mpd5/files/rfc4638/patch-src_pppoe.c @@ -0,0 +1,234 @@ +--- src/pppoe.c.orig 2013-06-11 09:00:00 UTC ++++ src/pppoe.c +@@ -50,12 +50,14 @@ struct pppoeinfo { + char hook[NG_HOOKSIZ]; /* hook on that node */ + char session[MAX_SESSION]; /* session name */ + char acname[PPPOE_SERVICE_NAME_SIZE]; /* AC name */ ++ uint16_t max_payload; /* PPP-Max-Payload (RFC4638) */ + u_char peeraddr[6]; /* Peer MAC address */ + char real_session[MAX_SESSION]; /* real session name */ + char agent_cid[64]; /* Agent Circuit ID */ + char agent_rid[64]; /* Agent Remote ID */ + u_char incoming; /* incoming vs. outgoing */ + u_char opened; /* PPPoE opened by phys */ ++ u_char mp_reply; /* PPP-Max-Payload reply from server */ + struct optinfo options; + struct PppoeIf *PIf; /* pointer on parent ng_pppoe info */ + struct PppoeList *list; +@@ -69,7 +71,8 @@ static u_char gNgEtherLoaded = FALSE; + enum { + SET_IFACE, + SET_SESSION, +- SET_ACNAME ++ SET_ACNAME, ++ SET_MAX_PAYLOAD + }; + + /* +@@ -113,6 +116,8 @@ static int PppoeCallingNum(Link l, void + static int PppoeCalledNum(Link l, void *buf, size_t buf_len); + static int PppoeSelfName(Link l, void *buf, size_t buf_len); + static int PppoePeerName(Link l, void *buf, size_t buf_len); ++static u_short PppoeGetMtu(Link l, int conf); ++static u_short PppoeGetMru(Link l, int conf); + static void PppoeCtrlReadEvent(int type, void *arg); + static void PppoeConnectTimeout(void *arg); + static void PppoeStat(Context ctx); +@@ -155,6 +160,8 @@ const struct phystype gPppoePhysType = { + .callednum = PppoeCalledNum, + .selfname = PppoeSelfName, + .peername = PppoePeerName, ++ .getmtu = PppoeGetMtu, ++ .getmru = PppoeGetMru + }; + + const struct cmdtab PppoeSetCmds[] = { +@@ -164,6 +171,10 @@ const struct cmdtab PppoeSetCmds[] = { + PppoeSetCommand, NULL, 2, (void *)SET_SESSION }, + { "acname {name}", "Set PPPoE access concentrator name", + PppoeSetCommand, NULL, 2, (void *)SET_ACNAME }, ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ { "max-payload {size}", "Set PPP-Max-Payload tag", ++ PppoeSetCommand, NULL, 2, (void *)SET_MAX_PAYLOAD }, ++#endif + { NULL }, + }; + +@@ -213,6 +224,8 @@ PppoeInit(Link l) + pe->agent_cid[0] = 0; + pe->agent_rid[0] = 0; + pe->PIf = NULL; ++ pe->max_payload = 0; ++ pe->mp_reply = 0; + + /* Done */ + return(0); +@@ -327,6 +340,20 @@ PppoeOpen(Link l) + l->name, path, cn.ourhook, cn.path, cn.peerhook); + goto fail2; + } ++ ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ const uint16_t max_payload = pe->max_payload; ++ if (pe->max_payload > 0) { ++ Log(LG_PHYS, ("[%s] PPPoE: Set PPP-Max-Payload to '%d'", ++ l->name, max_payload)); ++ } ++ /* Tell the PPPoE node to set PPP-Max-Payload value (unset if 0). */ ++ if (NgSendMsg(pe->PIf->csock, path, NGM_PPPOE_COOKIE, NGM_PPPOE_SETMAXP, ++ &max_payload, sizeof(uint16_t)) < 0) { ++ Perror("[%s] PPPoE can't set PPP-Max-Payload value", l->name); ++ goto fail2; ++ } ++#endif + + Log(LG_PHYS, ("[%s] PPPoE: Connecting to '%s'", l->name, pe->session)); + +@@ -351,6 +378,7 @@ PppoeOpen(Link l) + strlcpy(pe->real_session, pe->session, sizeof(pe->real_session)); + pe->agent_cid[0] = 0; + pe->agent_rid[0] = 0; ++ pe->mp_reply = 0; + return; + + fail3: +@@ -433,6 +461,7 @@ PppoeDoClose(Link l) + pi->real_session[0] = 0; + pi->agent_cid[0] = 0; + pi->agent_rid[0] = 0; ++ pi->mp_reply = 0; + } + + /* +@@ -444,7 +473,11 @@ static void + PppoeCtrlReadEvent(int type, void *arg) + { + union { ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ u_char buf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_maxp)]; ++#else + u_char buf[sizeof(struct ng_mesg) + sizeof(struct ngpppoe_sts)]; ++#endif + struct ng_mesg resp; + } u; + char path[NG_PATHSIZ]; +@@ -468,6 +501,9 @@ PppoeCtrlReadEvent(int type, void *arg) + case NGM_PPPOE_SUCCESS: + case NGM_PPPOE_FAIL: + case NGM_PPPOE_CLOSE: ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ case NGM_PPPOE_SETMAXP: ++#endif + { + char ppphook[NG_HOOKSIZ]; + char *linkname, *rest; +@@ -535,6 +571,28 @@ PppoeCtrlReadEvent(int type, void *arg) + Log(LG_PHYS, ("PPPoE: rec'd ACNAME \"%s\"", + ((struct ngpppoe_sts *)u.resp.data)->hook)); + break; ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ case NGM_PPPOE_SETMAXP: ++ { ++ struct ngpppoe_maxp *maxp; ++ ++ maxp = ((struct ngpppoe_maxp *)u.resp.data); ++ Log(LG_PHYS, ("[%s] PPPoE: rec'd PPP-Max-Payload '%u'", ++ l->name, maxp->data)); ++ if (pi->max_payload > 0) { ++ if (pi->max_payload == maxp->data) ++ pi->mp_reply = 1; ++ else ++ Log(LG_PHYS, ++ ("[%s] PPPoE: sent and returned values are not equal", ++ l->name)); ++ } else ++ Log(LG_PHYS, ("[%s] PPPoE: server sent tag PPP-Max-Payload" ++ " without request from the client", ++ l->name)); ++ break; ++ } ++#endif + default: + Log(LG_PHYS, ("PPPoE: rec'd command %lu from \"%s\"", + (u_long)u.resp.header.cmd, path)); +@@ -555,6 +613,9 @@ PppoeStat(Context ctx) + Printf("\tIface Node : %s\r\n", pe->path); + Printf("\tIface Hook : %s\r\n", pe->hook); + Printf("\tSession : %s\r\n", pe->session); ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ Printf("\tMax-Payload : %u\r\n", pe->max_payload); ++#endif + Printf("PPPoE status:\r\n"); + if (ctx->lnk->state != PHYS_STATE_DOWN) { + Printf("\tOpened : %s\r\n", (pe->opened?"YES":"NO")); +@@ -562,6 +623,7 @@ PppoeStat(Context ctx) + PppoePeerMacAddr(ctx->lnk, buf, sizeof(buf)); + Printf("\tCurrent peer : %s\r\n", buf); + Printf("\tSession : %s\r\n", pe->real_session); ++ Printf("\tMax-Payload : %s\r\n", (pe->mp_reply?"YES":"NO")); + Printf("\tCircuit-ID : %s\r\n", pe->agent_cid); + Printf("\tRemote-ID : %s\r\n", pe->agent_rid); + } +@@ -657,6 +719,34 @@ PppoePeerName(Link l, void *buf, size_t + return (0); + } + ++static u_short ++PppoeGetMtu(Link l, int conf) ++{ ++ PppoeInfo const pppoe = (PppoeInfo)l->info; ++ ++ if (pppoe->max_payload > 0 && pppoe->mp_reply > 0) ++ return (pppoe->max_payload); ++ else ++ if (conf == 0) ++ return (l->type->mtu); ++ else ++ return (l->conf.mtu); ++} ++ ++static u_short ++PppoeGetMru(Link l, int conf) ++{ ++ PppoeInfo const pppoe = (PppoeInfo)l->info; ++ ++ if (pppoe->max_payload > 0 && pppoe->mp_reply > 0) ++ return (pppoe->max_payload); ++ else ++ if (conf == 0) ++ return (l->type->mru); ++ else ++ return (l->conf.mru); ++} ++ + static int + CreatePppoeNode(struct PppoeIf *PIf, const char *path, const char *hook) + { +@@ -1340,7 +1430,9 @@ PppoeSetCommand(Context ctx, int ac, cha + const PppoeInfo pi = (PppoeInfo) ctx->lnk->info; + const char *hookname = ETHER_DEFAULT_HOOK; + const char *colon; +- ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ int ap; ++#endif + switch ((intptr_t)arg) { + case SET_IFACE: + switch (ac) { +@@ -1377,6 +1469,16 @@ PppoeSetCommand(Context ctx, int ac, cha + return(-1); + strlcpy(pi->acname, av[0], sizeof(pi->acname)); + break; ++#ifdef NGM_PPPOE_SETMAXP_COOKIE ++ case SET_MAX_PAYLOAD: ++ if (ac != 1) ++ return(-1); ++ ap = atoi(av[0]); ++ if (ap < PPPOE_MRU || ap > ETHER_MAX_LEN - 8) ++ Error("PPP-Max-Payload value \"%s\"", av[0]); ++ pi->max_payload = ap; ++ break; ++#endif + default: + assert(0); + } diff --git a/net/mpd5/pkg-descr b/net/mpd5/pkg-descr index 1660303..82b2d37 100644 --- a/net/mpd5/pkg-descr +++ b/net/mpd5/pkg-descr @@ -9,7 +9,7 @@ the numerous PPP sub-protocols and extensions, such as: PPP compression and encryption IPCP and IPV6CP parameter negotiation -Mpd have support for many link types: +Mpd has support for many link types: Serial port modem Point-to-Point Tunnelling Protocol (PPTP) @@ -19,19 +19,4 @@ Mpd have support for many link types: PPP over UDP PPP over specified netgraph(4) node -Mpd also includes many additional features: - - IPv4 and IPv6 support - RADIUS authentication and accounting - NetFlow traffic accounting - Network address translation (NAT) - Dial-on-demand with idle timeout - Multiple active connections running simultaneously - Dynamic demand based link management (also known as ``rubber bandwidth'') - Powerful chat scripting language for asynchronous serial ports - Pre-tested chat scripts for several common modems and ISDN TAs - Clean device-type independent design - Comprehensive logging - Telnet and HTTP control interfaces. - WWW: http://www.sourceforge.net/projects/mpd |