Eddie Kohler wrote:
Hi Alfeiks,

When you see an error like this, it is useful in Click to look at the configuration first, and/or any elements you have written. In this case, what is the element that precedes IPRewriter in the path? Whatever that element is, it has passed a null packet pointer to "output(x).push()". That is illegal.
Sorry for this, ok in attachment you can look for the configuration script.
Thanks.

Eddie


Alfeiks Kaanoken wrote:
So, continuing the bug finding.
I decide to do the following things to be sure for the normal backtrace -
- I removed inline directives from element.hh (include/click/element.hh)
- I moved all code from element.hh to the element.cc (lib/element.cc)
and get the new ideas and things.
I get the new bt -
click: ../lib/ipflowid.cc:32: IPFlowID::IPFlowID(const Packet*): Assertion `iph && udph && (((iph)->ip_off & (__extension__ ({ register unsigned short int __v, __x = (0x1fff); if (__builtin_constant_p (__x)) __v = ((((__x) >> 8) & 0xff) | (((__x) & 0xff) << 8)); else __asm__ ("rorw $8, %w0" : "=r" (__v) : "0" (__x) : "cc"); __v; }))) == 0)' failed.

Program received signal SIGABRT, Aborted.
0x4013bd81 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4013bd81 in kill () from /lib/libc.so.6
#1  0x4013bb05 in raise () from /lib/libc.so.6
#2  0x4013d05d in abort () from /lib/libc.so.6
#3  0x4013500f in __assert_fail () from /lib/libc.so.6
#4 0x080f0007 in IPFlowID (this=0xbffff2e0, p=0x0) at ../lib/ipflowid.cc:32
#5  0x080c69f3 in IPRewriter::push (this=0x8162150, port=0, p_in=0x0)
    at ../elements/tcpudp/iprewriter.cc:292
#6 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166320) at ../lib/element.cc:986 #7 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166320) at ../lib/element.cc:986 #8 0x080940e7 in IPFragmenter::fragment (this=0x8164350, p_in=0x8166240)
    at ../elements/ip/ipfragmenter.cc:162
#9 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166240) at ../lib/element.cc:986 #10 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166240) at ../lib/element.cc:986 #11 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166240) at ../lib/element.cc:986
#12 0x080b82ae in PaintTee::simple_action (this=0x40227ff4, p=0x8168288)
    at ../elements/standard/painttee.cc:50
#13 0x080f6b25 in Element::push (this=0x8164470, p=0x8168288) at ../lib/element.cc:848 #14 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986 #15 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986
#16 0x0809fdd9 in LinearIPLookup::push (this=0x815efe0, p=0x8168288)
    at ../elements/ip/lineariplookup.cc:304
#17 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986 #18 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986 #19 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986 #20 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986 #21 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8168288) at ../lib/element.cc:986
#22 0x080d2007 in FromDevice::selected (this=0x815f6f8)
    at ../elements/userlevel/fromdevice.cc:364
#23 0x0810d873 in Master::run_selects (this=0x815eba8, more_tasks=244) at ../lib/master.cc:597 #24 0x08101c40 in RouterThread::driver (this=0x815ec98) at routerthread.hh:161
#25 0x080e7b63 in main (argc=3, argv=0xbffff804) at master.hh:121

and I decide to look at the pointers
(gdb) f 5
#5  0x080c69f3 in IPRewriter::push (this=0x8162150, port=0, p_in=0x0)
    at ../elements/tcpudp/iprewriter.cc:292
292       IPFlowID flow(p);
(gdb) p p_in
$1 = (Packet *) 0x0
(gdb) f 6
#6 0x080f6ee0 in Element::Port::push (this=0x40227ff4, p=0x8166320) at ../lib/element.cc:986
986         _e->push(_port, p);
(gdb) p p
$2 = (Packet *) 0x8166320
(gdb) p _e
$4 = (Element *) 0x114d3c
How you can see the ``_e'' pointer address is not valid.
Now I will look for the ``Element::Port::Port(Element* owner, Element* e, int p)'' calling, because I think that this creation process is going without correct parameters.
Is any other ideas ?

Thanks





--
Alfeiks KaƤnoken,
UNIX Software Developer.

// Generated by ppos-conf-level-01.pl
//
// eth0:3 10.20.0.2 255.255.255.0 00:0C:29:A6:3D:8E 1000
// eth0:2 10.20.1.2 255.255.255.0 00:0C:29:A6:3D:98 600
// eth0:1 1.2.3.2 255.255.255.0 00:0C:29:A6:3D:A2 800 (*)
// PPOS_BKF_IP == 1.2.3.4 

// Shared IP input path and routing table
ip :: Strip(14)
    -> CheckIPHeader(INTERFACES 10.20.0.2/255.255.255.0 10.20.1.2/255.255.255.0 
1.2.3.2/255.255.255.0)
    -> rt :: StaticIPLookup(
        10.20.0.2/32 0 , //This host,
        10.20.0.255/32 0 , //Directed broadcast,
        10.20.0.0/32 0 , //Obsoleted directed broadcast,
        10.20.1.2/32 0 , //This host,
        10.20.1.255/32 0 , //Directed broadcast,
        10.20.1.0/32 0 , //Obsoleted directed broadcast,
        1.2.3.2/32 0 , //This host,
        1.2.3.255/32 0 , //Directed broadcast,
        1.2.3.0/32 0 , //Obsoleted directed broadcast,
        10.20.0.0/255.255.255.0 1 , //Forwarding to connected network,
        10.20.1.0/255.255.255.0 2 , //Forwarding to connected network,
        1.2.3.0/255.255.255.0 3 , //Forwarding to connected network,
        255.255.255.255/32 0.0.0.0 0 , //Limited broadcast,
        0.0.0.0/32 0 , //Obsoteted limited broadcast,
        0.0.0.0/0.0.0.0 4, //No route to host, but this record may/should be 
overwritten,
        1.2.3.0/255.255.255.0  3,
        10.20.0.0/255.255.255.0  1,
        10.20.1.0/255.255.255.0  2);

// We should process 'no route to host' situation.
//      1) Find suitable interface first.
        rt[4] -> DropBroadcasts 
                -> erp0 :: PaintTee(1)
                -> erp1 :: PaintTee(2)
                -> erp2 :: PaintTee(3)
                -> Discard;
//      2) Send appropriate message.
        erp0[1] -> ICMPError(10.20.0.2, unreachable, host) -> rt; 
        erp1[1] -> ICMPError(10.20.1.2, unreachable, host) -> rt; 
        erp2[1] -> ICMPError(1.2.3.2, unreachable, host) -> rt; 

// ARP responses are copied to each ARPQuerier and the host.
arpt :: Tee(3);

// Input and output paths for eth0:3
c0 :: Classifier(12/0806 20/0001,  // ARP requests
                  12/0806 20/0002,  // ARP replies
                  12/0800,          // IP packets
                  -                 // Else
                  );
FromDevice(eth0:3) -> c0;
out0 :: Queue(200) -> todevice0 :: ToDevice(eth0:3);
c0[0] -> ar0 :: ARPResponder(10.20.0.2 00:0C:29:A6:3D:8E) -> out0;
arpq0 :: ARPQuerier(10.20.0.2, 00:0C:29:A6:3D:8E) -> out0;
c0[1] -> arpt;
arpt[0] -> [1]arpq0;
c0[2] -> Paint(1) -> ip;
c0[3] -> Print("eth0:3 non-IP") -> Discard;

// Input and output paths for eth0:2
c1 :: Classifier(12/0806 20/0001,  // ARP requests
                  12/0806 20/0002,  // ARP replies
                  12/0800,          // IP packets
                  -                 // Else
                  );
FromDevice(eth0:2) -> c1;
out1 :: Queue(200) -> todevice1 :: ToDevice(eth0:2);
c1[0] -> ar1 :: ARPResponder(10.20.1.2 00:0C:29:A6:3D:98) -> out1;
arpq1 :: ARPQuerier(10.20.1.2, 00:0C:29:A6:3D:98) -> out1;
c1[1] -> arpt;
arpt[1] -> [1]arpq1;
c1[2] -> Paint(2) -> ip;
c1[3] -> Print("eth0:2 non-IP") -> Discard;

// Input and output paths for eth0:1
c2 :: Classifier(12/0806 20/0001,  // ARP requests
                  12/0806 20/0002,  // ARP replies
                  12/0800,          // IP packets
                  -                 // Else
                  );
FromDevice(eth0:1) -> c2;
out2 :: Queue(200) -> todevice2 :: ToDevice(eth0:1);
c2[0] -> ar2 :: ARPResponder(1.2.3.2 00:0C:29:A6:3D:A2) -> out2;
arpq2 :: ARPQuerier(1.2.3.2, 00:0C:29:A6:3D:A2) -> out2;
c2[1] -> arpt;
arpt[2] -> [1]arpq2;
c2[2] -> Paint(3) -> ip;
c2[3] -> Print("eth0:1 non-IP") -> Discard;

//Prepare rewriters
    //eth0:3
        IPrew0 :: IPRewriter(pattern 10.20.0.2 - - - 0 1);
        IPrew0[1] -> Print("Internal error. IPRewriter eth0:3 should not use 
reverse mappings.") -> Discard;
        IPrew0[0] -> arpq0;
    //eth0:2
        IPrew1 :: IPRewriter(pattern 10.20.1.2 - - - 0 1);
        IPrew1[1] -> Print("Internal error. IPRewriter eth0:2 should not use 
reverse mappings.") -> Discard;
        IPrew1[0] -> arpq1;
    //eth0:1 (*)
        IPrew2 :: IPRewriter(pattern - - 1.2.3.4 -  0 1);
        IPrew2[1] -> Print("Internal error. IPRewriter eth0:1* should not use 
reverse mappings.") -> Discard;
        IPrew2[0] -> arpq2;

//Create appropriate ICMPRewriters
err_ICMP_to_BKF :: Print("Strange ICMP to BKF. M.b. to Host?") -> Discard;
    //eth0:3
        ICMPrew0 :: ICMPRewriter( IPrew2 );
        ICMPrew0[1] -> Print("Very strange ICMP from BKF") -> Discard;
        ICMPrew0[0] -> arpq0;
    //eth0:2
        ICMPrew1 :: ICMPRewriter( IPrew2 );
        ICMPrew1[1] -> Print("Very strange ICMP from BKF") -> Discard;
        ICMPrew1[0] -> arpq1;
    //eth0:1 (*)
        ICMPrew2 :: ICMPRewriter( IPrew0 IPrew1  );
        ICMPrew2[1] -> err_ICMP_to_BKF;
        ICMPrew2[0] -> arpq2;

//Create PreNAT IPClassifiers. Don't use extra checkings or debug printings
    ip_cl_preMAT0 :: IPClassifier(ip proto udp, // UDP traffic
                                   ip proto icmp and 
                                   not(icmp type echo-reply or icmp type echo), 
//ICMP Errors
                                     - // Else
                                    );
    ip_cl_preMAT0[0] -> IPrew0;
    ip_cl_preMAT0[1] -> ICMPrew0;
    ip_cl_preMAT0[2] -> Print("Strange traffic from BKF!") -> Discard;

    ip_cl_preMAT1 :: IPClassifier(ip proto udp, // UDP traffic
                                   ip proto icmp and 
                                   not(icmp type echo-reply or icmp type echo), 
//ICMP Errors
                                     - // Else
                                    );
    ip_cl_preMAT1[0] -> IPrew1;
    ip_cl_preMAT1[1] -> ICMPrew1;
    ip_cl_preMAT1[2] -> Print("Strange traffic from BKF!") -> Discard;

    ip_cl_preMAT2 :: IPClassifier(ip proto udp, // UDP traffic
                                   ip proto icmp and 
                                   not(icmp type echo-reply or icmp type echo), 
//ICMP Errors
                                     - // Else
                                    );
    ip_cl_preMAT2[0] -> IPrew2;
    ip_cl_preMAT2[1] -> ICMPrew2;
    ip_cl_preMAT2[2] -> Print("That traffic should be processed by host.") -> 
Discard;


//Prform checking that traffic should be NAT'ed on WAN interfaces
    ip_cl_checkMAT0 :: IPClassifier(src host 1.2.3.4, // From BKF
                                     - // Else
                                    );
    ip_cl_checkMAT0[0] -> ip_cl_preMAT0;
    ip_cl_checkMAT0[1] -> arpq0;
    
    ip_cl_checkMAT1 :: IPClassifier(src host 1.2.3.4, // From BKF
                                     - // Else
                                    );
    ip_cl_checkMAT1[0] -> ip_cl_preMAT1;
    ip_cl_checkMAT1[1] -> arpq1;
    

// Forwarding path for eth0:3
rt[1] -> DropBroadcasts
    -> cp0 :: PaintTee(1)
    -> gio0 :: IPGWOptions(10.20.0.2)
    -> FixIPSrc(10.20.0.2)
    -> dt0 :: DecIPTTL
    -> fr0 :: IPFragmenter(1000)
    -> ip_cl_checkMAT0;
dt0[1] -> ICMPError(10.20.0.2, timeexceeded) -> rt;
fr0[1] -> ICMPError(10.20.0.2, unreachable, needfrag) -> rt;
gio0[1] -> ICMPError(10.20.0.2, parameterproblem) -> rt;
cp0[1] -> ICMPError(10.20.0.2, redirect, host) -> rt;

// Forwarding path for eth0:2
rt[2] -> DropBroadcasts
    -> cp1 :: PaintTee(2)
    -> gio1 :: IPGWOptions(10.20.1.2)
    -> FixIPSrc(10.20.1.2)
    -> dt1 :: DecIPTTL
    -> fr1 :: IPFragmenter(600)
    -> ip_cl_checkMAT1;
dt1[1] -> ICMPError(10.20.1.2, timeexceeded) -> rt;
fr1[1] -> ICMPError(10.20.1.2, unreachable, needfrag) -> rt;
gio1[1] -> ICMPError(10.20.1.2, parameterproblem) -> rt;
cp1[1] -> ICMPError(10.20.1.2, redirect, host) -> rt;

// Process direct BKF access
err_traf_to_BKF :: Print("Internal error. Traffic 2BKF") -> Discard;
rt[3] -> Print("Try to reach BKF without NAT. MUST be internal ICMP")
    -> FixIPSrc(1.2.3.2)
    -> dt2 :: DecIPTTL
    -> fr2 :: IPFragmenter(800)
    -> [0]arpq2;
dt2[1] -> err_traf_to_BKF;
fr2[1] -> err_traf_to_BKF;

// Local packets processing;
rt[0] // Skip DropBroadcasts because host can accept them
    -> cpL2 :: PaintTee(3);
    //Leave only normal traffic
    gioL2 :: IPGWOptions(1.2.3.2)
// Skip FixIPSrc(), because intermal error should go directly to rt->BKF output
    -> dtL2 :: DecIPTTL
    -> frL2 :: IPFragmenter(800)
    -> ip_cl_preMAT2;
cpL2[1] -> Print("BKF tryes to reach itself?") -> Discard;


//      Remove BKF-originated traffic to our host
cpL2[0]         -> cpL_f0 :: PaintTee(1) 
        -> cpL_f1 :: PaintTee(2) 
        -> Discard;
        cpL_f0[1] -> gioL2;
        cpL_f1[1] -> gioL2;

//      1) Find input interface, if we have a IPGWOptions error
gioL2[1]        -> NATp_gio0 :: PaintTee(1)
        -> NATp_gio1 :: PaintTee(2)
        -> Discard;
//      2) Send appropriate message.
        NATp_gio0[1] -> ICMPError(10.20.0.2, parameterproblem) -> rt; 
        NATp_gio1[1] -> ICMPError(10.20.1.2, parameterproblem) -> rt; 

//      1) Find input interface, if we have a DecIPTTL error
    dtL2[1]  -> ip_cl_dtL2 :: IPClassifier(ip proto udp, // UDP traffic
                                                - // Else
                                              );
    ip_cl_dtL2[1] -> Discard;
    ip_cl_dtL2[0]
        -> NATp_dtL0 :: PaintTee(1)
        -> NATp_dtL1 :: PaintTee(2)
        -> Discard;
//      2) Send appropriate message.
        NATp_dtL0[1] -> ICMPError(10.20.0.2, timeexceeded) -> rt; 
        NATp_dtL1[1] -> ICMPError(10.20.1.2, timeexceeded) -> rt; 

//      1) Find input interface, if we have a fragmentation error
    frL2[1]  -> ip_cl_frL2 :: IPClassifier(ip proto udp, // UDP traffic
                                                - // Else
                                              );
    ip_cl_frL2[1] -> Discard;
    ip_cl_frL2[0]
        -> NATp_fr0 :: PaintTee(1)
        -> NATp_fr1 :: PaintTee(2)
        -> Discard;
//      2) Send appropriate message.
        NATp_fr0[1] -> ICMPError(10.20.0.2, unreachable, needfrag) -> rt; 
        NATp_fr1[1] -> ICMPError(10.20.1.2, unreachable, needfrag) -> rt; 
_______________________________________________
click mailing list
[email protected]
https://amsterdam.lcs.mit.edu/mailman/listinfo/click

Reply via email to