e1000 드라이버 커널 패닉 문제
심심해서 커널 2.4에서 e1000 네트웍 드라이버에서 ip filtering 기능을 첨가하는 테스트 코드를 짜고 있는데.. 커널 패닉이 나는군요..
드라이버 코드를 보면 skb->protocol = eth_type_trans(skb, netdev);에서
ethernet header는 쉽게 까서 보는데..
ip hdr을 까면.. oops가 나는 이유를 모르겟네요.. 물론 ip 패킷만 날리고 이것을 받습니다.
간단히 넣은 코드는 다음과 같습니다.(e1000_main.c -> e1000_clean_rx_irq 함수)
skb->protocol = eth_type_trans(skb, netdev);
==> 여기서 부터..
if (sizeof(struct iphdr) > skb->len) {
dev_kfree_skb_irq(skb);
goto next_desc;
}
iph = skb->nh.iph;
if (iph->ihl < 5 || iph->version != 4) {
dev_kfree_skb_irq(skb);
goto next_desc;
}
if (iph->ihl*4 > skb->len) {
dev_kfree_skb_irq(skb);
goto next_desc;
}
if (iph->daddr != XXX) {
dev_kfree_skb_irq(skb);
goto next_desc;
}
==> 여기 까지 추가했습니다.
위 코드를 추가해서 테스트를 한 경우 패닉이 났고
skb_push, skb_pull, pskb_may_pull 등을 이용해도(ip_rcv함수 참고)..패닉이 나네요
oops 메시지도 콘솔에 일부만 나와서 다 확인 할 수도 없네요 ㅠ.ㅠ
드라이버 intr 함수에서 ip header를 못 볼 이유는 없을 듯한데..
답답하네요.. ^^
초보에게 힌트라도 하나 던져 주심 감사하겠습니다..끄응
그럼 미리 감솨 ..
Re: e1000 드라이버 커널 패닉 문제
ip 인지 icmp 인지 arp 인지 구분하는게 필요할것 같습니다.
젤먼저 arp 날라 올테닌깐요..
정보공유는 자신감의 표현입니다
제 홈페이지에 같은 질문을 올리셨는데... 같은 대답을 :-)우선
제 홈페이지에 같은 질문을 올리셨는데... 같은 대답을 :-)
우선 packet filtering이 목적이라면 netfilter를 이용하는게 더 바람직하다고 생각합니다.
ethernet driver에서 패킷을 분석하려고 한다면, RX시에 호출하는 eth_type_trans()는 ethernet header만 해석합니다. 즉 sk_buff에서 mac field만 유효하고, nh, h field은 유효하지 않습니다. 따라서 이를 접근하는 것은 잘못된 것입니다. 그리고 위의 분 말대로 패킷 헤더를 제대로 분석하지 않고 있습니다. 수신한 패킷이 IP 패킷인지 확인하려면 :
Freedom is another word for nothing left to lose,
Nothing doesn't mean nothing if it ain't free.
댓글 달기