netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ulogd - polling handler - code clarification
@ 2012-07-30 22:18 Gomathivinayagam Muthuvinayagam
  2012-07-31 11:27 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Gomathivinayagam Muthuvinayagam @ 2012-07-30 22:18 UTC (permalink / raw)
  To: netfilter-devel

Hi,

I was going through the ulogd_inpflow_NFCT.c : polling_handler code. I
need few clarifications.
If someone can answer for that, that will be great.


 725         case NFCT_T_UPDATE:
 726                 id = hashtable_hash(cpi->ct_active, ct);
 727                 ts = (struct ct_timestamp *)
 728                         hashtable_find(cpi->ct_active, ct, id);
 729                 if (ts)
 730                         nfct_copy(ts->ct, ct, NFCT_CP_META);
 731                 else {
 732                         ts = calloc(sizeof(struct ct_timestamp), 1);
 733                         if (ts == NULL)
 734                                 return NFCT_CB_CONTINUE;
 735
 736                         ts->ct = ct;
 737                         gettimeofday(&ts->time[START], NULL);
 738
 739                         ret = hashtable_add(cpi->ct_active,
&ts->hashnode, id);
 740                         if (ret < 0) {
 741                                 free(ts);
 742                                 return NFCT_CB_CONTINUE;
 743                         }
 744                         return NFCT_CB_STOLEN; // Here, why not
NFCT_CB_CONTINUE is used?
 745                 }
 746                 break;

Here in Line no 744, why NFCT_CB_STOLEN is used instead of
NFCT_CB_CONTINUE ? I am not able to understand the reason.


Thanks & Regards,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ulogd - polling handler - code clarification
  2012-07-30 22:18 ulogd - polling handler - code clarification Gomathivinayagam Muthuvinayagam
@ 2012-07-31 11:27 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2012-07-31 11:27 UTC (permalink / raw)
  To: Gomathivinayagam Muthuvinayagam; +Cc: netfilter-devel

On Mon, Jul 30, 2012 at 03:18:32PM -0700, Gomathivinayagam Muthuvinayagam wrote:
> Hi,
> 
> I was going through the ulogd_inpflow_NFCT.c : polling_handler code. I
> need few clarifications.
> If someone can answer for that, that will be great.
> 
> 
>  725         case NFCT_T_UPDATE:
>  726                 id = hashtable_hash(cpi->ct_active, ct);
>  727                 ts = (struct ct_timestamp *)
>  728                         hashtable_find(cpi->ct_active, ct, id);
>  729                 if (ts)
>  730                         nfct_copy(ts->ct, ct, NFCT_CP_META);
>  731                 else {
>  732                         ts = calloc(sizeof(struct ct_timestamp), 1);
>  733                         if (ts == NULL)
>  734                                 return NFCT_CB_CONTINUE;
>  735
>  736                         ts->ct = ct;
>  737                         gettimeofday(&ts->time[START], NULL);
>  738
>  739                         ret = hashtable_add(cpi->ct_active,
> &ts->hashnode, id);
>  740                         if (ret < 0) {
>  741                                 free(ts);
>  742                                 return NFCT_CB_CONTINUE;
>  743                         }
>  744                         return NFCT_CB_STOLEN; // Here, why not
> NFCT_CB_CONTINUE is used?
>  745                 }
>  746                 break;
> 
> Here in Line no 744, why NFCT_CB_STOLEN is used instead of
> NFCT_CB_CONTINUE ? I am not able to understand the reason.

NFCT_CB_STOLEN means that the object is not released once the callback
code is done.

That object is released once we notice that the entry is not there in
the kernel anymore.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-31 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-30 22:18 ulogd - polling handler - code clarification Gomathivinayagam Muthuvinayagam
2012-07-31 11:27 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).