MTU config

master
Mark Qvist 2014-05-25 16:07:11 +02:00
parent c24e624229
commit 903c9df4e1
3 changed files with 13 additions and 1 deletions

View File

@ -24,6 +24,16 @@ int if_down(char *name) {
return ret;
}
int if_mtu(char *name, int mtu) {
char buf[128];
snprintf(buf, sizeof(buf), "ifconfig %s mtu %d", name, mtu);
int ret = system(buf);
if (ret != 0) {
printf("Could set MTU for interface %s\n", name);
}
return ret;
}
int if_enable_ibss(char *name) {
char buf[128];
snprintf(buf, sizeof(buf), "iw %s set type ibss", name);

View File

@ -3,6 +3,7 @@
int if_up(char *name);
int if_down(char *name);
int if_mtu(char *name, int mtu);
int if_promisc(char *name);
int if_enable_ibss(char *name);
int if_join_ibss(char *name, char *essid, int frequency);

3
main.c
View File

@ -40,7 +40,7 @@ int domainSocket;
#define PROTOCOL_IDENTIFIER 0x9f77
// Max payload length
#define PAYLOAD_LENGTH 4096
#define PAYLOAD_LENGTH 1500
// ESSID and frequency for network
#define ESSID "WiPacket"
@ -358,6 +358,7 @@ void configureInterface() {
if_down(if_name);
if_enable_ibss(if_name);
if_up(if_name);
if_mtu(if_name, PAYLOAD_LENGTH);
if_join_ibss(if_name, essid, frequency);
if_promisc(if_name);
}