LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1256|回复: 6

高手们就帮帮linux的baby吧(怎样编译、加载、演示该示例代码?)

[复制链接]
发表于 2004-4-4 20:54:50 | 显示全部楼层 |阅读模式
有一个防火墙示例模块的代码如下:
// MyFirewall.c
  #ifndef __KERNEL__
  # define __KERNEL__ //按内核模块编译
  #endif
  #ifndef MODULE
  # define MODULE //按设备驱动程序模块编译
  #endif
  #include //最基本的内核模块头文件
  #include
  #include //最基本的内核模块头文件
  #include
  #include
  #include
  #include
  #include
  #include
  #include
  #include
  #define SOL_ICMP 1
  #define PERMIT_PORT 80 //只允许访问TCP的80端口

  int zzl_input(struct firewall_ops *this,
int pf,struct device *dev,

  void *phdr,void *arg,struct sk_buff **pskb)
  {//每当收到一个网络报时,此函数将被内核调用
  struct tcphdr *tcph; //TCP的头指针
  struct iphdr *iph; //IP头指针
  struct sk_buff *skb=*pskb;
  if (skb->protocol==htons(ETH_P_ARP)){

  printk("\nPermit a ARP Packet");
  return FW_ACCEPT;//允许地址解析协议报
  }
  if(skb->protocol==htons(ETH_P_RARP)){

  printk("\nPermit a RARP Packet");
  return FW_ACCEPT;//允许反向地址解析协议报
  }
  if(skb->protocol==htons(ETH_P_IP))

  {
  iph=skb->nh.iph;

  if (iph->protocol==SOL_ICMP)

  {
  printk("\nPermit a ICMP Packet");
  return FW_ACCEPT;//允许网络控制报
  }
  if(iph->protocol==SOL_TCP){

  tcph=skb->h.th;

  if(tcph->dest==PERMIT_PORT){

  printk("\nPermit a valid access");
  return FW_ACCEPT;//允许对TCP端口80的访问
  }
  }
  }
  return FW_REJECT;//禁止对本计算机的所有其它访问
  }
  int zzl_output(struct fi
rewall_ops *this,int pf,struct d
evice *dev,

  void *phdr,void *arg,struct sk_buff **pskb)
  {//程序编写方法同zzl_input函数模块
  printk("\nzzl_output is called ");
  return FW_SKIP;
  }
  int zzl_foreward(struct firewall_ops *th
is,int pf,struct device *dev,

  void *phdr,void *arg,struct sk_buff **pskb)
  {//程序编写方法同zzl_input函数模块
  printk("\nzzl_foreward is called ");
  return FW_SKIP;
  }
  struct firewall_ops zzl_ops=
  {
  NULL,
  zzl_foreward,
  zzl_input,
  zzl_output,
  PF_INET,
  01
  };
  int init_module(void)
  {
  if(register_firewall(PF_INET,&zzl_ops)!=0)
  {
  printk("\nunable register firewall");
  return -1;
  }
  printk("\nzzl_ops=%p",&zzl_ops);
  return 0;
  }
  void cleanup_module(void)
  {
  printk("unload\n");
  unregister_firewall(PF_INET,&zzl_ops);
  }

这个示例程序好象是在linux-2.4.20下的代码,如果是在2.4.20-8下如何做调整才能够编译成功并且加载成功?(我选择了几个/usr/src/linux-2.4.20-8/include/linux 下的头文件加入以上代码,编译总是通不过。我还发现
/usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/compat_firewall.h
文件:

/* Minor modifications to fit on compatibility framework:
   Rusty.Russell@rustcorp.com.au
*/

#ifndef __LINUX_FIREWALL_H
#define __LINUX_FIREWALL_H

/*
*        Definitions for loadable firewall modules
*/

#define FW_QUEUE        0
#define FW_BLOCK        1
#define FW_ACCEPT        2
#define FW_REJECT        (-1)
#define FW_REDIRECT        3
#define FW_MASQUERADE        4
#define FW_SKIP                5

struct firewall_ops
{
        struct firewall_ops *next;
        int (*fw_forward)(struct firewall_ops *this, int pf,
                          struct net_device *dev, void *phdr, void *arg,
                          struct sk_buff **pskb);
        int (*fw_input)(struct firewall_ops *this, int pf,
                        struct net_device *dev, void *phdr, void *arg,
                        struct sk_buff **pskb);
        int (*fw_output)(struct firewall_ops *this, int pf,
                         struct net_device *dev, void *phdr, void *arg,
                         struct sk_buff **pskb);
        /* These may be NULL. */
        int (*fw_acct_in)(struct firewall_ops *this, int pf,
                          struct net_device *dev, void *phdr, void *arg,
                          struct sk_buff **pskb);
        int (*fw_acct_out)(struct firewall_ops *this, int pf,
                           struct net_device *dev, void *phdr, void *arg,
                           struct sk_buff **pskb);
};

extern int register_firewall(int pf, struct firewall_ops *fw);
extern int unregister_firewall(int pf, struct firewall_ops *fw);

extern int ip_fw_masq_timeouts(void *user, int len);
#endif /* __LINUX_FIREWALL_H */

中的firewall_ops 结构和示例中firewall_ops 结构的第五第六个域不同!)

怎样改写代码,添加什么头文件才能够在2.4.20-8下 编译添加模块成功,并且演示得出来啊?

哪位帮帮我啊?多谢了!
:ask :ask :ask
发表于 2004-4-5 11:30:04 | 显示全部楼层
修改一下你的代码,使用[code]模式。
 楼主| 发表于 2004-4-5 15:22:13 | 显示全部楼层

code模式?请兄弟说具体点啊?

在上面的代码里加入头文件(我胡乱找的):
#include </usr/src/linux-2.4.20-8/include/linux/config.h>
#include </usr/src/linux-2.4.20-8/include/linux/module.h>
#include </usr/src/linux-2.4.20-8/include/linux/version.h>

#include </usr/src/linux-2.4.20-8/include/linux/byteorder/generic.h>
#include </usr/src/linux-2.4.20-8/include/linux/netdevice.h>
#include </usr/src/linux-2.4.20-8/include/net/protocol.h>
#include </usr/src/linux-2.4.20-8/include/net/pkt_sched.h>
#include </usr/src/linux-2.4.20-8/include/linux/if_ether.h>
#include </usr/src/linux-2.4.20-8/include/linux/ip.h>
#include </usr/src/linux-2.4.20-8/include/linux/tcp.h>
#include </usr/src/linux-2.4.20-8/include/linux/skbuff.h>

#include </usr/src/linux-2.4.20-8/include/linux/kernel.h>
#include </usr/src/linux-2.4.20-8/include/linux/mm.h>
#include </usr/src/linux-2.4.20-8/include/linux/file.h>
#include </usr/src/linux-2.4.20-8/include/asm/uaccess.h>


然后编译,结果是:

[root@qg dd]# gcc -c myfirewall.c
myfirewall.c:2: stray '\241' in program
myfirewall.c:2: stray '\241' in program
myfirewall.c:2: stray '\241' in program
myfirewall.c:2: stray '\241' in program
myfirewall.c:2: syntax error at '#' token
myfirewall.c:2: parse error before "__KERNEL__"
myfirewall.c:3: stray '\241' in program
myfirewall.c:3: stray '\241' in program
myfirewall.c:3: stray '\241' in program
myfirewall.c:3: stray '\241' in program
myfirewall.c:3: syntax error at '#' token
myfirewall.c:4: stray '\241' in program
myfirewall.c:4: stray '\241' in program
myfirewall.c:4: stray '\241' in program
myfirewall.c:4: stray '\241' in program
myfirewall.c:4: syntax error at '#' token
myfirewall.c:5: stray '\241' in program
myfirewall.c:5: stray '\241' in program
myfirewall.c:5: stray '\241' in program
myfirewall.c:5: stray '\241' in program
myfirewall.c:5: syntax error at '#' token
myfirewall.c:6: stray '\241' in program
myfirewall.c:6: stray '\241' in program
myfirewall.c:6: stray '\241' in program
myfirewall.c:6: stray '\241' in program
myfirewall.c:6: syntax error at '#' token
myfirewall.c:7: stray '\241' in program
myfirewall.c:7: stray '\241' in program
myfirewall.c:7: stray '\241' in program
myfirewall.c:7: stray '\241' in program
myfirewall.c:7: syntax error at '#' token
myfirewall.c:8: stray '\241' in program
myfirewall.c:8: stray '\241' in program
myfirewall.c:8: stray '\241' in program
myfirewall.c:8: stray '\241' in program
In file included from /usr/src/linux-2.4.20-8/include/linux/config.h:4,
                 from myfirewall.c:10:
/usr/include/linux/autoconf.h:1:2: #error Invalid kernel header included in us
erspace
In file included from /usr/src/linux-2.4.20-8/include/linux/module.h:25,
                 from myfirewall.c:11:
/usr/include/asm/atomic.h:16: syntax error before "typedef"
In file included from /usr/src/linux-2.4.20-8/include/linux/module.h:25,
                 from myfirewall.c:11:
/usr/include/asm/atomic.h:40:2: warning: #warning Using kernel header in userl
and program. BAD!
In file included from myfirewall.c:16:
/usr/src/linux-2.4.20-8/include/net/protocol.h:39: warning: `struct sk_buff' d
eclared inside parameter list
/usr/src/linux-2.4.20-8/include/net/protocol.h:39: warning: its scope is only
this definition or declaration, which is probably not what you want
/usr/src/linux-2.4.20-8/include/net/protocol.h:40: parse error before "u32"
/usr/src/linux-2.4.20-8/include/net/protocol.h:40: warning: `struct sk_buff' d
eclared inside parameter list
/usr/src/linux-2.4.20-8/include/net/protocol.h:68: field `list' has incomplete
type
In file included from myfirewall.c:17:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:13:25: net/pkt_cls.h: 没有那个
文件或目录
In file included from myfirewall.c:17:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:37: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:39: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:45: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:49: warning: `struct tcmsg' de
clared inside parameter list
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:49: warning: `struct sk_buff'
declared inside parameter list
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:59: warning: `struct sk_buff'
declared inside parameter list
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:72: parse error before "qdisc_
tree_lock"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:72: warning: data definition h
as no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:84: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:84: warning: no semicolon at e
nd of struct or union
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:98: parse error before '}' tok
en
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:103: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:103: warning: no semicolon at
end of struct or union
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:105: conflicting types for `re
fcnt'
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:85: previous declaration of `r
efcnt'
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:106: parse error before '}' to
ken
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `sch_tree_lock':

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:111: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `sch_tree_unlock'
:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:116: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `tcf_tree_lock':

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:123: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `tcf_tree_unlock'
:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:128: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: At top level:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:208: parse error before "psche
d_time_t"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:208: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:211: parse error before "psche
d_time_base"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:211: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:381: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:381: warning: no semicolon at
end of struct or union
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:385: parse error before "ewma_
rate"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:385: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:386: parse error before "burst
"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:386: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:387: parse error before "mtu"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:387: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:389: parse error before "toks"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:389: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:390: parse error before "ptoks
"
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:390: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:391: parse error before "t_c"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:391: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:392: parse error before "lock"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:392: warning: data definition
has no type or storage class
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:397: parse error before '}' to
ken
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `tcf_police_relea
se':
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:407: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: At top level:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:418: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:419: parse error before "u32"

/usr/src/linux-2.4.20-8/include/net/pkt_sched.h: In function `psched_mtu':
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:449: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:450: dereferencing pointer to
incomplete type
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:450: dereferencing pointer to
incomplete type
In file included from /usr/include/linux/sched.h:14,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:19,
                 from myfirewall.c:21:
/usr/include/linux/timex.h: At top level:
/usr/include/linux/timex.h:173: field `time' has incomplete type
In file included from /usr/include/linux/bitops.h:69,
                 from /usr/include/asm/system.h:7,
                 from /usr/include/linux/sched.h:16,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:19,
                 from myfirewall.c:21:
/usr/include/asm/bitops.h:327:2: warning: #warning This includefile is not ava
ilable on all architectures.
/usr/include/asm/bitops.h:328:2: warning: #warning Using kernel headers in use
rspace: atomicity not guaranteed
In file included from /usr/include/linux/signal.h:4,
                 from /usr/include/linux/sched.h:25,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:19,
                 from myfirewall.c:21:
/usr/include/asm/signal.h:107: parse error before "sigset_t"
/usr/include/asm/signal.h:110: parse error before '}' token
In file included from /usr/include/linux/sched.h:81,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:19,
                 from myfirewall.c:21:
/usr/include/linux/timer.h:32: field `vec' has incomplete type
/usr/include/linux/timer.h:37: field `vec' has incomplete type
/usr/include/linux/timer.h:45: parse error before "spinlock_t"
/usr/include/linux/timer.h:53: parse error before '}' token
/usr/include/linux/timer.h:63: field `list' has incomplete type
/usr/include/linux/timer.h:67: parse error before "tvec_base_t"
/usr/include/linux/timer.h:101: parse error before "tvec_bases"
/usr/include/linux/timer.h: In function `init_timer':
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:105: dereferencing pointer to incomplete type
/usr/include/linux/timer.h:106: dereferencing pointer to incomplete type
/usr/include/linux/timer.h: In function `timer_pending':
/usr/include/linux/timer.h:121: dereferencing pointer to incomplete type
In file included from /usr/include/linux/highmem.h:5,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:27,
                 from myfirewall.c:21:
/usr/include/asm/pgalloc.h:6:24: asm/fixmap.h: 没有那个文件或目录
In file included from /usr/include/linux/highmem.h:5,
                 from /usr/src/linux-2.4.20-8/include/linux/skbuff.h:27,
                 from myfirewall.c:21:
/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:57: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `get_pgd_slow':
/usr/include/asm/pgalloc.h:59: `pgd_t' undeclared (first use in this function)

/usr/include/asm/pgalloc.h:59: (Each undeclared identifier is reported only on
ce
/usr/include/asm/pgalloc.h:59: for each function it appears in.)
/usr/include/asm/pgalloc.h:59: `pgd' undeclared (first use in this function)

/usr/include/asm/pgalloc.h:59: parse error before ')' token
/usr/include/asm/pgalloc.h:62: `USER_PTRS_PER_PGD' undeclared (first use in th
is function)
/usr/include/asm/pgalloc.h:63: `swapper_pg_dir' undeclared (first use in this
function)
/usr/include/asm/pgalloc.h:63: `PTRS_PER_PGD' undeclared (first use in this fu
nction)
/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:70: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `get_pgd_fast':
/usr/include/asm/pgalloc.h:80: `pgd_t' undeclared (first use in this function)

/usr/include/asm/pgalloc.h:80: parse error before ')' token
/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:83: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `free_pgd_fast':
/usr/include/asm/pgalloc.h:85: `pgd' undeclared (first use in this function)

/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:90: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `free_pgd_slow':
/usr/include/asm/pgalloc.h:99: `pgd' undeclared (first use in this function)

/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:103: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `pte_alloc_one':
/usr/include/asm/pgalloc.h:105: `pte_t' undeclared (first use in this function
)
/usr/include/asm/pgalloc.h:105: `pte' undeclared (first use in this function)

/usr/include/asm/pgalloc.h:109: parse error before ')' token
/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:118: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `pte_alloc_one_fast':
/usr/include/asm/pgalloc.h:127: `pte_t' undeclared (first use in this function
)
/usr/include/asm/pgalloc.h:127: parse error before ')' token
/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:130: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `pte_free_fast':
/usr/include/asm/pgalloc.h:132: `pte' undeclared (first use in this function)

/usr/include/asm/pgalloc.h: At top level:
/usr/include/asm/pgalloc.h:137: parse error before '*' token
/usr/include/asm/pgalloc.h: In function `pte_free_slow':
/usr/include/asm/pgalloc.h:139: `pte' undeclared (first use in this function)

/usr/include/asm/pgalloc.h: In function `flush_tlb_mm':
/usr/include/asm/pgalloc.h:183: `current' undeclared (first use in this functi
on)
/usr/include/asm/pgalloc.h: In function `flush_tlb_page':
/usr/include/asm/pgalloc.h:190: dereferencing pointer to incomplete type
/usr/include/asm/pgalloc.h:190: `current' undeclared (first use in this functi
on)
/usr/include/asm/pgalloc.h: In function `flush_tlb_range':
/usr/include/asm/pgalloc.h:197: `current' undeclared (first use in this functi
on)
In file included from myfirewall.c:21:
/usr/src/linux-2.4.20-8/include/linux/skbuff.h: At top level:
/usr/src/linux-2.4.20-8/include/linux/skbuff.h:103: parse error before "spinlo
ck_t"
/usr/src/linux-2.4.20-8/include/linux/skbuff.h:103: warning: no semicolon at e
nd of struct or union
In file included from myfirewall.c:25:
/usr/src/linux-2.4.20-8/include/linux/file.h:8: parse error before '(' token

/usr/src/linux-2.4.20-8/include/linux/file.h:9: parse error before '(' token

/usr/src/linux-2.4.20-8/include/linux/file.h: In function `get_close_on_exec':

/usr/src/linux-2.4.20-8/include/linux/file.h:13: `current' undeclared (first u
se in this function)
/usr/src/linux-2.4.20-8/include/linux/file.h:15: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:16: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:17: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: In function `set_close_on_exec':

/usr/src/linux-2.4.20-8/include/linux/file.h:23: `current' undeclared (first u
se in this function)
/usr/src/linux-2.4.20-8/include/linux/file.h:24: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:26: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:28: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:29: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: At top level:
/usr/src/linux-2.4.20-8/include/linux/file.h:32: warning: `struct files_struct
' declared inside parameter list
/usr/src/linux-2.4.20-8/include/linux/file.h: In function `fcheck_files':
/usr/src/linux-2.4.20-8/include/linux/file.h:36: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:37: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: In function `fcheck':
/usr/src/linux-2.4.20-8/include/linux/file.h:47: `current' undeclared (first u
se in this function)
/usr/src/linux-2.4.20-8/include/linux/file.h:49: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:50: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: At top level:
/usr/src/linux-2.4.20-8/include/linux/file.h:58: warning: `struct files_struct
' declared inside parameter list
/usr/src/linux-2.4.20-8/include/linux/file.h: In function `__put_unused_fd':

/usr/src/linux-2.4.20-8/include/linux/file.h:60: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:61: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:62: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: In function `put_unused_fd':
/usr/src/linux-2.4.20-8/include/linux/file.h:67: `current' undeclared (first u
se in this function)
/usr/src/linux-2.4.20-8/include/linux/file.h:69: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h:70: warning: passing arg 1 of `__
put_unused_fd' from incompatible pointer type
/usr/src/linux-2.4.20-8/include/linux/file.h:71: dereferencing pointer to inco
mplete type
/usr/src/linux-2.4.20-8/include/linux/file.h: At top level:
/usr/src/linux-2.4.20-8/include/linux/file.h:75: warning: `struct files_struct
' declared inside parameter list
In file included from myfirewall.c:26:
/usr/src/linux-2.4.20-8/include/asm/uaccess.h: In function `verify_area':
/usr/src/linux-2.4.20-8/include/asm/uaccess.h:64: `current' undeclared (first
use in this function)
/usr/src/linux-2.4.20-8/include/asm/uaccess.h: In function `__constant_copy_to
_user':
/usr/src/linux-2.4.20-8/include/asm/uaccess.h:550: `current' undeclared (first
use in this function)
/usr/src/linux-2.4.20-8/include/asm/uaccess.h: In function `__constant_copy_fr
om_user':
/usr/src/linux-2.4.20-8/include/asm/uaccess.h:558: `current' undeclared (first
use in this function)
myfirewall.c: At top level:
myfirewall.c:27: stray '\241' in program
myfirewall.c:27: stray '\241' in program
myfirewall.c:27: stray '\241' in program
myfirewall.c:27: stray '\241' in program
myfirewall.c:27: syntax error at '#' token
myfirewall.c:27: parse error before "SOL_ICMP"
myfirewall.c:28: stray '\241' in program
myfirewall.c:28: stray '\241' in program
myfirewall.c:28: stray '\241' in program
myfirewall.c:28: stray '\241' in program
myfirewall.c:28: syntax error at '#' token
myfirewall.c:30: stray '\241' in program
myfirewall.c:30: stray '\241' in program
myfirewall.c:30: stray '\241' in program
myfirewall.c:30: stray '\241' in program
myfirewall.c:33: stray '\241' in program
myfirewall.c:33: stray '\241' in program
myfirewall.c:33: stray '\241' in program
myfirewall.c:33: stray '\241' in program
myfirewall.c:34: stray '\241' in program
myfirewall.c:34: stray '\241' in program
myfirewall.c:34: stray '\241' in program
myfirewall.c:34: stray '\241' in program
myfirewall.c:35: stray '\241' in program
myfirewall.c:35: stray '\241' in program
myfirewall.c:35: stray '\241' in program
myfirewall.c:35: stray '\241' in program
myfirewall.c:36: stray '\241' in program
myfirewall.c:36: stray '\241' in program
myfirewall.c:36: stray '\241' in program
myfirewall.c:36: stray '\241' in program
myfirewall.c:37: stray '\241' in program
myfirewall.c:37: stray '\241' in program
myfirewall.c:37: stray '\241' in program
myfirewall.c:37: stray '\241' in program
myfirewall.c:37: `pskb' undeclared here (not in a function)
myfirewall.c:38: stray '\241' in program
myfirewall.c:38: stray '\241' in program
myfirewall.c:38: stray '\241' in program
myfirewall.c:38: stray '\241' in program
myfirewall.c:38: parse error before "if"
myfirewall.c:40: stray '\241' in program
myfirewall.c:40: stray '\241' in program
myfirewall.c:40: stray '\241' in program
myfirewall.c:40: stray '\241' in program
myfirewall.c:41: stray '\241' in program
myfirewall.c:41: stray '\241' in program
myfirewall.c:41: stray '\241' in program
myfirewall.c:41: stray '\241' in program
myfirewall.c:42: stray '\241' in program
myfirewall.c:42: stray '\241' in program
myfirewall.c:42: stray '\241' in program
myfirewall.c:42: stray '\241' in program
myfirewall.c:43: stray '\241' in program
myfirewall.c:43: stray '\241' in program
myfirewall.c:43: stray '\241' in program
myfirewall.c:43: stray '\241' in program
myfirewall.c:45: stray '\241' in program
myfirewall.c:45: stray '\241' in program
myfirewall.c:45: stray '\241' in program
myfirewall.c:45: stray '\241' in program
myfirewall.c:46: stray '\241' in program
myfirewall.c:46: stray '\241' in program
myfirewall.c:46: stray '\241' in program
myfirewall.c:46: stray '\241' in program
myfirewall.c:47: stray '\241' in program
myfirewall.c:47: stray '\241' in program
myfirewall.c:47: stray '\241' in program
myfirewall.c:47: stray '\241' in program
myfirewall.c:48: stray '\241' in program
myfirewall.c:48: stray '\241' in program
myfirewall.c:48: stray '\241' in program
myfirewall.c:48: stray '\241' in program
myfirewall.c:50: stray '\241' in program
myfirewall.c:50: stray '\241' in program
myfirewall.c:50: stray '\241' in program
myfirewall.c:50: stray '\241' in program
myfirewall.c:51: stray '\241' in program
myfirewall.c:51: stray '\241' in program
myfirewall.c:51: stray '\241' in program
myfirewall.c:51: stray '\241' in program
myfirewall.c:53: stray '\241' in program
myfirewall.c:53: stray '\241' in program
myfirewall.c:53: stray '\241' in program
myfirewall.c:53: stray '\241' in program
myfirewall.c:55: stray '\241' in program
myfirewall.c:55: stray '\241' in program
myfirewall.c:55: stray '\241' in program
myfirewall.c:55: stray '\241' in program
myfirewall.c:56: stray '\241' in program
myfirewall.c:56: stray '\241' in program
myfirewall.c:56: stray '\241' in program
myfirewall.c:56: stray '\241' in program
myfirewall.c:57: stray '\241' in program
myfirewall.c:57: stray '\241' in program
myfirewall.c:57: stray '\241' in program
myfirewall.c:57: stray '\241' in program
myfirewall.c:58: stray '\241' in program
myfirewall.c:58: stray '\241' in program
myfirewall.c:58: stray '\241' in program
myfirewall.c:58: stray '\241' in program
myfirewall.c:59: stray '\241' in program
myfirewall.c:59: stray '\241' in program
myfirewall.c:59: stray '\241' in program
myfirewall.c:59: stray '\241' in program
myfirewall.c:61: stray '\241' in program
myfirewall.c:61: stray '\241' in program
myfirewall.c:61: stray '\241' in program
myfirewall.c:61: stray '\241' in program
myfirewall.c:63: stray '\241' in program
myfirewall.c:63: stray '\241' in program
myfirewall.c:63: stray '\241' in program
myfirewall.c:63: stray '\241' in program
myfirewall.c:65: stray '\241' in program
myfirewall.c:65: stray '\241' in program
myfirewall.c:65: stray '\241' in program
myfirewall.c:65: stray '\241' in program
myfirewall.c:66: stray '\241' in program
myfirewall.c:66: stray '\241' in program
myfirewall.c:66: stray '\241' in program
myfirewall.c:66: stray '\241' in program
myfirewall.c:67: stray '\241' in program
myfirewall.c:67: stray '\241' in program
myfirewall.c:67: stray '\241' in program
myfirewall.c:67: stray '\241' in program
myfirewall.c:68: stray '\241' in program
myfirewall.c:68: stray '\241' in program
myfirewall.c:68: stray '\241' in program
myfirewall.c:68: stray '\241' in program
myfirewall.c:69: stray '\241' in program
myfirewall.c:69: stray '\241' in program
myfirewall.c:69: stray '\241' in program
myfirewall.c:69: stray '\241' in program
myfirewall.c:70: stray '\241' in program
myfirewall.c:70: stray '\241' in program
myfirewall.c:70: stray '\241' in program
myfirewall.c:70: stray '\241' in program
myfirewall.c:71: stray '\241' in program
myfirewall.c:71: stray '\241' in program
myfirewall.c:71: stray '\241' in program
myfirewall.c:71: stray '\241' in program
myfirewall.c:72: stray '\241' in program
myfirewall.c:72: stray '\241' in program
myfirewall.c:72: stray '\241' in program
myfirewall.c:72: stray '\241' in program
myfirewall.c:73: parse error before '*' token
myfirewall.c:76: stray '\241' in program
myfirewall.c:76: stray '\241' in program
myfirewall.c:76: stray '\241' in program
myfirewall.c:76: stray '\241' in program
myfirewall.c:76: warning: `struct fi' declared inside parameter list
myfirewall.c:77: stray '\241' in program
myfirewall.c:77: stray '\241' in program
myfirewall.c:77: stray '\241' in program
myfirewall.c:77: stray '\241' in program
myfirewall.c: In function `zzl_output':
myfirewall.c:78: stray '\241' in program
myfirewall.c:78: stray '\241' in program
myfirewall.c:78: stray '\241' in program
myfirewall.c:78: stray '\241' in program
myfirewall.c:79: stray '\241' in program
myfirewall.c:79: stray '\241' in program
myfirewall.c:79: stray '\241' in program
myfirewall.c:79: stray '\241' in program
myfirewall.c:79: `FW_SKIP' undeclared (first use in this function)
myfirewall.c:80: stray '\241' in program
myfirewall.c:80: stray '\241' in program
myfirewall.c:80: stray '\241' in program
myfirewall.c:80: stray '\241' in program
myfirewall.c: At top level:
myfirewall.c:81: stray '\241' in program
myfirewall.c:81: stray '\241' in program
myfirewall.c:81: stray '\241' in program
myfirewall.c:81: stray '\241' in program
myfirewall.c:82: parse error before "is"
myfirewall.c:84: stray '\241' in program
myfirewall.c:84: stray '\241' in program
myfirewall.c:84: stray '\241' in program
myfirewall.c:84: stray '\241' in program
myfirewall.c:84: warning: `struct firewall_ops' declared inside parameter list

myfirewall.c:85: stray '\241' in program
myfirewall.c:85: stray '\241' in program
myfirewall.c:85: stray '\241' in program
myfirewall.c:85: stray '\241' in program
myfirewall.c: In function `zzl_foreward':
myfirewall.c:86: stray '\241' in program
myfirewall.c:86: stray '\241' in program
myfirewall.c:86: stray '\241' in program
myfirewall.c:86: stray '\241' in program
myfirewall.c:87: stray '\241' in program
myfirewall.c:87: stray '\241' in program
myfirewall.c:87: stray '\241' in program
myfirewall.c:87: stray '\241' in program
myfirewall.c:87: `FW_SKIP' undeclared (first use in this function)
myfirewall.c:88: stray '\241' in program
myfirewall.c:88: stray '\241' in program
myfirewall.c:88: stray '\241' in program
myfirewall.c:88: stray '\241' in program
myfirewall.c: At top level:
myfirewall.c:89: stray '\241' in program
myfirewall.c:89: stray '\241' in program
myfirewall.c:89: stray '\241' in program
myfirewall.c:89: stray '\241' in program
myfirewall.c:89: variable `zzl_ops' has initializer but incomplete type
myfirewall.c:90: stray '\241' in program
myfirewall.c:90: stray '\241' in program
myfirewall.c:90: stray '\241' in program
myfirewall.c:90: stray '\241' in program
myfirewall.c:91: stray '\241' in program
myfirewall.c:91: stray '\241' in program
myfirewall.c:91: stray '\241' in program
myfirewall.c:91: stray '\241' in program
myfirewall.c:91: warning: excess elements in struct initializer
myfirewall.c:91: warning: (near initialization for `zzl_ops')
myfirewall.c:92: stray '\241' in program
myfirewall.c:92: stray '\241' in program
myfirewall.c:92: stray '\241' in program
myfirewall.c:92: stray '\241' in program
myfirewall.c:92: warning: excess elements in struct initializer
myfirewall.c:92: warning: (near initialization for `zzl_ops')
myfirewall.c:93: stray '\241' in program
myfirewall.c:93: stray '\241' in program
myfirewall.c:93: stray '\241' in program
myfirewall.c:93: stray '\241' in program
myfirewall.c:93: `zzl_input' undeclared here (not in a function)
myfirewall.c:93: warning: excess elements in struct initializer
myfirewall.c:93: warning: (near initialization for `zzl_ops')
myfirewall.c:94: stray '\241' in program
myfirewall.c:94: stray '\241' in program
myfirewall.c:94: stray '\241' in program
myfirewall.c:94: stray '\241' in program
myfirewall.c:94: warning: excess elements in struct initializer
myfirewall.c:94: warning: (near initialization for `zzl_ops')
myfirewall.c:95: stray '\241' in program
myfirewall.c:95: stray '\241' in program
myfirewall.c:95: stray '\241' in program
myfirewall.c:95: stray '\241' in program
myfirewall.c:95: warning: excess elements in struct initializer
myfirewall.c:95: warning: (near initialization for `zzl_ops')
myfirewall.c:96: stray '\241' in program
myfirewall.c:96: stray '\241' in program
myfirewall.c:96: stray '\241' in program
myfirewall.c:96: stray '\241' in program
myfirewall.c:97: stray '\241' in program
myfirewall.c:97: stray '\241' in program
myfirewall.c:97: stray '\241' in program
myfirewall.c:97: stray '\241' in program
myfirewall.c:97: warning: excess elements in struct initializer
myfirewall.c:97: warning: (near initialization for `zzl_ops')
myfirewall.c:98: stray '\241' in program
myfirewall.c:98: stray '\241' in program
myfirewall.c:98: stray '\241' in program
myfirewall.c:98: stray '\241' in program
myfirewall.c:99: stray '\241' in program
myfirewall.c:99: stray '\241' in program
myfirewall.c:99: stray '\241' in program
myfirewall.c:99: stray '\241' in program
myfirewall.c: In function `init_module':
myfirewall.c:100: stray '\241' in program
myfirewall.c:100: stray '\241' in program
myfirewall.c:100: stray '\241' in program
myfirewall.c:100: stray '\241' in program
myfirewall.c:101: stray '\241' in program
myfirewall.c:101: stray '\241' in program
myfirewall.c:101: stray '\241' in program
myfirewall.c:101: stray '\241' in program
myfirewall.c:102: stray '\241' in program
myfirewall.c:102: stray '\241' in program
myfirewall.c:102: stray '\241' in program
myfirewall.c:102: stray '\241' in program
myfirewall.c:103: stray '\241' in program
myfirewall.c:103: stray '\241' in program
myfirewall.c:103: stray '\241' in program
myfirewall.c:103: stray '\241' in program
myfirewall.c:104: stray '\241' in program
myfirewall.c:104: stray '\241' in program
myfirewall.c:104: stray '\241' in program
myfirewall.c:104: stray '\241' in program
myfirewall.c:105: stray '\241' in program
myfirewall.c:105: stray '\241' in program
myfirewall.c:105: stray '\241' in program
myfirewall.c:105: stray '\241' in program
myfirewall.c:106: stray '\241' in program
myfirewall.c:106: stray '\241' in program
myfirewall.c:106: stray '\241' in program
myfirewall.c:106: stray '\241' in program
myfirewall.c:107: stray '\241' in program
myfirewall.c:107: stray '\241' in program
myfirewall.c:107: stray '\241' in program
myfirewall.c:107: stray '\241' in program
myfirewall.c: At top level:
myfirewall.c:108: stray '\241' in program
myfirewall.c:108: stray '\241' in program
myfirewall.c:108: stray '\241' in program
myfirewall.c:108: stray '\241' in program
myfirewall.c:109: stray '\241' in program
myfirewall.c:109: stray '\241' in program
myfirewall.c:109: stray '\241' in program
myfirewall.c:109: stray '\241' in program
myfirewall.c: In function `cleanup_module':
myfirewall.c:110: stray '\241' in program
myfirewall.c:110: stray '\241' in program
myfirewall.c:110: stray '\241' in program
myfirewall.c:110: stray '\241' in program
myfirewall.c:111: stray '\241' in program
myfirewall.c:111: stray '\241' in program
myfirewall.c:111: stray '\241' in program
myfirewall.c:111: stray '\241' in program
myfirewall.c:112: stray '\241' in program
myfirewall.c:112: stray '\241' in program
myfirewall.c:112: stray '\241' in program
myfirewall.c:112: stray '\241' in program
myfirewall.c: At top level:
/usr/src/linux-2.4.20-8/include/net/pkt_sched.h:86: storage size of `q' isn't
known
myfirewall.c:89: storage size of `zzl_ops' isn't known
[root@qg dd]#


怎么回事啊?多谢!
--
 楼主| 发表于 2004-4-5 15:24:26 | 显示全部楼层

myqq 89464623 please help me out 3x !

myqq 89464623 please help me out 3x !
 楼主| 发表于 2004-4-6 21:55:02 | 显示全部楼层

等待中...

他给的信息很不全,连头文件都没有的...
怎么几天了只有一位兄弟来帮忙啊,问题还是没有解决,等待ing
发表于 2004-4-6 22:33:41 | 显示全部楼层
不知道你要干什么,如果只是想要知道怎么编写hello world程序的话,我想置顶有的。
如果是想编译这个应用程序的话,去软件版看看,不过你给的信息也太少,太乱了。
 楼主| 发表于 2004-4-7 13:08:39 | 显示全部楼层

waiting reply

我想演示出上述代码的功能.

上面的示例代码是一个只允许访问TCP的80端口的"防火墙"模块代码,编译生成二进制目标块,可以动态加入内核,而置顶里
hello world是一个c可执行程序,不一样.

我现在去软件版再看看.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表