- Timestamp:
- 02/28/09 23:49:41 (3 years ago)
- Location:
- branches/win/trunk
- Files:
-
- 6 edited
-
configure (modified) (10 diffs)
-
src/ocat.c (modified) (2 diffs)
-
src/ocat.h (modified) (4 diffs)
-
src/ocat_wintuntap.c (modified) (5 diffs)
-
src/ocateth.c (modified) (2 diffs)
-
src/ocattun.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/win/trunk/configure
r482 r484 1 1 #! /bin/sh 2 2 # Guess values for system-dependent variables and create Makefiles. 3 # Generated by GNU Autoconf 2.63 for onioncat 0.1.10-48 0:481M.3 # Generated by GNU Autoconf 2.63 for onioncat 0.1.10-483M. 4 4 # 5 5 # Report bugs to <rahra@cypherpunk.at>. … … 597 597 PACKAGE_NAME='onioncat' 598 598 PACKAGE_TARNAME='onioncat' 599 PACKAGE_VERSION='0.1.10-48 0:481M'600 PACKAGE_STRING='onioncat 0.1.10-48 0:481M'599 PACKAGE_VERSION='0.1.10-483M' 600 PACKAGE_STRING='onioncat 0.1.10-483M' 601 601 PACKAGE_BUGREPORT='rahra@cypherpunk.at' 602 602 … … 1290 1290 # This message is too long to be a string in the A/UX 3.1 sh. 1291 1291 cat <<_ACEOF 1292 \`configure' configures onioncat 0.1.10-48 0:481M to adapt to many kinds of systems.1292 \`configure' configures onioncat 0.1.10-483M to adapt to many kinds of systems. 1293 1293 1294 1294 Usage: $0 [OPTION]... [VAR=VALUE]... … … 1356 1356 if test -n "$ac_init_help"; then 1357 1357 case $ac_init_help in 1358 short | recursive ) echo "Configuration of onioncat 0.1.10-48 0:481M:";;1358 short | recursive ) echo "Configuration of onioncat 0.1.10-483M:";; 1359 1359 esac 1360 1360 cat <<\_ACEOF … … 1449 1449 if $ac_init_version; then 1450 1450 cat <<\_ACEOF 1451 onioncat configure 0.1.10-48 0:481M1451 onioncat configure 0.1.10-483M 1452 1452 generated by GNU Autoconf 2.63 1453 1453 … … 1463 1463 running configure, to aid debugging if configure makes a mistake. 1464 1464 1465 It was created by onioncat $as_me 0.1.10-48 0:481M, which was1465 It was created by onioncat $as_me 0.1.10-483M, which was 1466 1466 generated by GNU Autoconf 2.63. Invocation command line was 1467 1467 … … 2179 2179 # Define the identity of the package. 2180 2180 PACKAGE='onioncat' 2181 VERSION='0.1.10-48 0:481M'2181 VERSION='0.1.10-483M' 2182 2182 2183 2183 … … 2326 2326 2327 2327 cat >>confdefs.h <<\_ACEOF 2328 #define SVN_REVISION "48 0:481M"2328 #define SVN_REVISION "483M" 2329 2329 _ACEOF 2330 2330 … … 5619 5619 # values after options handling. 5620 5620 ac_log=" 5621 This file was extended by onioncat $as_me 0.1.10-48 0:481M, which was5621 This file was extended by onioncat $as_me 0.1.10-483M, which was 5622 5622 generated by GNU Autoconf 2.63. Invocation command line was 5623 5623 … … 5682 5682 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 5683 5683 ac_cs_version="\\ 5684 onioncat config.status 0.1.10-48 0:481M5684 onioncat config.status 0.1.10-483M 5685 5685 configured by $0, generated by GNU Autoconf 2.63, 5686 5686 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -
branches/win/trunk/src/ocat.c
r482 r484 169 169 log_msg(LOG_NOTICE, "waiting for system cleanup..."); 170 170 // close tunnel interface 171 #ifdef __CYGWIN__ 172 (void) win_close_tun(); 173 #else 171 174 log_debug("closing tunfd %d (and %d)", CNF(tunfd[0]), CNF(tunfd[1])); 172 175 oe_close(CNF(tunfd[0])); 173 176 if (CNF(tunfd[0]) != CNF(tunfd[1])) 174 177 oe_close(CNF(tunfd[1])); 178 #endif 175 179 176 180 // close and delete all peers … … 373 377 374 378 #ifndef WITHOUT_TUN 375 #ifdef __CYGWIN__ 376 if ( win_open_tun(CNF(tunname), sizeof(CNF(tunname))) == -1)377 { 378 log_msg(LOG_ ALERT, "opening TAP driver failed. exiting");379 // create TUN device 380 if ((CNF(tunfd[0]) = CNF(tunfd[1]) = tun_alloc(CNF(tunname), sizeof(CNF(tunname)), CNF(ocat_addr))) == -1) 381 { 382 log_msg(LOG_CRIT, "error opening TUN/TAP device"); 379 383 exit(1); 380 384 } 381 #else382 // create TUN device383 CNF(tunfd[0]) = CNF(tunfd[1]) = tun_alloc(CNF(tunname), CNF(ocat_addr));384 #endif385 385 #endif 386 386 -
branches/win/trunk/src/ocat.h
r482 r484 156 156 //! Standard buffer size 1024 bytes 157 157 #define SIZE_1K 1024 158 #define SIZE_256 256 158 159 159 160 #define DEQUEUER_WAKEUP 3 … … 266 267 char *tun_dev; 267 268 //! tunnel interface name 268 char tunname[ IFNAMSIZ];269 char tunname[SIZE_256]; 269 270 int ipv4_enable; 270 271 struct in_addr ocat_addr4; … … 501 502 /* ocattun.c */ 502 503 #ifndef WITHOUT_TUN 503 int tun_alloc(char *, struct in6_addr);504 int tun_alloc(char *, int, struct in6_addr); 504 505 #endif 505 506 … … 600 601 /* ocat_wintuntap.c */ 601 602 int win_open_tun(char *, int); 603 int win_close_tun(void); 602 604 int win_read_tun(char *, int); 603 605 int win_write_tun(const char *, int); -
branches/win/trunk/src/ocat_wintuntap.c
r483 r484 135 135 int win_open_tun(char *dev, int s) 136 136 { 137 char deviceId[ 256], deviceName[256], tapPath[256];137 char deviceId[SIZE_256], deviceName[SIZE_256], tapPath[SIZE_256]; 138 138 TapData_t *tapData = &tapData_; 139 139 unsigned long len = 0; … … 183 183 // % netsh interface ipv6 add route fd87:d87e:eb43::/48 "LAN-Verbindung 2" 184 184 185 strlcpy(dev, device Id, s);185 strlcpy(dev, deviceName, s); 186 186 return 0; 187 187 } … … 202 202 int win_write_tun(const char *jb, int len) 203 203 { 204 TapData_t *tapData = &tapData_; 205 DWORD written, err; 206 BOOL result; 207 208 result = GetOverlappedResult(tapData->fd, &tapData->write_overlapped, 209 &written, FALSE); 210 211 if (!result && GetLastError() == ERROR_IO_INCOMPLETE) 212 WaitForSingleObject(tapData->write_event, INFINITE); 213 214 if (!WriteFile(tapData->fd, jb, len, &written, &tapData->write_overlapped)) 215 { 204 TapData_t *tapData = &tapData_; 205 DWORD written, err; 206 207 log_debug("WriteFile %d bytes", len); 208 if (!GetOverlappedResult(tapData->fd, &tapData->write_overlapped, &written, FALSE)) 209 { 210 err = GetLastError(); 211 log_debug("GetOverlappedResult failed. Error = %ld", err); 212 if (err == ERROR_IO_INCOMPLETE) 213 { 214 log_debug("IO_COMPLETE, WaitForSingleObject"); 215 if ((err = WaitForSingleObject(tapData->write_event, INFINITE)) == WAIT_FAILED) 216 log_msg(LOG_ERR, "WaitForSingleObject failed. Error = %ld", GetLastError()); 217 else 218 log_debug("WaitForSingleObject returen %08lx", err); 219 } 220 } 221 222 if (!WriteFile(tapData->fd, jb, len, &written, &tapData->write_overlapped)) 223 { 216 224 if ((err = GetLastError()) != ERROR_IO_PENDING) 217 225 { 218 fprintf(stderr, "error writing %ld \n", err);219 return -1;226 log_msg(LOG_ERR, "error writing %ld", err); 227 return -1; 220 228 } 221 229 else 222 fprintf(stderr, "io pending\n"); 223 } 224 225 return written; 226 230 log_debug("IO_PENDING"); 231 } 232 233 return written; 227 234 } 228 235 … … 234 241 DWORD len, err; 235 242 236 log_debug("ReadFile ");243 log_debug("ReadFile max. %d bytes", n); 237 244 if (!ReadFile(tapData->fd, buf, n, &len, &tapData->read_overlapped)) 238 245 { … … 240 247 if ((err = GetLastError()) == ERROR_IO_PENDING) 241 248 { 242 log_debug("ReadFile pending..."); 243 244 if ((err = WaitForSingleObject(tapData->read_event, INFINITE)) == WAIT_FAILED) 245 log_msg(LOG_ERR, "WaitForSingleObject failed. Error = %ld", GetLastError()); 246 else 247 log_debug("WaitForSingleObject returen %08lx", err); 249 for (err = WAIT_TIMEOUT; err == WAIT_TIMEOUT;) 250 { 251 log_debug("ReadFile pending..."); 252 if ((err = WaitForSingleObject(tapData->read_event, SELECT_TIMEOUT * 1000)) == WAIT_FAILED) 253 log_msg(LOG_ERR, "WaitForSingleObject failed. Error = %ld", GetLastError()); 254 log_debug("WaitForSingleObject returned %08lx", err); 255 } 248 256 249 257 if (!GetOverlappedResult(tapData->fd, &tapData->read_overlapped, &len, FALSE)) -
branches/win/trunk/src/ocateth.c
r480 r484 282 282 free_ckbuf(ckb); 283 283 284 #ifdef __CYGWIN__ 285 log_debug("writing %d bytes ndp solicitation to TAP driver", sizeof(buf) - 4); 286 // FIXME: there's no error checking 287 win_write_tun(buf + 4, sizeof(buf) - 4); 288 #else 284 289 log_debug("writing %d bytes ndp solicitation to tunfd %d", sizeof(buf), CNF(tunfd[1])); 285 290 if (write(CNF(tunfd[1]), buf, sizeof(buf)) < sizeof(buf)) 286 291 log_msg(LOG_ERR, "short write to tun fd %d", CNF(tunfd[1])); 292 #endif 287 293 288 294 return 0; … … 377 383 free_ckbuf(ckb); 378 384 385 #ifdef __CYGWIN__ 386 log_debug("writing %d bytes to TAP driver", rlen); 387 // FIXME: there's no error checking 388 win_write_tun(buf + 4, rlen - 4); 389 #else 379 390 log_debug("writing %d bytes to tunfd %d", rlen, CNF(tunfd[1])); 380 391 if (write(CNF(tunfd[1]), buf, rlen) < rlen) 381 392 log_msg(LOG_ERR, "short write"); 393 #endif 382 394 383 395 return 0; -
branches/win/trunk/src/ocattun.c
r433 r484 1 /* Copyright 2008 Bernhard R. Fischer, Daniel Haslinger.1 /* Copyright 2008-2009 Bernhard R. Fischer. 2 2 * 3 3 * This file is part of OnionCat. … … 33 33 #define IFCBUF 1024 34 34 35 int tun_alloc(char *dev, struct in6_addr addr)35 int tun_alloc(char *dev, int dev_s, struct in6_addr addr) 36 36 { 37 37 struct ifreq ifr; … … 42 42 struct in_addr netmask = {CNF(ocat_addr4_mask)}; 43 43 44 inet_ntop(AF_INET6, &addr, astr, INET6_ADDRSTRLEN); 45 inet_ntop(AF_INET, &CNF(ocat_addr4), astr4, INET_ADDRSTRLEN); 46 47 #ifdef __CYGWIN__ 48 if ((fd = win_open_tun(dev, dev_s)) == -1) 49 return -1; 50 51 // set IPv6 address 52 // 181 // % netsh interface ipv6 add address "LAN-Verbindung 2" fd87:d87e:eb43:0:84:2100:0:8421 53 // 182 // add route 54 // 183 // % netsh interface ipv6 add route fd87:d87e:eb43::/48 "LAN-Verbindung 2" 55 56 snprintf(buf, sizeof(buf), "netsh interface ipv6 add address \"%s\" %s", dev, astr); 57 log_debug("setting IP on tun: \"%s\"", buf); 58 if (system(buf) == -1) 59 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 60 61 snprintf(buf, sizeof(buf), "netsh interface ipv6 add route %s/%d \"%s\"", astr, TOR_PREFIX_LEN, dev); 62 log_debug("setting IP routing: \"%s\"", buf); 63 if (system(buf) == -1) 64 log_msg(LOG_ERR, "could not exec \"%s\": \"%s\"", buf, strerror(errno)); 65 66 return 0; 67 #endif 68 44 69 log_debug("opening tun \"%s\"", tun_dev_); 45 70 if ((fd = open(tun_dev_, O_RDWR)) < 0) 46 log_msg(LOG_EMERG, "could not open tundev %s: %s", tun_dev_, strerror(errno)), exit(1); 47 inet_ntop(AF_INET6, &addr, astr, INET6_ADDRSTRLEN); 48 inet_ntop(AF_INET, &CNF(ocat_addr4), astr4, INET_ADDRSTRLEN); 71 { 72 log_msg(LOG_EMERG, "could not open tundev %s: %s", tun_dev_, strerror(errno)); 73 return -1; 74 } 49 75 50 76 #ifdef __linux__ … … 135 161 log_msg(LOG_EMERG, "could not ioctl:TUNSIFHEAD: %s", strerror(errno)), exit(1); 136 162 137 #endif 163 #endif /* __linux__ */ 138 164 139 165 … … 176 202 if (CNF(use_tap)) 177 203 { 178 snprintf(buf, sizeof(buf), "ifconfig %s up", dev);204 snprintf(buf, sizeof(buf), "ifconfig %s up", dev); 179 205 log_msg(LOG_INFO, "bringing up TAP device \"%s\"", buf); 180 206 if (system(buf) == -1) … … 185 211 } 186 212 187 #endif 188 213 #endif /* WITHOUT_TUN */ 214
Note: See TracChangeset
for help on using the changeset viewer.
