네트웍 커널 프로그래밍에 대한 질문입니다.

cjy1126의 이미지

                              host1 
                                 |
                         203.227.xxx.243
                                 |
                                 |
                         203.227.xxx.246
                                 |
          eth0 > netif_rx() -> dev_queue_xmit() -> eth1 (이게 host2입니다.)
                                 |
                         192.168.100.1
                                 |
                                 |
                         192.168.100.11
                                 |
                              host3

host2의 dev.c의 netif_rx를 바꾸었습니다. (host2로 오는 모든 패킷은 host3으로 보내도록...)

netif_rx(struct sk_buff *skb)에서

skb->dev = dev_get_by_name("eth1");

skb->mac.ethernet->h_dest = "host3의 MAC";

dev_queue_xmit(skb, skb->dev);

이렇게 한후 ping를 host1에서 host2로 ping을 쐈습니다.

문제는 host3에서 제대로된 data를 못받습니다.

ethereal을 이용하여 난잡모드로 data를 올렸는데, MAC 부분이 이상하네요.

제가 보낼때는 skb->mac.ethernet->h_dest에서 바꿔주고 dev_queue_xmit(skb, skb->dev)로 호출했는데... 무슨 문제인지 모르겠습니다.

네트웍 커널쪽 아시는분은 답변 부탁드립니다.

아무거나 가능성 있는거라도 말해주시면... 최대한 찾아보겠습니다.

새해복 많이 받으세요 ^__^

cjy1126의 이미지

디바이스에서 netif_rx로 skb를 넘겨줄때는

skb_pull(skb, skb->dev->hard_header_len)을해서 보내주네요.

이걸모르고 받은 데이터를 dev_queue_xmit으로 그냥 보내니... host3에서 못받을 수 밖에요 ㅜ.ㅜ

처음에는 eth1로 데이터를 못쏘는줄알고 1주일 삽질하면서 디바이스까지 뜯어보고 ㅜ.ㅜ

어제 오늘 절대 안나갈 수 없다는 결론으로 ethereal을 써서 데이터가 쏴지는걸 확인하고...

지금에서야... skb_push(skb, skb->dev->hard_header_len); 로 해결 했습니다.

삽질한만큼 많이 공부되서 기쁘나... 그만큼 다른 부분할 시간이 짧아졌네요.

table유지와 proc에 로그남기기... 커널이 몬지도 모르는데... 지난주에만 커널컴파일 100번넘게하고...

너무 기뻐서 횡설수설이네요.

마음 편하게 구정 보내게됐습니다.

모두들 새해복 많이 받으세요 ^__^

댓글 달기

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