cipher_key = options.cipher_key,
udp = options.udp,
TERMINATE = TERMINATE,
- stderr = open("/dev/null","w")
+ stderr = None
)
+ ["-w",options.pcap_capture,"-U"] * bool(options.pcap_capture) )
print >>sys.stderr, "Connected"
+
+ # Try to give us high priority
+ try:
+ os.nice(-20)
+ except:
+ # Ignore errors, we might not have enough privileges,
+ # or perhaps there is no os.nice support in the system
+ pass
tun_fwd(tun, remote)
crypto_mode = False
crypter = None
- if crypto_mode:
- print >>stderr, "Packets are transmitted in CIPHER"
- else:
- print >>stderr, "Packets are transmitted in PLAINTEXT"
+ if stderr is not None:
+ if crypto_mode:
+ print >>stderr, "Packets are transmitted in CIPHER"
+ else:
+ print >>stderr, "Packets are transmitted in PLAINTEXT"
# Limited frame parsing, to preserve packet boundaries.
# Which is needed, since /dev/net/tun is unbuffered
if not udp:
# in UDP mode, we ignore errors - packet loss man...
raise
- print >>stderr, '>', formatPacket(packet, ether_mode)
+ if stderr is not None:
+ print >>stderr, '>', formatPacket(packet, ether_mode)
if tun in wrdy and packetReady(bkbuf, ether_mode):
packet, bkbuf = pullPacket(bkbuf, ether_mode)
- formatted = formatPacket(packet, ether_mode)
+ if stderr is not None:
+ formatted = formatPacket(packet, ether_mode)
if with_pi:
packet = piWrap(packet, ether_mode)
os.write(tun.fileno(), packet)
- print >>stderr, '<', formatted
+ if stderr is not None:
+ print >>stderr, '<', formatted
# check incoming data packets
if tun in rdrdy: