netfilter 소스를 분석하고 있는데 중간에 막힙니다..

yip83의 이미지

제가 지금 iptables와 netfilter소스를 분석하고 있습니다...
iptables는 어느정도 분석을 완료했습니다. iptables는 단지 netfilter에게 rule을 전달하기 위한 단순한 툴인줄 알았는데 막상 소스를 보고 나니 켤코 간단한 툴이 아니더군요..

아무튼 iptables를 뚫어지게 쳐다본 결과 어느정도 이해가 되었습니다. 모든 tables의 정보를 handle구조체에 저장하였다가 iptc_commit()함수에서 setsockopt()함수를 이용해서 룰을 netfilter의 테이블로 보내더군요. 그러면 커널 모듈인 ip_tables에서 그 정보를 받아 처리하는 것으로 이해했습니다.(확실하게 이해했는지 장담할수 없군요...)

ip_tables 모듈에서 처음 시작함수는 init()함수로 되어있는것을 확인했습니다.(제가 본 linux 커널의 버전은 2.6.15입니다.) 그런데 제가 생각하기로 iptables에서 setsockopt()함수로 정보를 보내면 ip_tables모듈에서 그것의 정보를 받는 함수는 do_ipt_get_ctl()함수인것으로 생각됩니다. 제가 이해가 되지 않는 부분이 바로 이부분인데요. 어떻게 setsockopt()함수에서 보낸 룰의 정보를 do_ipt_get_ctl()함수가 어떻게 알고 처리하는가 입니다. init()함수에서는 do_ipt_get_ctl()함수를 호출하는 부분이 없습니다. 혹시나 해서 리눅스 크로스 레퍼런스 사이트에서 확인해 보았는데 do_ipt_get_ctl()함수를 호출하는 부분은 없더군요. 여기서 막히는 바람에 netfilter의 다른 소스 부분은 아직 제대로 보지도 못했습니다.

결국에는 유저영역과 커널영역과의 데이터 교환이 이루어지는 매커니즘이 문제인거 같습니다. 제가 커널에 대한 지식이 많이 부족해서 더이상의 진도가 나가지를 않고 있습니다. 혹시 여기에 대해서 명쾌한 설명을 해주신다면 정말 감사드리겠습니다.

그리고 여기에 관련된 자세한 설명이 있는 사이트나 서적을 추천해주신다면 더더욱 감사하겠습니다.

prether의 이미지

do_ipt_get_ctl 객체와

init() function이 부르는 nf_register_sockopt() function을 보세요.

/***************************************
Being the one is just like being in love.
***************************************/

/***************************************
Being the one is just like being in love.
***************************************/

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.