[ 
https://bro-tracker.atlassian.net/browse/BIT-1298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19207#comment-19207
 ] 

Jon Siwek commented on BIT-1298:
--------------------------------

Thanks, I see what's happening now: the process for attaching analyzers via 
signature matches will buffer packet contents (excluding IP header) until a 
signature matches and then later replay those packets for analysis.  Since it 
didn't save the IP header while buffering, those DeliverPacket calls which use 
replayed content end up with a null IP_Hdr*.

I can see what it takes to fix that, but from your earlier description, you may 
be able to get the information you were looking for from a different place, 
e.g.:

{noformat}
diff --git a/src/analyzer/protocol/ntp/NTP.cc b/src/analyzer/protocol/ntp/NTP.cc
index 5778da9..0ba5b3f 100644
--- a/src/analyzer/protocol/ntp/NTP.cc
+++ b/src/analyzer/protocol/ntp/NTP.cc
@@ -27,6 +27,9 @@ void NTP_Analyzer::Done()
 
 void NTP_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig, 
uint64 seq, const IP_Hdr* ip, int caplen)
        {
+       printf("%s:%d\n",
+              Conn()->OrigAddr().AsString().c_str(),
+              ntohs(Conn()->OrigPort()));
        Analyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
 
        // Actually we could just get rid of the Request/Reply and simply use
{noformat}

> IP_Hdr pointer do not propagate from udp to child analyzers via DeliverPacket 
> method causing a segfault
> -------------------------------------------------------------------------------------------------------
>
>                 Key: BIT-1298
>                 URL: https://bro-tracker.atlassian.net/browse/BIT-1298
>             Project: Bro Issue Tracker
>          Issue Type: Problem
>          Components: Bro
>    Affects Versions: 2.3
>         Environment: Debian
>            Reporter: Eric Asselin
>            Priority: High
>              Labels: analyzer
>         Attachments: core.zip, ntp-synchronized.pcap
>
>
> From a child analyzer like NTP, the IP_Hdr pointer in the DeliverPacket 
> method is empty and unusable causing a segmentation fault as soon as you try 
> to access it.
> To recreate the bug, just add an "assert(ip)" inside the DeliverPacket method 
> of a UDP child analyzer and the execution will fail (instead of the 
> segmentation fault).



--
This message was sent by Atlassian JIRA
(v6.4-OD-11-014#64007)
_______________________________________________
bro-dev mailing list
[email protected]
http://mailman.icsi.berkeley.edu/mailman/listinfo/bro-dev

Reply via email to