[Serusers] Nathelper question

Zeus Ng zeus.ng at isquare.com.au
Tue Jul 13 02:44:16 CEST 2004


Jan,

See below. Also, always CC the list so that other people can help you.

Zeus


> > 
> > Flag 4 is set when the caller is behind NAT.
> > Flag 5 is set when the callee is behind NAT.


> Would you be so kind and tell me how do you test messages to 
> set these 
> flags?

        /*
        Check for UAC behind NAT
        This is done by nat_uac_test("7") which checks for
        1. RFC 1918 address in Contact - 01
        2. different src_ip and Via header - 02
        3. RFC1918 in Top Via - 04
        */

        if (nat_uac_test("3")) {	/* 1 + 2 = 3 */
                xlog("L_NOTICE", "%rm: Client is behind NAT\n");
                setflag(4);     /* Flag it's a nated R-URI */
                if (method=="REGISTER" || !search("^Record-Route:")) {
                        force_rport();
                        if (!method=="MESSAGE") {       /* MESSAGE has no
Contact header, see RFC 3428 */
                                fix_nated_contact();
                        };
                };
        } else {
                xlog("L_NOTICE", "%rm: Client is not behind a NAT\n");
        };
... Other checking ...

        if (method=="REGISTER") {
                if (isflagset(4)) {     
                        setflag(5);     /* Turn on NAT Ping and flag it as a
NAT callee */
                };

                if (!save("location")) {
                        xlog("L_ERR", "%rm: Failed\n");
                        sl_reply_error();
                };
                break;
        };



> 
> Thanks
>   Jan
> 




More information about the sr-users mailing list