pppoe: Add support for -c and -C to enable/disable header compression (thanks k0ga)

This commit is contained in:
cinap_lenrek 2016-03-15 22:10:54 +01:00
parent 8b9f36dbe2
commit 74d4d8a26e
2 changed files with 13 additions and 2 deletions

View file

@ -34,7 +34,7 @@ ppp, pppoe, pptp, pptpd \- point-to-point protocol
.PP .PP
.B ip/pppoe .B ip/pppoe
[ [
.B -Pd .B -PdcC
] ]
[ [
.B -A .B -A

View file

@ -28,11 +28,12 @@ uchar *cookie;
int cookielen; int cookielen;
uchar etherdst[6]; uchar etherdst[6];
int mtu = 1492; int mtu = 1492;
int pktcompress, hdrcompress;
void void
usage(void) usage(void)
{ {
fprint(2, "usage: pppoe [-Pd] [-A acname] [-S srvname] [-k keyspec] [-m mtu] [-x pppnet] [ether0]\n"); fprint(2, "usage: pppoe [-PdcC] [-A acname] [-S srvname] [-k keyspec] [-m mtu] [-x pppnet] [ether0]\n");
exits("usage"); exits("usage");
} }
@ -75,6 +76,12 @@ main(int argc, char **argv)
case 'k': case 'k':
keyspec = EARGF(usage()); keyspec = EARGF(usage());
break; break;
case 'c':
pktcompress = 1;
break;
case 'C':
hdrcompress = 1;
break;
case 'x': case 'x':
pppnetmtpt = EARGF(usage()); pppnetmtpt = EARGF(usage());
break; break;
@ -526,6 +533,10 @@ execppp(int fd)
argv[argc++] = "-d"; argv[argc++] = "-d";
if(primary) if(primary)
argv[argc++] = "-P"; argv[argc++] = "-P";
if(hdrcompress)
argv[argc++] = "-C";
if(pktcompress)
argv[argc++] = "-c";
if(pppnetmtpt){ if(pppnetmtpt){
argv[argc++] = "-x"; argv[argc++] = "-x";
argv[argc++] = pppnetmtpt; argv[argc++] = pppnetmtpt;