FreeBSD Bugzilla – Attachment 161904 Details for
Bug 203695
[patch] net/mpd5: Add RFC 4638 client support (PPPoE MTU > 1492)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch adding RFC 4638 client support (generated using svn diff)
mpd-5.7-rfc4638-port.patch (text/plain), 12.86 KB, created by
David Wood
on 2015-10-11 10:53:06 UTC
(
hide
)
Description:
Patch adding RFC 4638 client support (generated using svn diff)
Filename:
MIME Type:
Creator:
David Wood
Created:
2015-10-11 10:53:06 UTC
Size:
12.86 KB
patch
obsolete
>Index: net/mpd5/Makefile >=================================================================== >--- net/mpd5/Makefile (revision 399074) >+++ net/mpd5/Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= mpd > DISTVERSION= 5.7 >-PORTREVISION= 3 >+PORTREVISION= 4 > CATEGORIES= net > MASTER_SITES= SF/${PORTNAME}/Mpd5/Mpd-${PORTVERSION} > PKGNAMESUFFIX= 5 >Index: net/mpd5/files/patch-src_bund.c >=================================================================== >--- net/mpd5/files/patch-src_bund.c (revision 0) >+++ net/mpd5/files/patch-src_bund.c (working copy) >@@ -0,0 +1,11 @@ >+--- src/bund.c 2013-06-11 10:00:00.000000000 +0100 >++++ src/bund.c 2015-09-22 20:49:38.000000000 +0100 >+@@ -891,7 +891,7 @@ >+ >+ } 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); > >Property changes on: net/mpd5/files/patch-src_bund.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: net/mpd5/files/patch-src_lcp.c >=================================================================== >--- net/mpd5/files/patch-src_lcp.c (revision 0) >+++ net/mpd5/files/patch-src_lcp.c (working copy) >@@ -0,0 +1,26 @@ >+--- src/lcp.c 2013-06-11 10:00:00.000000000 +0100 >++++ src/lcp.c 2015-09-22 20:49:38.000000000 +0100 >+@@ -226,10 +226,10 @@ >+ 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 @@ >+ >+ /* 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; > >Property changes on: net/mpd5/files/patch-src_lcp.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: net/mpd5/files/patch-src_phys.c >=================================================================== >--- net/mpd5/files/patch-src_phys.c (revision 0) >+++ net/mpd5/files/patch-src_phys.c (working copy) >@@ -0,0 +1,55 @@ >+--- src/phys.c 2013-06-11 10:00:00.000000000 +0100 >++++ src/phys.c 2015-09-22 20:49:38.000000000 +0100 >+@@ -466,6 +466,52 @@ >+ } >+ >+ /* >++ * 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 > >Property changes on: net/mpd5/files/patch-src_phys.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: net/mpd5/files/patch-src_phys.h >=================================================================== >--- net/mpd5/files/patch-src_phys.h (revision 0) >+++ net/mpd5/files/patch-src_phys.h (working copy) >@@ -0,0 +1,20 @@ >+--- src/phys.h 2013-06-11 10:00:00.000000000 +0100 >++++ src/phys.h 2015-09-22 20:49:38.000000000 +0100 >+@@ -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); > >Property changes on: net/mpd5/files/patch-src_phys.h >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: net/mpd5/files/patch-src_pppoe.c >=================================================================== >--- net/mpd5/files/patch-src_pppoe.c (revision 0) >+++ net/mpd5/files/patch-src_pppoe.c (working copy) >@@ -0,0 +1,234 @@ >+--- src/pppoe.c 2013-06-11 10:00:00.000000000 +0100 >++++ src/pppoe.c 2015-09-22 20:49:57.000000000 +0100 >+@@ -50,12 +50,14 @@ >+ 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 @@ >+ enum { >+ SET_IFACE, >+ SET_SESSION, >+- SET_ACNAME >++ SET_ACNAME, >++ SET_MAX_PAYLOAD >+ }; >+ >+ /* >+@@ -113,6 +116,8 @@ >+ 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 @@ >+ .callednum = PppoeCalledNum, >+ .selfname = PppoeSelfName, >+ .peername = PppoePeerName, >++ .getmtu = PppoeGetMtu, >++ .getmru = PppoeGetMru >+ }; >+ >+ const struct cmdtab PppoeSetCmds[] = { >+@@ -164,6 +171,10 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ pi->real_session[0] = 0; >+ pi->agent_cid[0] = 0; >+ pi->agent_rid[0] = 0; >++ pi->mp_reply = 0; >+ } >+ >+ /* >+@@ -444,7 +473,11 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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 @@ >+ 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); >+ } > >Property changes on: net/mpd5/files/patch-src_pppoe.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203695
:
161904
|
164770