Exemple #1
0
void Active_SendUnreach(Packet* p, EncodeType type)
{
    uint32_t len;
    const uint8_t* rej;
    uint32_t flags = GetFlags();
    PROTO_ID proto;

    if ( !s_attempts )
        return;

    // do not send ICMP responses to ICMP packets
    proto = GetInnerProto(p);

    if (
        (proto == PROTO_ICMP4)
#ifdef SUP_IP6
        || (proto == PROTO_ICMP6)
#endif
    ) {
        ErrorMessage(
            "Active_SendUnreach: ignoring UNR for ICMP packet.\n");
        return;
    }

    rej = Encode_Reject(type, flags, p, &len);
    if ( !rej ) return;

    s_send(p->pkth, 1, rej, len);
}
Exemple #2
0
void Active_SendUnreach(Packet* p, EncodeType type)
{
    uint32_t len;
    const uint8_t* rej;
    uint32_t flags = GetFlags();

    if ( !s_attempts )
        return;

    rej = Encode_Reject(type, flags, p, &len);
    if ( !rej ) return;

    s_send(p->pkth, 1, rej, len);
}
Exemple #3
0
void Active_SendReset(Packet* p, EncodeFlags ef)
{
    int i;
    uint32_t flags = (GetFlags() | ef) & ~ENC_FLAG_VAL;
    uint32_t value = ef & ENC_FLAG_VAL;

    for ( i = 0; i < s_attempts; i++ )
    {
        uint32_t len = 0;
        const uint8_t* rej;

        value = Strafe(i, value, p);

        rej = Encode_Reject(ENC_TCP_RST, flags|value, p, &len);
        if ( !rej ) return;

        s_send(p->pkth, !(ef & ENC_FLAG_FWD), rej, len);
    }
}