diff options
author | Christian Pointner <equinox@anytun.org> | 2009-02-04 14:40:45 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-02-04 14:40:45 +0000 |
commit | b05c2ed42428577ed3b85593a9d862243ed8d4f2 (patch) | |
tree | bc2a8d8b5d446a1a62ad6e6157bb350d39e5d5f0 /src/uanytun.c | |
parent | improved tap device handling on openbsd (diff) |
not sending packet when remote addr is unkown
Diffstat (limited to 'src/uanytun.c')
-rw-r--r-- | src/uanytun.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/uanytun.c b/src/uanytun.c index c80ca8b..42b082a 100644 --- a/src/uanytun.c +++ b/src/uanytun.c @@ -155,6 +155,9 @@ int process_tun_data(tun_device_t* dev, udp_socket_t* sock, options_t* opt, plai plain_packet_set_type(plain_packet, PAYLOAD_TYPE_TAP); else plain_packet_set_type(plain_packet, PAYLOAD_TYPE_UNKNOWN); + + if(!sock->remote_end_set_) + return 0; cipher_encrypt(c, kd, kd_outbound, plain_packet, encrypted_packet, seq_nr, opt->sender_id_, opt->mux_); @@ -212,6 +215,7 @@ int process_sock_data(tun_device_t* dev, udp_socket_t* sock, options_t* opt, pla if(memcmp(&remote, &(sock->remote_end_), sizeof(remote))) { memcpy(&(sock->remote_end_), &remote, sizeof(remote)); + sock->remote_end_set_ = 1; char* addrstring = udp_endpoint_to_string(remote); log_printf(NOTICE, "autodetected remote host changed %s", addrstring); free(addrstring); |