473,789 Members | 2,441 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stuck with a strange core (C code) -- Please help.

SZ
Hi,

I've hit this core multiple times when running an application (coded
in C)
running on BSD OS. Using gdb getting to the core, it shows:

.....
(gdb) bt
#0 0x8541fa3 in mTimerQUnlink (t=0xd7f5a51, head=0x8fec13c)
at ../../rsvp/eventwheel.c:16 0
#1 0x854288d in mTimerInsert (t=0xd7f5a51,
callback=0x873c e88 <retran_unacked >, param=0xd7f5a01 , time=50,
type=1)
at ../../rsvp/eventwheel.c:53 6
#2 0x873d266 in retran_unacked (unacked_cb=0xd 7f5a00)
at ../../rsvp/rrrmsgi3.c:1425
....
Notice that the address (0xd7f5a00) of "unacketd_c b" (pointer of a
struct)
at level 2 is passed to the function of mTimerInsert as "param". But
"param" becomes 0xd7f5a01 (which added a "1" at the end). All the
subsequent processing is based on this wrong address causing the core.
The application is compiled with gcc with "-O2" along with some other
options.

I know address here can not start with ood number. This is a weired
problem. The stack shown with bt command in gdb seems to be complete.

Anyone knows what direction should I go with for the trouble shooting?

Thanks a lot

-SZ
Nov 14 '05 #1
11 1659
SZ wrote:
Hi,

I've hit this core multiple times when running an application (coded
in C)
running on BSD OS. Using gdb getting to the core, it shows:

....
(gdb) bt
#0 0x8541fa3 in mTimerQUnlink (t=0xd7f5a51, head=0x8fec13c)
at ../../rsvp/eventwheel.c:16 0
#1 0x854288d in mTimerInsert (t=0xd7f5a51,
callback=0x873c e88 <retran_unacked >, param=0xd7f5a01 , time=50,
type=1)
at ../../rsvp/eventwheel.c:53 6
#2 0x873d266 in retran_unacked (unacked_cb=0xd 7f5a00)
at ../../rsvp/rrrmsgi3.c:1425
...
Notice that the address (0xd7f5a00) of "unacketd_c b" (pointer of a
struct)
at level 2 is passed to the function of mTimerInsert as "param". But
"param" becomes 0xd7f5a01 (which added a "1" at the end). All the
subsequent processing is based on this wrong address causing the core.
The application is compiled with gcc with "-O2" along with some other
options.

I know address here can not start with ood number. This is a weired
problem. The stack shown with bt command in gdb seems to be complete.

Anyone knows what direction should I go with for the trouble shooting?


Towards a system or application specific newsgroup or mailing list,
for example, if this is not your own code.
You did not provide us with C code, let alone a minimal example.
Is it something you cooked up yourself? What does the structure
look like? What the function call? ...

It may be an easy to spot error -- but not without source.
Quality crystal balls don't come cheap.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #2
If I do:

void foo(struct foo *p)
{
char *a = (char *)p;
a++;
...
}

I increment by one the address.

Two problems spring into view:
1:
You are passing a wrong parameter or the routine is
expecting a char pointer that gets incremented in the
code of the routine
2:
There is a memory overwrite somewhere.

Procedure:

Follow the called routine (in assembler if you do
not have the source) and see where is being changed

jacob

Nov 14 '05 #3
SZ
Thanks, Jacob, for your response.

The address was not incremented in the C code purposely. It is
not char * either. Incrementing it would result in something much
larger since the structure has at least 40 bytes.

NOTE: the same routine is being run through multiple times and the problem
does not occur every time. I do have source code available. I've checked
the source code many times and did not found any where the address is purposely
changed before it gets passed to the next function.

So, I tend to believe this is memory violation of some sort. I once added
assert in the related routine to catch ood (bad) pointer, but it
then seem to core somewhere else.

I do not know if there is a good way to catch such memory violation. Would
appreciate it if anyone know a way to catch it.

Thanks again

-SZ
jacob navia <ja***@jacob.re mcomp.fr> wrote in message news:<41******* *************** @news.wanadoo.f r>...
If I do:

void foo(struct foo *p)
{
char *a = (char *)p;
a++;
...
}

I increment by one the address.

Two problems spring into view:
1:
You are passing a wrong parameter or the routine is
expecting a char pointer that gets incremented in the
code of the routine
2:
There is a memory overwrite somewhere.

Procedure:

Follow the called routine (in assembler if you do
not have the source) and see where is being changed

jacob

Nov 14 '05 #4
SZ
Thanks for your response, Michael.

Sorry, I did not make it clear. The function actually are run
through multiple times and not every time it will core. The code
never purposely increment the address. The source is just like the
following (the original source it too long to put here).
int retran_unacked (unacked_cb=0xd 7f5a00)
{
int sub = unacked_cb->sub; <---- value of sub is correct here.

other_func(unac ked_cb);

... <-- some local operations.

mTimerInsert (&unacked_cb->time, callback_func, unacked_cb, time, type);

...
}

The function itself is not so complicated and the function (other_func())
can not change "unacked_cb ". So, I have to assume there must be some
kind of memory violation. But I am not sure if there is a general good
way to track down such problem. I am not even sure the violation is somewhere
near or at totally irrelavent places.

I can mail you the source if needed.

Thanks again.

-SZ
Michael Mair <Mi**********@i nvalid.invalid> wrote in message news:<2v******* ******@uni-berlin.de>...
SZ wrote:
....


Towards a system or application specific newsgroup or mailing list,
for example, if this is not your own code.
You did not provide us with C code, let alone a minimal example.
Is it something you cooked up yourself? What does the structure
look like? What the function call? ...

It may be an easy to spot error -- but not without source.
Quality crystal balls don't come cheap.
Cheers
Michael

Nov 14 '05 #5
SZ wrote:

int retran_unacked (unacked_cb=0xd 7f5a00)
Since you said you were using some flavor of BSD, that address seems to
refer to some stack... so my guess is that the unacked_cb was declared
as an automatic variable, and in this case...
{
int sub = unacked_cb->sub; <---- value of sub is correct here.

other_func(unac ked_cb);

... <-- some local operations.

mTimerInsert (&unacked_cb->time, callback_func, unacked_cb, time, type);
.... this line is wrong. You are passing a pointer a field of an
automatic variable (&unacked_cb->time) to a function that probably
remembers it and will they to modify the pointed integer at some other
point in time when the automatic object is no longer live.
manuel,

...
}

The function itself is not so complicated and the function (other_func())
can not change "unacked_cb ". So, I have to assume there must be some
kind of memory violation. But I am not sure if there is a general good
way to track down such problem. I am not even sure the violation is somewhere
near or at totally irrelavent places.

I can mail you the source if needed.

Thanks again.

-SZ
Michael Mair <Mi**********@i nvalid.invalid> wrote in message news:<2v******* ******@uni-berlin.de>...
SZ wrote:

...
Towards a system or application specific newsgroup or mailing list,
for example, if this is not your own code.
You did not provide us with C code, let alone a minimal example.
Is it something you cooked up yourself? What does the structure
look like? What the function call? ...

It may be an easy to spot error -- but not without source.
Quality crystal balls don't come cheap.
Cheers
Michael

Nov 14 '05 #6
Hello SZ,
one thing first: Please do not top-post.

Sorry, I did not make it clear. The function actually are run
through multiple times and not every time it will core. The code
never purposely increment the address.
Okay, so this really speaks of stack corruption or some other
flavour of pointer trouble.

The source is just like the
following (the original source it too long to put here).
Note: Many people who post code look-alikes leave out the critical
parts so the original code is really necessary if you cannot
break it down to a minimal example.
int retran_unacked (unacked_cb=0xd 7f5a00)
{
int sub = unacked_cb->sub; <---- value of sub is correct here.

other_func(unac ked_cb);

... <-- some local operations.

mTimerInsert (&unacked_cb->time, callback_func, unacked_cb, time, type);

...
}

The function itself is not so complicated and the function (other_func())
can not change "unacked_cb ".
Is the place in the parameter lists where you pass unacked_cb
or the address of unacked_cb->time const qualified? Otherwise
I would say try it. Your compiler may tell you interesting
things about it.

So, I have to assume there must be some
kind of memory violation. But I am not sure if there is a general good
way to track down such problem. I am not even sure the violation is somewhere
near or at totally irrelavent places.
Okay, this is somewhat offtopic:
<OT>
You claim to have tried finding the error with about any other means,
so I have only one suggestion now:
Find out the addresses where things are stored and watch the contents
with hardware watchpoints. Example:
--------------
$ print &object
0xdeadbeef
$ watch *((struct objtype *)0xdeadbeef)
--------------
Important is to use the actual "address", otherwise the watchpoint
will cease existance after leaving the function where it was defined.
You have to delete the hardware watchpoints before a new run.
</OT>

I can mail you the source if needed.


Don't. If you have some webspace, put it up and post the URL.
There are many people here who know more than I or have at least
sooner time to have a peek at it than I do.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #7
SZ
Thanks, Michael, please the see the following:

Michael Mair <Mi**********@i nvalid.invalid> wrote in message news:<2v******* ******@uni-berlin.de>...

....
Note: Many people who post code look-alikes leave out the critical
parts so the original code is really necessary if you cannot
break it down to a minimal example.
Ok, I've put the source of the problematic function at the end.


Is the place in the parameter lists where you pass unacked_cb
or the address of unacked_cb->time const qualified? Otherwise
I would say try it. Your compiler may tell you interesting
things about it.
I did not put const qualifier. But I just did and compiled without
any warning or error. NOTE: it is not the contents of "unacked_cb "
gets changed, but the pointer itself gets incremented unexpected.
I tried: retran_unacked( RRR_SENT_UNACKE D_CB * const unacked_cb CCXT_T CXT)
without any warning with compiler.
Okay, this is somewhat offtopic:
<OT>
You claim to have tried finding the error with about any other means,
so I have only one suggestion now:
Find out the addresses where things are stored and watch the contents
with hardware watchpoints. Example:
--------------
$ print &object
0xdeadbeef
$ watch *((struct objtype *)0xdeadbeef)
--------------
Important is to use the actual "address", otherwise the watchpoint
will cease existance after leaving the function where it was defined.
You have to delete the hardware watchpoints before a new run.
</OT>


The problem here is that unacked_cb is a pointer pointing to a dynamically
allocated memory and there many such pointers. Before the problem occurs,
I don't know which one will have the problem. Therefore, it is not possible
to type the debug command beforehand. I hope the "watch" function can be
coded into the c code to ensure every such pointer will not get changed
during its life cycle.

Notice the remarks I put behand "<--------" signs. The struct of
RRR_SENT_UNACKE D_CB really has nothing specially. It has some pointers and
ints defined inside. But in this case, I guess it is irrelavent since we are talking
pointer itself's change, not its content's change.

Thanks lot.

-SZ
Here is the source code:

void
retran_unacked( RRR_SENT_UNACKE D_CB *unacked_cb CCXT_T CXT)
{
RRR_NEXT_HOP_CB *next_hop = unacked_cb->next_hop_cb;
int frr_rc;
PSB *psbp;

next_hop->nh_event_usage _count++; <---- next_hop is correct,
so unacked_cb is ok here.
if (RPL_RL && (unacked_cb->sa_resend_atte mpts >= RPL_RL))
{
if ((unacked_cb->sa_pkt_msg_typ e == PATH) ||
(unacked_cb->sa_pkt_msg_typ e == RESV))
{
frr_rc = RRR_FRR_CONTINU E;
if (RRR_EX_FAST_RE ROUTE())
{
frr_rc = rrr_frr_proc_se nt_unacked_msg(
unacked_cb->sa_pkt_msg_typ e,
unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent CCXT);
}

if (frr_rc == RRR_FRR_CONTINU E)
{
rrr_maybe_send_ error_packet(un acked_cb->sa_pkt_msg_typ e,
unacked_cb->sa_state_handl e,
unacked_cb->sa_upstrm_lih_ set,
unacked_cb->sa_upstrm_li h
CCXT);
}
}

rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
rrr_resend_pack et(unacked_cb, next_hop CCXT);

if (next_hop->nh_use_msg_i ds == ATG_NO)
{
rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
unacked_cb->sa_resend_atte mpts++;
if (next_hop->nh_rr_decay != 100) {
unacked_cb->sa_retrans_int erval *=
(100 + next_hop->nh_rr_decay) ;
unacked_cb->sa_retrans_int erval /= 100;
} else {
unacked_cb->sa_retrans_int erval =
unacked_cb->sa_retrans_int erval << 1;
}
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &= ~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
}
if (unacked_cb->sa_retrans_int erval >= RPL_RM) {
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &=
~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == PATH_ERR){
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_ERROR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
psbp->rapid_retran &= ~RPL_PATH_ERROR ;
frr_rc = rrr_frr_proc_pa th_tear(psbp,
ATG_MPLS_XC_REL _REAS_IF_DOWN,
TRUE
CCXT);
if (frr_rc == RRR_FRR_CONTINU E) {
psbp->ps_rel_reaso n = ATG_MPLS_XC_REL _REAS_IF_DOWN;
tear_or_kill_PS B(psbp CCXT);
}
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_TEAR){
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_ERR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
unacked_cb->sa_retrans_int erval = RPL_RF;
}
unacked_cb->sa_resend_ti me =
unacked_cb->sa_retrans_int erval;

mTimerInsert(&u nacked_cb->m_timer, (vfcnptr_2)retr an_unacked,
unacked_cb,unac ked_cb->sa_resend_time , TTYPE_ONESHOT); <------
The stack shows that
both &unacked_cb->m_timer
and unacked_cb are added by 1.
}
}
EXIT_LABEL:
next_hop->nh_event_usage _count--;
rrr_maybe_free_ next_hop(next_h op CCXT);

return;

} /* retran_unacked */
Nov 14 '05 #8
SZ
Thanks, Michael, please the see the following:

Michael Mair <Mi**********@i nvalid.invalid> wrote in message news:<2v******* ******@uni-berlin.de>...

....
Note: Many people who post code look-alikes leave out the critical
parts so the original code is really necessary if you cannot
break it down to a minimal example.
Ok, I've put the source of the problematic function at the end.


Is the place in the parameter lists where you pass unacked_cb
or the address of unacked_cb->time const qualified? Otherwise
I would say try it. Your compiler may tell you interesting
things about it.
I did not put const qualifier. But I just did and compiled without
any warning or error. NOTE: it is not the contents of "unacked_cb "
gets changed, but the pointer itself gets incremented unexpected.
I tried: retran_unacked( RRR_SENT_UNACKE D_CB * const unacked_cb CCXT_T CXT)
without any warning with compiler.
Okay, this is somewhat offtopic:
<OT>
You claim to have tried finding the error with about any other means,
so I have only one suggestion now:
Find out the addresses where things are stored and watch the contents
with hardware watchpoints. Example:
--------------
$ print &object
0xdeadbeef
$ watch *((struct objtype *)0xdeadbeef)
--------------
Important is to use the actual "address", otherwise the watchpoint
will cease existance after leaving the function where it was defined.
You have to delete the hardware watchpoints before a new run.
</OT>


The problem here is that unacked_cb is a pointer pointing to a dynamically
allocated memory and there many such pointers. Before the problem occurs,
I don't know which one will have the problem. Therefore, it is not possible
to type the debug command beforehand. I hope the "watch" function can be
coded into the c code to ensure every such pointer will not get changed
during its life cycle.

Notice the remarks I put behand "<--------" signs. The struct of
RRR_SENT_UNACKE D_CB really has nothing specially. It has some pointers and
ints defined inside. But in this case, I guess it is irrelavent since we are talking
pointer itself's change, not its content's change.

Thanks lot.

-SZ
Here is the source code:

void
retran_unacked( RRR_SENT_UNACKE D_CB *unacked_cb CCXT_T CXT)
{
RRR_NEXT_HOP_CB *next_hop = unacked_cb->next_hop_cb;
int frr_rc;
PSB *psbp;

next_hop->nh_event_usage _count++; <---- next_hop is correct,
so unacked_cb is ok here.
if (RPL_RL && (unacked_cb->sa_resend_atte mpts >= RPL_RL))
{
if ((unacked_cb->sa_pkt_msg_typ e == PATH) ||
(unacked_cb->sa_pkt_msg_typ e == RESV))
{
frr_rc = RRR_FRR_CONTINU E;
if (RRR_EX_FAST_RE ROUTE())
{
frr_rc = rrr_frr_proc_se nt_unacked_msg(
unacked_cb->sa_pkt_msg_typ e,
unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent CCXT);
}

if (frr_rc == RRR_FRR_CONTINU E)
{
rrr_maybe_send_ error_packet(un acked_cb->sa_pkt_msg_typ e,
unacked_cb->sa_state_handl e,
unacked_cb->sa_upstrm_lih_ set,
unacked_cb->sa_upstrm_li h
CCXT);
}
}

rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
rrr_resend_pack et(unacked_cb, next_hop CCXT);

if (next_hop->nh_use_msg_i ds == ATG_NO)
{
rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
unacked_cb->sa_resend_atte mpts++;
if (next_hop->nh_rr_decay != 100) {
unacked_cb->sa_retrans_int erval *=
(100 + next_hop->nh_rr_decay) ;
unacked_cb->sa_retrans_int erval /= 100;
} else {
unacked_cb->sa_retrans_int erval =
unacked_cb->sa_retrans_int erval << 1;
}
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &= ~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
}
if (unacked_cb->sa_retrans_int erval >= RPL_RM) {
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &=
~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == PATH_ERR){
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_ERROR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
psbp->rapid_retran &= ~RPL_PATH_ERROR ;
frr_rc = rrr_frr_proc_pa th_tear(psbp,
ATG_MPLS_XC_REL _REAS_IF_DOWN,
TRUE
CCXT);
if (frr_rc == RRR_FRR_CONTINU E) {
psbp->ps_rel_reaso n = ATG_MPLS_XC_REL _REAS_IF_DOWN;
tear_or_kill_PS B(psbp CCXT);
}
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_TEAR){
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_ERR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
unacked_cb->sa_retrans_int erval = RPL_RF;
}
unacked_cb->sa_resend_ti me =
unacked_cb->sa_retrans_int erval;

mTimerInsert(&u nacked_cb->m_timer, (vfcnptr_2)retr an_unacked,
unacked_cb,unac ked_cb->sa_resend_time , TTYPE_ONESHOT); <------
The stack shows that
both &unacked_cb->m_timer
and unacked_cb are added by 1.
}
}
EXIT_LABEL:
next_hop->nh_event_usage _count--;
rrr_maybe_free_ next_hop(next_h op CCXT);

return;

} /* retran_unacked */
Nov 14 '05 #9
see inline
[snip]

/* NOTE: both pointer parameters are void * because one of them may not
point to a valid object - i.e. off by one byte*/
void CheckPointers(c onst void *p1,const void *p2, const char * context)
{
if (p1!=p2)
{
fprintf(stderr, "%s %p!=%p\n",conte xt,p1,p2); /* set a break point here
*/
}
}
void
retran_unacked( RRR_SENT_UNACKE D_CB *unacked_cb CCXT_T CXT)
{
RRR_NEXT_HOP_CB *next_hop = unacked_cb->next_hop_cb;
int frr_rc;
PSB *psbp; RRR_SENT_UNACKE D_CB *unacked_cb_bac k=unacked_cb;
next_hop->nh_event_usage _count++; <---- next_hop is correct,
so unacked_cb is ok here.
if (RPL_RL && (unacked_cb->sa_resend_atte mpts >= RPL_RL))
{
if ((unacked_cb->sa_pkt_msg_typ e == PATH) ||
(unacked_cb->sa_pkt_msg_typ e == RESV))
{
frr_rc = RRR_FRR_CONTINU E;
if (RRR_EX_FAST_RE ROUTE())
{
frr_rc = rrr_frr_proc_se nt_unacked_msg(
unacked_cb->sa_pkt_msg_typ e,
unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent CCXT);
}

if (frr_rc == RRR_FRR_CONTINU E)
{
rrr_maybe_send_ error_packet(un acked_cb->sa_pkt_msg_typ e,
unacked_cb->sa_state_handl e,
unacked_cb->sa_upstrm_lih_ set,
unacked_cb->sa_upstrm_li h
CCXT);
}
}

rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
rrr_resend_pack et(unacked_cb, next_hop CCXT);

if (next_hop->nh_use_msg_i ds == ATG_NO)
{
rrr_delete_sent _unacked_cb(una cked_cb, next_hop CCXT);
}
else
{
unacked_cb->sa_resend_atte mpts++;
if (next_hop->nh_rr_decay != 100) {
unacked_cb->sa_retrans_int erval *=
(100 + next_hop->nh_rr_decay) ; unacked_cb->sa_retrans_int erval /= 100;
} else {
unacked_cb->sa_retrans_int erval =
unacked_cb->sa_retrans_int erval << 1;
}
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent;
if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &= ~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
}
if (unacked_cb->sa_retrans_int erval >= RPL_RM) {
if (unacked_cb->sa_pkt_msg_typ e == PATH_TEAR) {
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent; if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_TEAR) {
psbp->rapid_retran &=
~(RPL_PATH_TEAR |RPL_PATH_ERROR );
rrr_delete_retr ies_for_psb(psb p,
RRR_KILL_RETRY_ FOR_ALL_MSGS CCXT);
deferred_kill_P SB(psbp CCXT);
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == PATH_ERR){
if (!unacked_cb->spi_msg_id_inf o) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
psbp = sent_unacked_cb->spi_msg_id_inf o->msg_id_psb_par ent; if (!psbp) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
if (psbp->rapid_retran & RPL_PATH_ERROR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
psbp->rapid_retran &= ~RPL_PATH_ERROR ;
frr_rc = rrr_frr_proc_pa th_tear(psbp,
ATG_MPLS_XC_REL _REAS_IF_DOWN,
TRUE
CCXT);
if (frr_rc == RRR_FRR_CONTINU E) {
psbp->ps_rel_reaso n = ATG_MPLS_XC_REL _REAS_IF_DOWN; tear_or_kill_PS B(psbp CCXT);
}
}
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_TEAR){
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
} else if (unacked_cb->sa_pkt_msg_typ e == RESV_ERR) {
rrr_delete_sent _unacked_cb(una cked_cb,
next_hop CCXT);
goto EXIT_LABEL;
}
unacked_cb->sa_retrans_int erval = RPL_RF;
}
unacked_cb->sa_resend_ti me =
unacked_cb->sa_retrans_int erval;
if unacked_cb is bad below then it should be bad above - work back from here
adding calls to CheckPointers. mTimerInsert(&u nacked_cb->m_timer, (vfcnptr_2)retr an_unacked,
unacked_cb,unac ked_cb->sa_resend_time , TTYPE_ONESHOT); <------ The stack shows that
both &unacked_cb->m_timer and unacked_cb are added by 1.

}
}
EXIT_LABEL:
next_hop->nh_event_usage _count--;
rrr_maybe_free_ next_hop(next_h op CCXT);

return;

} /* retran_unacked */

see top and inline
Add copius calls to CheckPointers(u nacked_cb,unack ed_cb_back,"Con text
String"); throughout retran_unacked to figure out where unacked_cb is being
corrupted.


Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2414
by: hope | last post by:
Hi Access 97 I'm lost on this code please can you help ================================= Below is some simple code that will concatenate a single field's value from multiple records into a single string separated by a user defined character. There is no error trapping (by design), USE AT YOUR OWN RISK.
3
25057
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown. eg. this only transferes the first record in the area. ..Fields("Uge").Value = ws.Range("A98").Value Sub SelectMaster()
8
2239
by: Harvey Twyman | last post by:
I have code written under the CCS 'C' Compiler to run on a PIC microcontroller. Code Extract: ------------------------------- char a,b,c; ------------------------------- c = ( a == b ); -------------------------------
1
1495
by: Fabrizio | last post by:
On a web page i found a very strange html code (see at the en of this message) to set the type of the characters (like bold, italic, etc.) and I have 2 question 1) How interpreter this code ? 2) can I use this code to set also the colour and the font used for the text (like verdana) ? If yes how ? Thank you in advance for your help
7
1354
by: digimotif | last post by:
All, I'm currently working with a small development company on a PHP application they already have. There are several processing tasks that could be scripted in Python and run in the background to modify a database, instead of the way they have it now, which waits for a webpage to return from processing. There is also the possibility of building client gui applications that work with the database as well, so I'm looking for a way I...
6
1453
by: marmar12 | last post by:
Hi guys, I'm having a little difficulty and kind of stuck writing this particular code for a grade calculator project. I'm using linux OS. So far, i have: #include <stdio.h> int man() {
3
1761
by: BlueroY | last post by:
hi, I'm working on an exercise, i did a lot of work already and i just can't figure where I'm going wrong, this is what I'm trying to achieve Sample IO ******************************************************************************* Welcome to PeopleSoft 2 MENU: (A)dd student, (D)elete, (L)ist, (S)ort, e(X)it a Enter the student number MSXMIC001 Enter the name
2
1345
by: almurph | last post by:
H ieveryone, Can you help me please? I am trying to sort a hashtable but get the error: "Cannot implicity convert type void to System.Collections.ArrayList" I am doing the following: ****BEGIN CODE****
11
2111
by: ThaRealneSS | last post by:
Hi. I have made a blackjack code and need a some help on it. It seems to work overall but there are a few bits here and there that need sorting out, and I'm kinda stuck on it so was wondering if I could get some help? (Would be HUGELY appreciated ) The things I need help are on: - Stopping the program going back to the code (you will know what I mean when you play it) - How to add the re-run code in it and where - How I can count...
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6765
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.