Feature #4542 » 2 of 3 - Second_attempt_to_add_PPP-Max-Payload_tag_.patch
mpd/src/bund.c (revision 1.215) | ||
---|---|---|
890 | 890 |
|
891 | 891 |
} else if (!b->peer_mrru) { /* If no multilink, use peer MRU */ |
892 | 892 |
mtu = MIN(b->links[the_link]->lcp.peer_mru, |
893 |
b->links[the_link]->type->mtu);
|
|
893 |
PhysGetMtu(b->links[the_link], 0));
|
|
894 | 894 |
|
895 | 895 |
} else { /* Multilink, use peer MRRU */ |
896 | 896 |
mtu = MIN(b->peer_mrru, MP_MAX_MRRU); |
mpd/src/lcp.c (revision 1.90) | ||
---|---|---|
225 | 225 |
lcp->peer_reject = 0; |
226 | 226 |
|
227 | 227 |
/* Initialize normal LCP stuff */ |
228 |
lcp->peer_mru = l->conf.mtu;
|
|
228 |
lcp->peer_mru = PhysGetMtu(l, 1);
|
|
229 | 229 |
lcp->want_mru = PhysGetMru(l, 1); |
230 | 230 |
if (l->type && (lcp->want_mru > PhysGetMru(l, 0))) |
231 | 231 |
lcp->want_mru = PhysGetMru(l, 0); |
... | ... | |
792 | 792 |
|
793 | 793 |
/* If we have got request, forget the previous values */ |
794 | 794 |
if (mode == MODE_REQ) { |
795 |
lcp->peer_mru = l->conf.mtu;
|
|
795 |
lcp->peer_mru = PhysGetMtu(l, 1);
|
|
796 | 796 |
lcp->peer_accmap = 0xffffffff; |
797 | 797 |
lcp->peer_acfcomp = FALSE; |
798 | 798 |
lcp->peer_protocomp = FALSE; |
mpd/src/phys.c (revision 1.80) | ||
---|---|---|
465 | 465 |
} |
466 | 466 |
|
467 | 467 |
/* |
468 |
* PhysGetMtu() |
|
469 |
*/ |
|
470 |
|
|
471 |
u_short |
|
472 |
PhysGetMtu(Link l, int conf) |
|
473 |
{ |
|
474 |
PhysType const pt = l->type; |
|
475 |
|
|
476 |
if (pt) { |
|
477 |
if (pt->getmtu) |
|
478 |
return ((*pt->getmtu)(l, conf)); |
|
479 |
if (conf == 0) { |
|
480 |
if (pt->mtu) |
|
481 |
return (pt->mtu); |
|
482 |
else |
|
483 |
return (0); |
|
484 |
} else |
|
485 |
return (l->conf.mtu); |
|
486 |
} else |
|
487 |
return (0); |
|
488 |
} |
|
489 |
|
|
490 |
/* |
|
468 | 491 |
* PhysGetMru() |
469 | 492 |
*/ |
470 | 493 |
|
mpd/src/phys.h (revision 1.43) | ||
---|---|---|
63 | 63 |
/* returns the calling number (IP, MAC, whatever) */ |
64 | 64 |
int (*callednum)(Link l, void *buf, size_t buf_len); |
65 | 65 |
/* returns the called number (IP, MAC, whatever) */ |
66 |
u_short (*getmtu)(Link l, int conf); /* returns actual MTU */ |
|
66 | 67 |
u_short (*getmru)(Link l, int conf); /* returns actual MRU */ |
67 | 68 |
}; |
68 | 69 |
typedef struct phystype *PhysType; |
... | ... | |
99 | 100 |
extern int PhysGetPeerIface(Link l, char *buf, size_t buf_len); |
100 | 101 |
extern int PhysGetCallingNum(Link l, char *buf, size_t buf_len); |
101 | 102 |
extern int PhysGetCalledNum(Link l, char *buf, size_t buf_len); |
103 |
extern u_short PhysGetMtu(Link l, int conf); |
|
102 | 104 |
extern u_short PhysGetMru(Link l, int conf); |
103 | 105 |
extern int PhysIsBusy(Link l); |
104 | 106 |
|
mpd/src/pppoe.c (revision 1.141) | ||
---|---|---|
26 | 26 |
/* |
27 | 27 |
* DEFINITIONS |
28 | 28 |
*/ |
29 |
|
|
29 | 30 |
#define PPPOE_MTU 1492 /* allow room for PPPoE overhead */ |
30 | 31 |
#define PPPOE_MRU 1492 |
31 | 32 |
|
... | ... | |
149 | 150 |
static int PppoeCalledNum(Link l, void *buf, size_t buf_len); |
150 | 151 |
static int PppoeSelfName(Link l, void *buf, size_t buf_len); |
151 | 152 |
static int PppoePeerName(Link l, void *buf, size_t buf_len); |
153 |
static u_short PppoeGetMtu(Link l, int conf); |
|
152 | 154 |
static u_short PppoeGetMru(Link l, int conf); |
153 | 155 |
static void PppoeCtrlReadEvent(int type, void *arg); |
154 | 156 |
static void PppoeConnectTimeout(void *arg); |
... | ... | |
192 | 194 |
.callednum = PppoeCalledNum, |
193 | 195 |
.selfname = PppoeSelfName, |
194 | 196 |
.peername = PppoePeerName, |
197 |
.getmtu = PppoeGetMtu, |
|
195 | 198 |
.getmru = PppoeGetMru |
196 | 199 |
}; |
197 | 200 |
|
... | ... | |
697 | 700 |
Printf("\tIface Hook : %s\r\n", pe->hook); |
698 | 701 |
Printf("\tSession : %s\r\n", pe->session); |
699 | 702 |
#ifdef NGM_PPPOE_SETMAXP_COOKIE |
700 |
Printf("\tMax-Payload : %d\r\n", pe->max_payload);
|
|
703 |
Printf("\tMax-Payload : %u\r\n", pe->max_payload);
|
|
701 | 704 |
#endif |
702 | 705 |
Printf("\tMAC format : %s\r\n", buf); |
703 | 706 |
Printf("PPPoE status:\r\n"); |
... | ... | |
850 | 853 |
} |
851 | 854 |
|
852 | 855 |
static u_short |
856 |
PppoeGetMtu(Link l, int conf) |
|
857 |
{ |
|
858 |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
|
859 |
|
|
860 |
if (pppoe->max_payload > 0 && pppoe->mp_reply > 0) |
|
861 |
return (pppoe->max_payload); |
|
862 |
else |
|
863 |
if (conf == 0) |
|
864 |
return (l->type->mtu); |
|
865 |
else |
|
866 |
return (l->conf.mtu); |
|
867 |
} |
|
868 |
|
|
869 |
static u_short |
|
853 | 870 |
PppoeGetMru(Link l, int conf) |
854 | 871 |
{ |
855 | 872 |
PppoeInfo const pppoe = (PppoeInfo)l->info; |
... | ... | |
1702 | 1719 |
if (ac != 1) |
1703 | 1720 |
return(-1); |
1704 | 1721 |
ap = atoi(av[0]); |
1705 |
if (ap < ETHER_MIN_LEN + 8 || ap > ETHER_MAX_LEN - 8)
|
|
1722 |
if (ap < PPPOE_MRU || ap > ETHER_MAX_LEN - 8)
|
|
1706 | 1723 |
Error("PPP-Max-Payload value \"%s\"", av[0]); |
1707 | 1724 |
pi->max_payload = ap; |
1708 | 1725 |
break; |