Setting mss
[email protected] Thu, 25 Jul 2002 06:50:29 -0400
| Newsgroups | gmane.network.pump |
|---|---|
| Message-ID | <[email protected]> |
My system connects to a Linksys Etherfast Cable / DSL Router. This is
configured to block all inbound ICMP, including Destination Unreachable
messages. I don't see any way to allow these messages without permitting
all inbound ICMP, which I don't want to do.
Unfortunately, this disables normal Path MTU Discovery, which is a
problem because of the overhead of PPPoE at my DSL modem.
I don't know if this is a good idea, but what I wanted to do was set the
Maximum Segment Size (MSS) of the default route manually. I could have
used the script interface of pump, but I didn't see an easy way to
modify the route set up by pump, so I modified pump to set the interface
and gateway mss when it added route entries.
Can anyone suggest a better way to deal with this problem?
For what it's worth, here's a patch to pump to allow setting mss. It
adds command line options --mss and --gateway-mss, which take mss sizes
in bytes for the interface and default gateway routes respectively:
diff -uNr pump-0.8.11.orig/dhcp.c pump-0.8.11/dhcp.c
--- pump-0.8.11.orig/dhcp.c Sat Jul 20 07:42:31 2002
+++ pump-0.8.11/dhcp.c Sun Jul 21 13:36:43 2002
@@ -273,6 +273,11 @@
route.rt_dev = intf->device;
route.rt_flags = RTF_UP;
route.rt_metric = 0;
+ syslog(LOG_INFO,"mss = %d\n",intf->mss);
+ if(intf->mss >= 64 && intf->mss <= 65536) {
+ route.rt_flags |= RTF_MSS;
+ route.rt_mss = intf->mss;
+ }
addrp->sin_family = AF_INET;
addrp->sin_port = 0;
@@ -290,7 +295,8 @@
return NULL;
}
-int pumpSetupDefaultGateway(struct in_addr * gw) {
+int pumpSetupDefaultGateway(struct pumpNetIntf * intf) {
+ struct in_addr * gw = &intf->gateway;
struct sockaddr_in addr;
struct rtentry route;
int s;
@@ -310,6 +316,11 @@
route.rt_flags = RTF_UP | RTF_GATEWAY;
route.rt_metric = 0;
route.rt_dev = NULL;
+ syslog(LOG_INFO,"gateway mss = %d\n",intf->gateway_mss);
+ if(intf->gateway_mss >= 64 && intf->gateway_mss <= 65536) {
+ route.rt_flags |= RTF_MSS;
+ route.rt_mss = intf->gateway_mss;
+ }
if (ioctl(s, SIOCADDRT, &route)) {
syslog(LOG_ERR, "failed to set default route: %s",
strerror(errno));
@@ -1228,7 +1239,8 @@
}
char * pumpDhcpRun(char * device, int flags, int reqLease,
- char * reqHostname, struct pumpNetIntf * intf,
+ char * reqHostname, int mss, int gateway_mss,
+ struct pumpNetIntf * intf,
struct pumpOverrideInfo * override) {
int s;
struct sockaddr_in serverAddr;
@@ -1250,6 +1262,8 @@
memset(intf, 0, sizeof(*intf));
strcpy(intf->device, device);
intf->reqLease = reqLease;
+ intf->mss = mss;
+ intf->gateway_mss = gateway_mss;
intf->set |= PUMP_INTFINFO_HAS_REQLEASE;
s = socket(AF_INET, SOCK_DGRAM, 0);
diff -uNr pump-0.8.11.orig/net.c pump-0.8.11/net.c
--- pump-0.8.11.orig/net.c Sat Jul 20 07:42:31 2002
+++ pump-0.8.11/net.c Sun Jul 21 12:21:29 2002
@@ -411,7 +411,7 @@
winStatus(50, 3, _("Dynamic IP"),
_("Sending request for IP information..."),
0);
- chptr = pumpDhcpRun(device, 0, 0, NULL, &newCfg.dev,
NULL);
+ chptr = pumpDhcpRun(device, 0, 0, NULL, 0, 0,
&newCfg.dev, NULL);
newtPopWindow();
} else {
chptr = NULL;
@@ -477,7 +477,7 @@
pumpSetupInterface(&dev->dev);
if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY)
- pumpSetupDefaultGateway(&dev->dev.gateway);
+ pumpSetupDefaultGateway(&dev->dev);
return 0;
}
@@ -695,7 +695,7 @@
_("Sending request for IP information..."),
0);
- chptr = pumpDhcpRun(device, 0, 0, NULL, &netDev->dev, NULL);
+ chptr = pumpDhcpRun(device, 0, 0, NULL, 0, 0, &netDev->dev,
NULL);
newtPopWindow();
if (chptr) {
logMessage("pump told us: %s", chptr);
diff -uNr pump-0.8.11.orig/pump.c pump-0.8.11/pump.c
--- pump-0.8.11.orig/pump.c Sat Jul 20 07:42:31 2002
+++ pump-0.8.11/pump.c Sun Jul 21 14:02:33 2002
@@ -69,6 +69,8 @@
int flags;
int reqLease; /* in seconds */
char reqHostname[200];
+ int mss;
+ int gateway_mss;
} start;
int result; /* 0 for success */
struct {
@@ -402,6 +404,8 @@
intf[i].reqLease,
intf[i].set & PUMP_NETINFO_HAS_HOSTNAME
? intf[i].hostname : NULL,
+ intf[i].mss,
+ intf[i].gateway_mss,
intf + i, overrides)) {
/* failed to get a new lease, so try
@@ -450,6 +454,8 @@
intf[closest].reqLease,
intf[closest].set &
PUMP_NETINFO_HAS_HOSTNAME
? intf[closest].hostname : NULL,
+ intf[closest].mss,
+ intf[closest].gateway_mss,
intf + closest, o)) {
/* failed to get a new lease, so try
@@ -526,6 +532,8 @@
cmd.u.start.flags, cmd.u.start.reqLease,
cmd.u.start.reqHostname[0] ?
cmd.u.start.reqHostname : NULL,
+ cmd.u.start.mss,
+ cmd.u.start.gateway_mss,
intf + numInterfaces, o)) {
cmd.u.result = 1;
} else {
@@ -536,7 +544,7 @@
if ((intf[i].set & PUMP_NETINFO_HAS_GATEWAY) &&
!(o->flags & OVERRIDE_FLAG_NOGATEWAY))
- pumpSetupDefaultGateway(&intf[i].gateway);
+ pumpSetupDefaultGateway(intf + numInterfaces);
setupDns(intf + i, o);
setupDomain(intf + i, o);
@@ -808,6 +816,8 @@
int killDaemon = 0;
int winId = 0;
int release = 0, renew = 0, status = 0, lookupHostname = 0, nodns =
0;
+ int mss = 0;
+ int gateway_mss = 0;
int nogateway = 0, nobootp = 0;
struct command cmd, response;
char * configFile = "/etc/pump.conf";
@@ -817,6 +827,8 @@
{ "config-file", 'c', POPT_ARG_STRING, &configFile, 0,
N_("Configuration file to use instead of "
"/etc/pump.conf") },
+ { "gateway-mss", '\0', POPT_ARG_INT, &gateway_mss, 0,
+ N_("Gateway MSS"), N_("bytes") },
{ "hostname", 'h', POPT_ARG_STRING, &hostname, 0,
N_("Hostname to request"), N_("hostname") },
{ "interface", 'i', POPT_ARG_STRING, &device, 0,
@@ -830,6 +842,8 @@
N_("Lease time to request (in seconds)"),
N_("seconds") },
{ "lookup-hostname", '\0', POPT_ARG_NONE, &lookupHostname,
0,
N_("Force lookup of hostname") },
+ { "mss", '\0', POPT_ARG_INT, &mss, 0,
+ N_("Interface MSS"), N_("bytes") },
{ "release", 'r', POPT_ARG_NONE, &release, 0,
N_("Release interface"), NULL },
{ "renew", 'R', POPT_ARG_NONE, &renew, 0,
@@ -864,6 +878,7 @@
return 1;
}
+
if (poptGetArg(optCon)) {
fprintf(stderr, _("%s: no extra parameters are expected\n"),
PROGNAME);
return 1;
@@ -913,6 +928,8 @@
cmd.u.start.reqLease = lease_hrs * 60 * 60;
else
cmd.u.start.reqLease = lease;
+ cmd.u.start.mss = mss;
+ cmd.u.start.gateway_mss = gateway_mss;
strcpy(cmd.u.start.reqHostname, hostname);
}
diff -uNr pump-0.8.11.orig/pump.h pump-0.8.11/pump.h
--- pump-0.8.11.orig/pump.h Sat Jul 20 07:42:31 2002
+++ pump-0.8.11/pump.h Sun Jul 21 12:17:21 2002
@@ -70,6 +70,8 @@
int numXdm;
int numDns;
int flags;
+ int mss;
+ int gateway_mss;
};
#define OVERRIDE_FLAG_NODNS (1 << 0)
@@ -88,7 +90,8 @@
void pumpInitOverride(struct pumpOverrideInfo * override);
char * pumpDhcpRun(char * device, int flags, int lease,
- char * reqHostname, struct pumpNetIntf * intf,
+ char * reqHostname, int mss, int gateway_mss,
+ struct pumpNetIntf * intf,
struct pumpOverrideInfo * override);
char * pumpSetupInterface(struct pumpNetIntf * intf);
/* setup an interface for sending a broadcast -- uses all 0's address
*/
@@ -96,7 +99,7 @@
char * pumpDisableInterface(char * device);
int pumpDhcpRenew(struct pumpNetIntf * intf);
int pumpDhcpRelease(struct pumpNetIntf * intf);
-int pumpSetupDefaultGateway(struct in_addr * gw);
+int pumpSetupDefaultGateway(struct pumpNetIntf * intf);
time_t pumpUptime(void);
#define RESULT_OKAY 0