Skip to content

Commit c3a0a95

Browse files
author
marek
committed
[batman] add iptables MSS CLAMP rule in mangle table as suggested by Michael Rack
git-svn-id: http://downloads.open-mesh.org/svn/batman/trunk/batman@1435 45894c77-fb22-0410-b583-ff6e7d5dbf6c
1 parent 8a26f28 commit c3a0a95

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Diff for: linux/tun.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
#define IPTABLES_ADD_MASQ "iptables -t nat -A POSTROUTING -o %s -j MASQUERADE"
4141
#define IPTABLES_DEL_MASQ "iptables -t nat -D POSTROUTING -o %s -j MASQUERADE"
4242

43+
#define IPTABLES_ADD_MSS "iptables -t mangle -I POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o %s -j TCPMSS --clamp-mss-to-pmtu"
44+
#define IPTABLES_DEL_MSS "iptables -t mangle -D POSTROUTING -p tcp --tcp-flags SYN,RST SYN -o %s -j TCPMSS --clamp-mss-to-pmtu"
45+
4346
#define IPTABLES_ADD_ACC "iptables -t nat -I POSTROUTING -s %s/%i -j ACCEPT"
4447
#define IPTABLES_DEL_ACC "iptables -t nat -D POSTROUTING -s %s/%i -j ACCEPT"
4548

@@ -101,17 +104,23 @@ void exec_iptables_rule(char *cmd, int8_t route_action) {
101104
}
102105

103106
void add_nat_rule(char *dev) {
104-
char cmd[100];
107+
char cmd[150];
105108

106109
sprintf(cmd, IPTABLES_ADD_MASQ, dev);
107110
exec_iptables_rule(cmd, ROUTE_ADD);
111+
112+
sprintf(cmd, IPTABLES_ADD_MSS, dev);
113+
exec_iptables_rule(cmd, ROUTE_ADD);
108114
}
109115

110116
void del_nat_rule(char *dev) {
111-
char cmd[100];
117+
char cmd[150];
112118

113119
sprintf(cmd, IPTABLES_DEL_MASQ, dev);
114120
exec_iptables_rule(cmd, ROUTE_DEL);
121+
122+
sprintf(cmd, IPTABLES_ADD_MSS, dev);
123+
exec_iptables_rule(cmd, ROUTE_DEL);
115124
}
116125

117126
void hna_local_update_nat(uint32_t hna_ip, uint8_t netmask, int8_t route_action) {

0 commit comments

Comments
 (0)