다음의 에러를 해결하려면 어떻게 해야 하나요?

qwer의 이미지

kldp bbs 게시판 내용 중에서 본 Roll Your Own Firewall with Netfilter 문서를 보고 그대로 따라했는데 컴파일을 하니 다음과 같은 에러가 생깁니다.
관련에러로 구글에 검색을 해보고 나온대로 해봐도 같은 에러가 나옵니다.
어떻게 해결할 수 있을까요?
고수님들의 답변을 부탁드립니다.
참 사용하는 리눅스는 데비안 2.4.18입니다.

=================== 소스 ======================
#define __KERNEL__
#define MODULE

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
#include </usr/src/linux/include/linux/netfilter.h>
static struct nf_hook_ops netfilter_ops_in; /* NF_IP_PRE_ROUTING */
static struct nf_hook_ops netfilter_ops_out; /* NF_IP_POST_ROUTING */

/* Function prototype in <linux/netfilter> */
unsigned int main_hook(unsigned int hooknum,
struct sk_buff **skb,
const struct net_device *in,
const struct net_device *out,
int (*okfn)(struct sk_buff*))
{
return NF_DROP; /* Drop ALL Packets */
}

int init_module()
{

netfilter_ops_in.hook = main_hook;
netfilter_ops_in.pf = PF_INET;
netfilter_ops_in.hooknum = NF_IP_PRE_ROUTING;
netfilter_ops_in.priority = NF_IP_PRI_FIRST;

netfilter_ops_out.hook = main_hook;
netfilter_ops_out.pf = PF_INET;
netfilter_ops_out.hooknum = NF_IP_POST_ROUTING;
netfilter_ops_out.priority = NF_IP_PRI_FIRST;

nf_register_hook(&netfilter_ops_in); /* register NF_IP_PRE_ROUTING hook */
nf_register_hook(&netfilter_ops_out); /* register NF_IP_POST_ROUTING hook */

return 0;
}

void cleanup()
{
nf_unregister_hook(&netfilter_ops_in); /*unregister NF_IP_PRE_ROUTING hook*/
nf_unregister_hook(&netfilter_ops_out); /*unregister NF_IP_POST_ROUTING hook*/
}
==============================================

에러내용

# gcc -c drop.c
drop.c: In function `init_module':
drop.c:26: invalid use of undefined type `struct nf_hook_ops'
drop.c:27: invalid use of undefined type `struct nf_hook_ops'
drop.c:28: invalid use of undefined type `struct nf_hook_ops'
drop.c:29: invalid use of undefined type `struct nf_hook_ops'
drop.c:31: invalid use of undefined type `struct nf_hook_ops'
drop.c:32: invalid use of undefined type `struct nf_hook_ops'
drop.c:33: invalid use of undefined type `struct nf_hook_ops'
drop.c:34: invalid use of undefined type `struct nf_hook_ops'
drop.c: At top level:
drop.c:9: storage size of `netfilter_ops_in' isn't known
drop.c:10: storage size of `netfilter_ops_out' isn't known
#

원문링크
http://www.linuxjournal.com/article.php?sid=7184

mach의 이미지

아마도 현재 컴퓨터의 구성에 netfilter가 제대로 설치가 되지 않은 것 같습니다.
만일, redhat 9을 그냥 깐정도라면 그러하겠습니다.

커널 버전
uname -a 해서 커널버전 보시고요.

******
만일 제 예상이 맞다면, 다음과 같은 작업을 수행하시기 바랍니다.
iptables.org/ 로가셔서 최신버전의 iptables-버전.tar.bz2를
받아서 설치하시고 다시 컴파일해보세요.

* 아시겠지만, 노파심에 몇자 더 적으면.(가정, 커널버전이 2.4.20-8이라고...)
iptables을 컴파일할때는 커널소스가 있어야 하고, 그 디렉터리가
명시되어야 합니다.
대충 다음과 같은 형태가 되겠지요.

make KERNEL_DIR=/usr/src/linux-2.4.20-8
make install KERNEL_DIR=/usr/src/linux-2.4.20-8
make install-devel

그럼 1차끝.
이게 끝이 아니고, 커널을 재컴파일해주셔야 합니다.
커널옵션중 넷필터관련을 활성화시켜주시고요.
커널도 컴파일하시고 리부팅 후에 /usr/src/linux-2.4.20-8/include/linux디렉터리를
/usr/include/linux와 잘 맞춰주셔야 합니다.

해보지 않고 조언드려서(맞는지 모르겠음;전 2.6.4로 업그레이드해서
설치한 터라 :wink: ) 죄송합니다.

------------------ P.S. --------------
지식은 오픈해서 검증받아야 산지식이된다고 동네 아저씨가 그러더라.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.