Inca o eroare ( de linking ... ??? ) la care ma dau cu capul de peretzi ...

compilez modulele pentru kernel 2.4.28 ... patch cu ipt_ACCOUNT ... si
imi da minunatzie :
gcc -D__KERNEL__ -I/usr/src/linux-2.4.28/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing
-fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2
-march=i686  -DMODULE -DMODVERSIONS -include
/usr/src/linux-2.4.28/include/linux/modversions.h  -nostdinc
-iwithprefix include -DKBUILD_BASENAME=ipt_ACCOUNT  -c -o
ipt_ACCOUNT.o ipt_ACCOUNT.c
ipt_ACCOUNT.c: In function `ipt_acc_handle_prepare_read':
ipt_ACCOUNT.c:621: parse error before `struct'
ipt_ACCOUNT.c:625: `b' undeclared (first use in this function)
ipt_ACCOUNT.c:625: (Each undeclared identifier is reported only once
ipt_ACCOUNT.c:625: for each function it appears in.)
ipt_ACCOUNT.c:626: `src_16' undeclared (first use in this function)
ipt_ACCOUNT.c:627: `network_16' undeclared (first use in this function)
make[2]: *** [ipt_ACCOUNT.o] Error 1
make[2]: Leaving directory `/usr/src/linux-2.4.28/net/ipv4/netfilter'
make[1]: *** [_modsubdir_ipv4/netfilter] Error 2
make[1]: Leaving directory `/usr/src/linux-2.4.28/net'
make: *** [_mod_net] Error 2

Buuuuun .. ma uit in /usr/src/linux/net/ipv4/netfilter/ipt_ACCOUNT.c :

static int ipt_acc_handle_prepare_read(char *tablename, u_int32_t *count)
{
    int handle, i, table_nr=-1;
    unsigned char depth;

    for (i = 0; i < ACCOUNT_MAX_TABLES; i++)
        if (strncmp(ipt_acc_tables[i].name, tablename,
            ACCOUNT_TABLE_NAME_LEN) == 0) {
            table_nr = i;
            break;
        }

    if (table_nr == -1) {
        printk("ACCOUNT: ipt_acc_handle_prepare_read(): "
               "Table %s not found\n", tablename);
        return -1;
    }

    /* Can't find a free handle slot? */
    if ((handle = ipt_acc_handle_find_slot()) == -1)
        return -1;

    /* Fill up handle structure */
    ipt_acc_handles[handle].ip = ipt_acc_tables[table_nr].ip;
    ipt_acc_handles[handle].depth = ipt_acc_tables[table_nr].depth;
    ipt_acc_handles[handle].itemcount = ipt_acc_tables[table_nr].itemcount;

    /* allocate "root" table */
    if ((ipt_acc_handles[handle].data =
         (void*)get_zeroed_page(GFP_ATOMIC)) == NULL) {
        printk("ACCOUNT: out of memory for root table "
               "in ipt_acc_handle_prepare_read()\n");
        memset (&ipt_acc_handles[handle], 0,
                sizeof(struct ipt_acc_handle));
        return -1;

    /* Recursive copy of complete data structure */
    depth = ipt_acc_handles[handle].depth;
    if (depth == 0) {
        memcpy(ipt_acc_handles[handle].data,
               ipt_acc_tables[table_nr].data,
               sizeof(struct ipt_acc_mask_24));
    } else if (depth == 1) {
        struct ipt_acc_mask_16 *src_16 =
            (struct ipt_acc_mask_16 *)ipt_acc_tables[table_nr].data;
        struct ipt_acc_mask_16 *network_16 =
            (struct ipt_acc_mask_16 *)ipt_acc_handles[handle].data;
        u_int32_t b;

        for (b = 0; b <= 255; b++) {
            if (src_16->mask_24[b]) {
                if ((network_16->mask_24[b] =
                     (void*)get_zeroed_page(GFP_ATOMIC)) == NULL) {
                    printk("ACCOUNT: out of memory during copy of 16 bit "
                           "network in ipt_acc_handle_prepare_read()\n");
                    ipt_acc_data_free(ipt_acc_handles[handle].data, depth);
                    memset (&ipt_acc_handles[handle], 0,
                            sizeof(struct ipt_acc_handle));
                    return -1;
                }

                memcpy(network_16->mask_24[b], src_16->mask_24[b],
                       sizeof(struct ipt_acc_mask_24));
            }
        }
    } else if(depth == 2) {
        struct ipt_acc_mask_8 *src_8 =
            (struct ipt_acc_mask_8 *)ipt_acc_tables[table_nr].data;
        struct ipt_acc_mask_8 *network_8 =
            (struct ipt_acc_mask_8 *)ipt_acc_handles[handle].data;
        u_int32_t a;

        for (a = 0; a <= 255; a++) {
            if (src_8->mask_16[a]) {
                if ((network_8->mask_16[a] =
                     (void*)get_zeroed_page(GFP_ATOMIC)) == NULL) {
                    printk("ACCOUNT: out of memory during copy of 24
bit network"
                           " in ipt_acc_handle_prepare_read()\n");
                    ipt_acc_data_free(ipt_acc_handles[handle].data, depth);
                    memset (&ipt_acc_handles[handle], 0,
                            sizeof(struct ipt_acc_handle));
                    return -1;
                }

                memcpy(network_8->mask_16[a], src_8->mask_16[a],
                       sizeof(struct ipt_acc_mask_16));

621:                struct ipt_acc_mask_16 *src_16 = src_8->mask_16[a];
622:                struct ipt_acc_mask_16 *network_16 = network_8->mask_16[a];
623:               u_int32_t b;

625:                for (b = 0; b <= 255; b++) {
626:                    if (src_16->mask_24[b]) {
                        if ((network_16->mask_24[b] =
                             (void*)get_zeroed_page(GFP_ATOMIC)) == NULL) {
                            printk("ACCOUNT: out of memory during copy
of 16 bit"
                                   " network in
ipt_acc_handle_prepare_read()\n");
                            ipt_acc_data_free(ipt_acc_handles[handle].data,
                                                  depth);
                            memset (&ipt_acc_handles[handle], 0,
                                    sizeof(struct ipt_acc_handle));
                            return -1;
                        }

                        memcpy(network_16->mask_24[b], src_16->mask_24[b],
                               sizeof(struct ipt_acc_mask_24));
                    }
                }
            }
        }
    }

    *count = ipt_acc_tables[table_nr].itemcount;
    return handle;
}



Ce naiba vrea ? Ma uit sa vad daca am heeaderul inclus, si in linia 29 am :
#include <linux/netfilter_ipv4/ipt_ACCOUNT.h>


daca ma uit in ipt_ACCOUNT.h ... totul e ok ! :

92: struct ipt_acc_mask_16 {
93:     struct ipt_acc_mask_24 *mask_24[256];
94: };

Care e faza ? Am eu senzatia ca gccul nu face linkarea corecta cu
/usr/src/linux/include ?

De ce mai sus cand face :
        struct ipt_acc_mask_8 *src_8 =
            (struct ipt_acc_mask_8 *)ipt_acc_tables[table_nr].data;
        struct ipt_acc_mask_8 *network_8 =
            (struct ipt_acc_mask_8 *)ipt_acc_handles[handle].data;
        u_int32_t a;

nu imi da eroare ? Sunt eu nebun ? Sa ma apuc de altceva ?

--- 
Detalii despre listele noastre de mail: http://www.lug.ro/


Raspunde prin e-mail lui