All of lore.kernel.org
 help / color / mirror / Atom feed
From: Francesco Ciocchetti <primero@fastwebnet.it>
To: "Tomá¹ Macek" <maca02@atlas.cz>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: libiptc ... and matches , seg fault
Date: Fri, 15 Jul 2005 11:57:23 +0200	[thread overview]
Message-ID: <42D78883.9010008@fastwebnet.it> (raw)
In-Reply-To: <Pine.LNX.4.63.0507151142180.29785@localhost.localdomain>

Tomáš Macek wrote:

> The strcmp() function will try to compare/get the 0x0 memory pointed
> by the me->version pointer and this (in the strcmp() function) raises
> the sigseg error.


Yes :)

> You could try this:
>
> if (me->version != NULL && strcmp(me->version, program_version) != 0) {
> ...
> }
>
> If the first condition "if (me->version != NULL)" failes, the rest
> will be not processed.
>
My problem is that the "register_match" function is not a function of my
program, but a function from iptables.c that is called by init function
in libipt_tcp.c ... what i'm wondering now is why my "me->version" could
be or is NULL or maybe program_version could be NULL too.

this is the extract from libipt_tcp.c

static
struct iptables_match tcp
= { NULL,
"tcp",
IPTABLES_VERSION,
IPT_ALIGN(sizeof(struct ipt_tcp)),
IPT_ALIGN(sizeof(struct ipt_tcp)),
&help,
&init,
&parse,
&final_check,
&print,
&save,
opts };

void
_init(void)
{
register_match(&tcp);
}



so it seems that the field version of tcp structure is filled, at
compilation time, by IPTABLES_VERSION ...

what i do in my program is just a call to

find_match("tcp",TRY_LOAD,&matches)

where matches is just :

struct iptables_rule_match *matches = NULL;


as is done in iptables.c ...



bye
Francesco

  reply	other threads:[~2005-07-15  9:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-14 18:21 libiptc ... and matches , seg fault Francesco Ciocchetti
2005-07-14 19:18 ` Tomáš Macek
2005-07-15  8:06   ` primero
2005-07-15  8:12     ` Jan Engelhardt
2005-07-15  9:17       ` primero
2005-07-15  9:46         ` Tomáš Macek
2005-07-15  9:57           ` Francesco Ciocchetti [this message]
2005-07-15 10:11             ` Patrick Schaaf
2005-07-15 10:29               ` Francesco Ciocchetti
2005-07-15 13:08         ` Jan Engelhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42D78883.9010008@fastwebnet.it \
    --to=primero@fastwebnet.it \
    --cc=maca02@atlas.cz \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.