nat / switch external source port
When reproducing an issue with IP phones speaking SIP, I ran into the question of how to switch source port on my linux NAT router. The problem the clients were having, were a result of a failing (or reset) NAT-gateway. The NAT-gateway would change the external source port mid-dialog (some SIP dialogs can persist for quite a long time). So, how do you go about switching source port on an UDP connection on your Linux NAT router without resetting it (or disturbing anyone else using it)?
sip totag / grandstream / register
SIP Question: The Grandstream GXP2000 22.214.171.124 sends SIP REGISTER requests with a To tag. Is my proxy wrong in refusing the request? REGISTER sip:server SIP/2.0 Via: SIP/2.0/UDP 126.96.36.199:5074;branch=z9hG4bK0b90873d634698eb From: "phone 123" <sip:123@server>;tag=c29eb9104c6a5a86 To: <sip:123@server>;tag=as77984b6 Contact: <sip:firstname.lastname@example.org:5074;transport=udp> Supported: path Authorization: Digest username="123", realm="server", algorithm=MD5, uri="sip:server", nonce="0997652c", response="3b91afb768c11ae0a0405e1bed41bc23" Call-ID: email@example.com CSeq: 56349 REGISTER Expires: 3600 User-Agent: Grandstream GXP2000 188.8.131.52 Max-Forwards: 70 Allow: INVITE,ACK,CANCEL,BYE,NOTIFY,REFER,OPTIONS,INFO,SUBSCRIBE,UPDATE,PRACK,MESSAGE Content-Length: 0 Answer: no, the proxy is right. RFC 3261 says this about it.
nxclient / locale passing
So, I achieved victory on getting the compose key to work in the NX session. On to get a proper English language setting on our Terminal Server. The configuration suffers from two problems: (1) /etc/environment had values set (LANG=nl_NL.UTF-8 and LANGUAGE=nl_NL:nl). (2) nxssh does not pass the LANG/LC_* environment variables. If I were to remove the /etc/environment variables and configure everything like in a previous post of mine, everyone gets the POSIX locale (nxssh doesn’t pass anything).
altgr / nxclient / compose key
Like various reports on the internet suggest, the AltGr compose key doesn’t work properly or not at all from an NXClient connected to an NXServer (FreeNX in my case). Note that this is a different issue from the one where Alt_R (and Super_L, Super_R, Ctrl_R en Menu) remains pressed after which no normal typing is possible. That issue is described in Alt Gr keeps stuck and involves a new int sendKey = 0; in nxagent that should be reverted.
python2.6 features / python2.5
Today I'll show you some quick and dirty python2.5 compatibility fixes. Of course you're developing on python2.6 or even python3.x, but your customer still lives in the dark ages. Here are two fixes that might come in handy. ImportError: No module named ssl Falling back to python2.5 socket.SSL if there is no python2.6 ssl through a small wrap_socket replacement: import socket try: from ssl import wrap_socket except ImportError: class wrap_socket: def __init__(self, socket): self.
uninitialized globals / C language
As per the C language spec., uninitialized globals are initialized to zero (0). Nandu310 tells us why on his blog about the memory areas in the C language. Data segment: the data segment is to hold the value of those variables that need to be available throughout the life time of the program. […] There are two parts in this segment. The initialized data segment and uninitialized data segment. When variables are initialized to some value (other than 0 or which is different value), they are allocated in the initialized segment (.
unexpanded tabs / mercurial web / diff
The hgweb mercurial web interface on current Debian/Squeeze (mercurial-common 1.5.1-2) lists tab characters as-is in the diff view. Every line is prefixed not only by a plus or a minus (unified diff), but also by file and line numbers. This can cause a tab (0x9) character to appear as a single space. This does not look nice. The following patch can be applied to expand the tab character so the intentation looks right again.
mysql utf8 collation / conversion
On a clean MySQL install — on a Debian or Ubuntu system at least — the MySQL server gets the latin1_swedish_ci with latin1 character set by default. Every time you set up a new machine, you must remember to either fix the defaults in my.cnf config file or to supply character set and collation options when creating databases. Of course you’ll opt to set this by default in my.cnf first: