Vitali,
I believe I had the same problem as you and I found a resolution for
it. I never posted anything about my findings as I wasn't sure if I
really fixed something or perhaps I just didn't understand the
functionality, or perhaps it was already fixed in CVS. In any event,
when I upgraded to the release version of 0.8.12 my natping stopped
working. It worked fine in 0.8.11 but as soon as I upgraded to 0.8.12,
I could see in tethereal trace that the pings were no longer being sent.
I discovered that there seems to be a bug with the imported declaration
of get_all_ucontacts() in the top of nathelper.c. The declaration was:
static int (*get_all_ucontacts)(void *buf, int len) = NULL;
However, because of the new addition of the flags parameter in the
usrloc module, this was now inconsistent with the exported function,
which now expects three parameters, the third parameter being the flag.
I modified the declaration in nathelper.c to say:
static int (*get_all_ucontacts)(void *buf, int len, unsigned int flags)
= NULL;
I then updated the mod_init function in nathelper.c to include the
correct casting of the get_all_ucontacts function pointer, so that it
included the third parameter. i.e.
if (natping_interval > 0) {
get_all_ucontacts =
(int (*)(void *, int, unsigned int
flags))find_export("ul_get_all_ucontacts", 1, 0);
...
and finally in the two places that this function (get_all_ucontacts) was
called in the timer function, I added the third parameter (flags) as 0,
so that all three parameters were satisfied, i.e. rval =
get_all_ucontacts(buf, cblen, 0);
You could of course use the constants for the specific flags instead of
just 0, but I was interested in the default. Once I made these changes,
natping was working again. I hope this helps you.
If anyone has more accurate information on this please let me know.
Josh
>>> Original Message >>>>
Hello Vitali,
ok.. nobody answering. or i asked something really stuped or nobody
knows :)
i traced get_all_ucontacts from dlist.c from usrloc. this function
supposed to give all contact that has specified flag set. and it
trying to compare flag in the database with: 1074111736 in :
for (r = p->d->d_ll.first; r != NULL; r = r->d_ll.next)
{
for (c = r->contacts; c != NULL; c = c->next) {
if (c->c.len <= 0)
continue;
/*
* List only contacts that have all
requested
* flags set
*/
if ((c->flags & flags) != flags) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LOG(L_ERR, "Usrloc,
get_all_ucontacts: flags != flags %d != %d\n", c->flags, flags);
// continue;
}
I am still trying to find out how it happend.. please stop me from
reading sources if I forget something really important. just
commenting "continue" is really bad in my opinion
Thursday, January 29, 2004, 12:07:27 PM, you wrote:
VN> Hello,
VN> I have problem with natping_interval.. it is not pinging at all and
VN> look like it just doesnot aware that I have something registered
VN> I use lates table release: 0.8.12
VN> I added some more debugging in nathelper.c to timer function:
VN> DBG("DEBUG: nathelper buff != NULL\n");
VN> cp = buf;
VN> while (1) {
VN> memcpy(&(c.len), cp, sizeof(c.len));
VN> if (c.len == 0) {
VN> LOG(L_ERR, "ERROR: nathelper::c.len ==
0\n");
VN> break;
VN> }
VN> and can see that it break from the loop with c.len = 0. but when i
VN> look at location table in mysql there is few devices registered.
VN> probably something with ul_get_all_ucontact from usrloc..
VN> please advise
VN> here is config:
VN> loadmodule "/usr/local/lib/ser/modules/sl.so"
VN> loadmodule "/usr/local/lib/ser/modules/tm.so"
VN> loadmodule "/usr/local/lib/ser/modules/rr.so"
VN> loadmodule "/usr/local/lib/ser/modules/auth.so"
VN> loadmodule "/usr/local/lib/ser/modules/auth_db.so"
VN> loadmodule "/usr/local/lib/ser/modules/mysql.so"
VN> loadmodule "/usr/local/lib/ser/modules/auth_mssql.so"
VN> loadmodule "/usr/local/lib/ser/modules/usrloc.so"
VN> loadmodule "/usr/local/lib/ser/modules/textops.so"
VN> loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
VN> loadmodule "/usr/local/lib/ser/modules/registrar.so"
VN> loadmodule "/usr/local/lib/ser/modules/nathelper.so"
VN> loadmodule "/usr/local/lib/ser/modules/exec.so"
VN> modparam("nathelper", "natping_interval", 10)
VN> modparam("registrar", "nat_flag", 6)
VN> # modparam("nathelper", "ping_nated_only", 1) # Ping only
clients
behind NAT
VN> modparam("auth_db",
"db_url","sql://ser:XXX@localhost/ser")
VN> modparam ("usrloc", "db_mode", 1)
VN> modparam("usrloc", "use_domain", 0)
VN> modparam("usrloc", "db_url",
"sql://ser:XXX@localhost/ser")
VN> modparam("rr", "enable_full_lr", 1)
VN> force_rport();
VN> fix_nated_contact();
VN> setflag(6); # Mark as natted all clients
VN> if (!(method=="REGISTER")) record_route(); # 1=loose
routing
VN> # loose-route processing
VN> if (loose_route()) {
VN> log(1, "LOOSE ROUTE\n");
VN> t_relay();
VN> break;
VN> };
VN> if(!uri==myself) {
VN> log(1, "URI!=myself");
VN> t_relay();
VN> break;
VN> };
VN> if (method=="REGISTER") {
VN> log(1, "REGISTER REQUEST RECEIVED\n");
VN> if (!mssql_authorize("209.227.183.21",
"subscriber")) {
VN> log(1, "AUTH FAILED, REQUESTED\n");
VN> www_challenge("", "1");
VN> break;
VN> };
VN> log(1, "AUTH OK, REGISTER\n");
VN> save("location");
VN> break;
VN> };
VN> .....
--
Best regards,
Vitali