Skip to contentSkip to conversation

ipt_entry_match and data field

DISCUSSION Pablo Neira 2 participants 2 messages May 7, 2004 netfilter

lore
Share & tools
lore
#0 lore raw

Hi,

can anyone explain me the use of data as unsigned char in the structure ipt_entry_match? I mean, why are we using unsigned char?

----- snipped from ip_tables.h ------------------------

struct ipt_entry_match

{
       union {
               struct {
                       u_int16_t match_size;

                        /* Used by userspace */
                        char name[IPT_FUNCTION_MAXNAMELEN];
               } user;
               struct {
                       u_int16_t match_size;

                       /* Used inside the kernel */
                       struct ipt_match *match;
               } kernel;

               /* Total length */
               u_int16_t match_size;
        } u;

        unsigned char data[0];
};

------------ end ---------------------------

thanks,
Pablo

#1 lore raw
Quoted 2 lines · Pablo Neira

can anyone explain me the use of data as unsigned char in the structure ipt_entry_match? I mean, why are we using unsigned char?

We are not. It is just a placeholder for the match extension. The actual data type and size differs depending on the match used.

Regards
Henrik