Summary: | ASTERISK-05328: Octal IP address: Asterisk bug? | ||
Reporter: | Jörg Straube (grandswiss) | Labels: | |
Date Opened: | 2005-10-19 16:12:44 | Date Closed: | 2011-06-07 14:03:27 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | I observe the following behaviour: A SIP phone sends the following REGISTER to Asterisk: --------- IP, Src: 130.198.11.120 (130.198.11.120), Dst: 192.168.0.4 (192.168.0.4) UDP, Src: 5060 (5060), Dst: 5060 (5060) Session Initiation Protocol Request-Line: REGISTER sip:130.198.21.215 SIP/2.0 Via: SIP/2.0/UDP 130.198.011.120:5060;... ------- The IP header shows 130.198.11.120, the Via-field is 130.198.011.120. Asterisk replies as follows: ------------ IP, Src: 192.168.0.4 (192.168.0.4), Dst: 130.198.9.120 (130.198.9.120) UDP, Src: 5060 (5060), Dst: 5060 (5060) Session Initiation Protocol Status-Line: SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP 130.198.011.120:5060;... ------------ The IP header shows 130.198.9.120, the Via-field is 130.198.011.120. As the IP address is WRONG (9 instead of 11), communication is impossible. I guess Asterisk has a bug to interpret ASCII "011" as octal "11" = 9!! | ||
Comments: | By: Mark Spencer (markster) 2005-10-19 18:29:35 From the inet_aton man page: "All numbers supplied as ``parts'' in a `.' notation may be decimal, octal, or hexadecimal, as specified in the C language (i.e., a leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies octal; other-otherwise, wise, the number is interpreted as decimal)." Unfortunately RFC3261 does not specify how to interpret an ip address beginning with 0, so in the absense of any evidence to suggest a leading 0 is permissible, I'm going to assume that inet_aton supports the proper formats, unless you can find an RFC to prove otherwise. Given that virtually every SIP implementation is going to use inet_aton or similar, I suggest whatever phone you're using fixes their firmware to output a standard IP address. |