Mercurial > hg > quicktun
comparison src/common.c @ 28:e77af6acb559
Small fixes: abort before updating remote endpoint after serious decryption error, print IP address bytes in the expected order
author | Ivo Smits <Ivo@UCIS.nl> |
---|---|
date | Sat, 09 Apr 2011 17:46:04 +0200 |
parents | 5ba185ca7102 |
children | 7c5e5be876bb |
comparison
equal
deleted
inserted
replaced
27:5ba185ca7102 | 28:e77af6acb559 |
---|---|
258 len = sizeof(out); | 258 len = sizeof(out); |
259 getsockopt(sfd, SOL_SOCKET, SO_ERROR, &out, &len); | 259 getsockopt(sfd, SOL_SOCKET, SO_ERROR, &out, &len); |
260 fprintf(stderr, "Received end of file on udp socket (error %d)\n", out); | 260 fprintf(stderr, "Received end of file on udp socket (error %d)\n", out); |
261 } else { | 261 } else { |
262 len = p->decode(&session, buffer_enc, buffer_raw, len); | 262 len = p->decode(&session, buffer_enc, buffer_raw, len); |
263 if (len < 0) return len; | |
263 if (len != 0 && session.remote_float != 0 && (session.remote_addr.sin_addr.s_addr != recvaddr.sin_addr.s_addr || session.remote_addr.sin_port != recvaddr.sin_port)) { | 264 if (len != 0 && session.remote_float != 0 && (session.remote_addr.sin_addr.s_addr != recvaddr.sin_addr.s_addr || session.remote_addr.sin_port != recvaddr.sin_port)) { |
264 fprintf(stderr, "Remote endpoint has changed to %08X:%d\n", recvaddr.sin_addr.s_addr, ntohs(recvaddr.sin_port)); | 265 fprintf(stderr, "Remote endpoint has changed to %08X:%d\n", ntohl(recvaddr.sin_addr.s_addr), ntohs(recvaddr.sin_port)); |
265 session.remote_addr = recvaddr; | 266 session.remote_addr = recvaddr; |
266 session.remote_float = 2; | 267 session.remote_float = 2; |
267 } | 268 } |
268 if (len < 0) return len; | |
269 write(ttfd, buffer_raw + p->offset_raw, len); | 269 write(ttfd, buffer_raw + p->offset_raw, len); |
270 } | 270 } |
271 } | 271 } |
272 } | 272 } |
273 return 0; | 273 return 0; |