summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ccp.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-07-03 22:20:19 +0000
committerbrian <brian@FreeBSD.org>2001-07-03 22:20:19 +0000
commit0deba2c342284728c367d996a120510bed8a07a4 (patch)
tree753c521335e8c5586213ea14afc2e9e2080bf808 /usr.sbin/ppp/ccp.c
parentc6b698395d9dda67bfd2f061db42b9e6038c790b (diff)
downloadFreeBSD-src-0deba2c342284728c367d996a120510bed8a07a4.zip
FreeBSD-src-0deba2c342284728c367d996a120510bed8a07a4.tar.gz
Reduce the interface MTU by 2 when MPPE has been successfully negotiated.
This is necessary because MPPE will combine the protocol id with the payload received on the tun interface, encrypt it, then prepend its own protocol id, effectively increasing the payload by two bytes.
Diffstat (limited to 'usr.sbin/ppp/ccp.c')
-rw-r--r--usr.sbin/ppp/ccp.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/usr.sbin/ppp/ccp.c b/usr.sbin/ppp/ccp.c
index e8f0a41..b3a80f8 100644
--- a/usr.sbin/ppp/ccp.c
+++ b/usr.sbin/ppp/ccp.c
@@ -299,6 +299,19 @@ ccp_Required(struct ccp *ccp)
return 0;
}
+/*
+ * Report whether it's possible to increase a packet's size after
+ * compression (and by how much).
+ */
+int
+ccp_MTUOverhead(struct ccp *ccp)
+{
+ if (ccp->fsm.state == ST_OPENED)
+ return algorithm[ccp->out.algorithm]->o.MTUOverhead;
+
+ return 0;
+}
+
static void
CcpInitRestartCounter(struct fsm *fp, int what)
{
@@ -474,7 +487,24 @@ CcpLayerUp(struct fsm *fp)
/* We're now up */
struct ccp *ccp = fsm2ccp(fp);
struct ccp_opt **o;
- int f;
+ int f, fail;
+
+ for (f = fail = 0; f < NALGORITHMS; f++)
+ if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) &&
+ (*algorithm[f]->Required)(&ccp->fsm) &&
+ (ccp->in.algorithm != f || ccp->out.algorithm != f)) {
+ /* Blow it all away - we haven't negotiated a required algorithm */
+ log_Printf(LogWARN, "%s: Failed to negotiate (required) %s\n",
+ fp->link->name, protoname(algorithm[f]->id));
+ fail = 1;
+ }
+
+ if (fail) {
+ ccp->his_proto = ccp->my_proto = -1;
+ fsm_Close(fp);
+ fsm_Close(&fp->link->lcp.fsm);
+ return 0;
+ }
log_Printf(LogCCP, "%s: LayerUp.\n", fp->link->name);
OpenPOWER on IntegriCloud