long total_out;
long total_in;
FILE *reference;
-long mtu = 1300;
+long mtu = 0;
char *reorder_data;
size_t reorder_len;
return result;
}
+static void set_mtu(struct utcp *u, int s) {
+ if(!mtu) {
+ socklen_t optlen = sizeof(mtu);
+ getsockopt(s, IPPROTO_IP, IP_MTU, &mtu, &optlen);
+ }
+
+ if(!mtu || mtu == 65535) {
+ mtu = 1500;
+ }
+
+ fprintf(stderr, "Using MTU %lu\n", mtu);
+
+ utcp_set_mtu(u, mtu ? mtu - 48 : 1300);
+}
+
int main(int argc, char *argv[]) {
srand(time(NULL));
srand48(time(NULL));
return 1;
}
- utcp_set_mtu(u, mtu);
utcp_set_user_timeout(u, 10);
if(!server) {
+ set_mtu(u, s);
c = utcp_connect_ex(u, 1, do_recv, NULL, flags);
}
break;
}
- if(!connected)
+ if(!connected) {
if(!connect(s, (struct sockaddr *)&ss, sl)) {
connected = true;
+ set_mtu(u, s);
}
+ }
inpktno++;