Project

General

Profile

Feature #4542 » 2 of 3 - Second_attempt_to_add_PPP-Max-Payload_tag_.patch

Greg B, 09/19/2015 06:05 PM

View differences:

mpd/src/bund.c (revision 1.215)
} 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);
mpd/src/lcp.c (revision 1.90)
lcp->peer_reject = 0;
/* Initialize normal LCP stuff */
lcp->peer_mru = l->conf.mtu;
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);
......
/* 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;
mpd/src/phys.c (revision 1.80)
}
/*
* 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()
*/
mpd/src/phys.h (revision 1.43)
/* 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;
......
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);
mpd/src/pppoe.c (revision 1.141)
/*
* DEFINITIONS
*/
#define PPPOE_MTU 1492 /* allow room for PPPoE overhead */
#define PPPOE_MRU 1492
......
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);
......
.callednum = PppoeCalledNum,
.selfname = PppoeSelfName,
.peername = PppoePeerName,
.getmtu = PppoeGetMtu,
.getmru = PppoeGetMru
};
......
Printf("\tIface Hook : %s\r\n", pe->hook);
Printf("\tSession : %s\r\n", pe->session);
#ifdef NGM_PPPOE_SETMAXP_COOKIE
Printf("\tMax-Payload : %d\r\n", pe->max_payload);
Printf("\tMax-Payload : %u\r\n", pe->max_payload);
#endif
Printf("\tMAC format : %s\r\n", buf);
Printf("PPPoE status:\r\n");
......
}
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 (ac != 1)
return(-1);
ap = atoi(av[0]);
if (ap < ETHER_MIN_LEN + 8 || ap > ETHER_MAX_LEN - 8)
if (ap < PPPOE_MRU || ap > ETHER_MAX_LEN - 8)
Error("PPP-Max-Payload value \"%s\"", av[0]);
pi->max_payload = ap;
break;
(2-2/3)