def _defrag_list(lst, defrag, missfrag):
    """Internal usage only. Part of the _defrag_logic"""
    p = lst[0]
    lastp = lst[-1]
    if p.frag > 0 or lastp.flags.MF:  # first or last fragment missing
        missfrag.append(lst)
        return
    p = p.copy()
    if conf.padding_layer in p:
        del(p[conf.padding_layer].underlayer.payload)
    ip = p[IP]
    if ip.len is None or ip.ihl is None:
        clen = len(ip.payload)
    else:
        clen = ip.len - (ip.ihl << 2)
    txt = conf.raw_layer()
    for q in lst[1:]:
        if clen != q.frag << 3:  # Wrong fragmentation offset
            if clen > q.frag << 3:
                warning("Fragment overlap (%i > %i) %r || %r ||  %r" % (clen, q.frag << 3, p, txt, q))  # noqa: E501
            missfrag.append(lst)
            break
        if q[IP].len is None or q[IP].ihl is None:
            clen += len(q[IP].payload)
        else:
            clen += q[IP].len - (q[IP].ihl << 2)
        if conf.padding_layer in q:
            del(q[conf.padding_layer].underlayer.payload)
        txt.add_payload(q[IP].payload.copy())
        if q.time > p.time:
            p.time = q.time
    else:
        ip.flags.MF = False
        del(ip.chksum)
        del(ip.len)
        p = p / txt
        p._defrag_pos = max(x._defrag_pos for x in lst)
        defrag.append(p)
def _defrag_list ( lst , defrag , missfrag ) : p = lst [ 0 ] lastp = lst [ - 1 ] if p . frag > 0 or lastp . flags . MF : missfrag . append ( lst ) return p = p . copy ( ) if conf . padding_layer in p : del ( p [ conf . padding_layer ] . underlayer . payload ) ip = p [ IP ] if ip . len is None or ip . ihl is None : clen = len ( ip . payload ) else : clen = ip . len - ( ip . ihl << 2 ) txt = conf . raw_layer ( ) for q in lst [ 1 : ] : if clen != q . frag << 3 : if clen > q . frag << 3 : warning ( "Fragment overlap (%i > %i) %r || %r ||  %r" % ( clen , q . frag << 3 , p , txt , q ) ) missfrag . append ( lst ) break if q [ IP ] . len is None or q [ IP ] . ihl is None : clen += len ( q [ IP ] . payload ) else : clen += q [ IP ] . len - ( q [ IP ] . ihl << 2 ) if conf . padding_layer in q : del ( q [ conf . padding_layer ] . underlayer . payload ) txt . add_payload ( q [ IP ] . payload . copy ( ) ) if q . time > p . time : p . time = q . time else : ip . flags . MF = False del ( ip . chksum ) del ( ip . len ) p = p / txt p . _defrag_pos = max ( x . _defrag_pos for x in lst ) defrag . append ( p )
Internal usage only. Part of the _defrag_logic