Greetings, I'm am the implementor of Stuntman, an open source stun server. ( www.stunprotocol.org). I was doing some basic interop testing with the PJNath library and found that its implementation of STUN does not recognize the RESPONSE-ORIGIN and OTHER-ADDRESS attribute ids. These attributes are defined in RFC 5389/5380 as replacements for the SOURCE-ADDRESS and CHANGED-ADDRESS attributes defined by RFC 3489. Same attributes and format for holding an address, just different attribute ID numbers. Stuntman will auto-detect if a Stun client is complying to RFC 3489 vs RFC 5389 by seeing if the binding request contains the magic cookie in the transaction id header (0x2112A442). Based on that, it will decide which attribute ids to use when generating a response. PJNath sends the magic cookie, likely as a result of complying with one of the intermediate Stun-Bis specs. As such, Stuntman sends back RESPONSE-ORIGIN and OTHER-ADDRESS attributes. This is mostly benign for obtaining a port mapped candidate, as the CHANGED and SOURCE addresses are usually ignored when the binding request is just for obtaining a candidate address. But for the NAT type detection tests implemented in nat_detect.c, the code doesn't recognize the OTHER-ADDRESS attribute. I have a simple patch appended below that adds support for these newer attributes and fixes the nat detection test code to reference OTHER-ADDRESS from the binding response if the CHANGED-ADDRESS attribute is not present. It doesn't bring the STUN implementation into complete compliance with RFC 5389/5380, but fixes my interop issue concern. Feedback appreciated. I'll be happy to resubmit this patch if it isn't right, doesn't meet the coding guidelines, or if the diff below is in the wrong format. It's based off the 2.0.1 sources. jrs diff -crB ./include/pjnath/stun_msg.h /home/jselbie/pjproject-2.0.1/pjnath/include/pjnath/stun_msg.h *** ./include/pjnath/stun_msg.h 2011-05-04 23:14:19.000000000 -0700 --- /home/jselbie/pjproject-2.0.1/pjnath/include/pjnath/stun_msg.h 2013-02-08 23:52:14.278756529 -0800 *************** *** 344,349 **** --- 344,352 ---- PJ_STUN_ATTR_FINGERPRINT = 0x8028,/**< FINGERPRINT attribute. */ PJ_STUN_ATTR_ICE_CONTROLLED = 0x8029,/**< ICE-CCONTROLLED attribute.*/ PJ_STUN_ATTR_ICE_CONTROLLING = 0x802a,/**< ICE-CCONTROLLING attribute*/ + PJ_STUN_ATTR_RESPONSE_ORIGIN = 0x802b,/**< RESPONSE-ORIGIN */ + PJ_STUN_ATTR_OTHER_ADDR = 0x802c,/**< OTHER-ADDRESS */ + PJ_STUN_ATTR_END_EXTENDED_ATTR diff -crB ./src/pjnath/nat_detect.c /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/nat_detect.c *** ./src/pjnath/nat_detect.c 2011-05-04 23:14:19.000000000 -0700 --- /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/nat_detect.c 2013-02-09 01:03:54.326831412 -0800 *************** *** 527,532 **** --- 527,537 ---- /* Get CHANGED-ADDRESS attribute */ ca = (pj_stun_changed_addr_attr*) pj_stun_msg_find_attr(response, PJ_STUN_ATTR_CHANGED_ADDR, 0); + + if (ca == NULL) { + ca = (pj_stun_changed_addr_attr*) + pj_stun_msg_find_attr(response, PJ_STUN_ATTR_OTHER_ADDR, 0); + } if (ca == NULL) { status = PJ_STATUS_FROM_STUN_CODE(PJ_STUN_SC_SERVER_ERROR); diff -crB ./src/pjnath/stun_msg.c /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/stun_msg.c *** ./src/pjnath/stun_msg.c 2011-05-04 23:14:19.000000000 -0700 --- /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/stun_msg.c 2013-02-09 02:25:41.826916873 -0800 *************** *** 606,611 **** --- 606,625 ---- &decode_uint64_attr, &encode_uint64_attr, &clone_uint64_attr + }, + { + /* PJ_STUN_ATTR_RESPONSE_ORIGIN, */ + "RESPONSE-ORIGIN", + &decode_sockaddr_attr, + &encode_sockaddr_attr, + &clone_sockaddr_attr + }, + { + /* PJ_STUN_ATTR_OTHER_ADDR, */ + "OTHER-ADDRESS", + &decode_sockaddr_attr, + &encode_sockaddr_attr, + &clone_sockaddr_attr } }; diff -crB ./src/pjnath/stun_msg_dump.c /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/stun_msg_dump.c *** ./src/pjnath/stun_msg_dump.c 2011-05-04 23:14:19.000000000 -0700 --- /home/jselbie/pjproject-2.0.1/pjnath/src/pjnath/stun_msg_dump.c 2013-02-08 23:52:07.210756401 -0800 *************** *** 85,90 **** --- 85,92 ---- case PJ_STUN_ATTR_XOR_MAPPED_ADDR: case PJ_STUN_ATTR_XOR_REFLECTED_FROM: case PJ_STUN_ATTR_ALTERNATE_SERVER: + case PJ_STUN_ATTR_RESPONSE_ORIGIN: + case PJ_STUN_ATTR_OTHER_ADDR: { const pj_stun_sockaddr_attr *attr; -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20130209/7e5ebd9a/attachment-0001.html>