summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2014-02-11 20:24:50 +0000
committerChristian Pointner <equinox@anytun.org>2014-02-11 20:24:50 +0000
commit935e861444060673e40204f435e01ffe18a0d63e (patch)
tree80ba769aa52891f13f5a21a3c6ae7b7bc8d37a99
parentfixed typos at manpage (diff)
depending on rail mode call update_remote before or after seq_window check
-rw-r--r--src/uanytun.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/uanytun.c b/src/uanytun.c
index c23294c..6ebd721 100644
--- a/src/uanytun.c
+++ b/src/uanytun.c
@@ -171,6 +171,9 @@ int process_sock_data(tun_device_t* dev, int fd, udp_t* sock, options_t* opt, pl
}
#endif
+ if(sock->rail_mode_)
+ udp_update_remote(sock, fd, &remote);
+
int result = seq_win_check_and_add(seq_win, encrypted_packet_get_sender_id(encrypted_packet), encrypted_packet_get_seq_nr(encrypted_packet));
if(result > 0) {
log_printf(WARNING, "detected replay attack, discarding packet");
@@ -180,7 +183,8 @@ int process_sock_data(tun_device_t* dev, int fd, udp_t* sock, options_t* opt, pl
return -2;
}
- udp_update_remote(sock, fd, &remote);
+ if(!sock->rail_mode_)
+ udp_update_remote(sock, fd, &remote);
if(encrypted_packet_get_payload_length(encrypted_packet) <= plain_packet_get_header_length()) {
log_printf(WARNING, "ignoring packet with zero length payload");