Commit e08bcb80 authored by Robert David Graham's avatar Robert David Graham
Browse files

sctp

parent 4acde138
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@
#include "proto-x509.h"
#include "crypto-base64.h"      /* base64 encode/decode */
#include "pixie-backtrace.h"
#include "proto-sctp.h"

#include <assert.h>
#include <limits.h>
@@ -390,8 +391,8 @@ infinite:
                ip_me = src_ip;
                port_me = src_port;
            }
            cookie = syn_cookie(ip_them, port_them, ip_me, port_me);

            cookie = syn_cookie(ip_them, port_them&0xFFFF, ip_me, port_me);
//printf("0x%08x 0x%08x 0x%04x 0x%08x 0x%04x    \n", cookie, ip_them, port_them, ip_me, port_me);
            /*
             * SEND THE PROBE
             *  This is sorta the entire point of the program, but little
@@ -714,6 +715,7 @@ receive_thread(void *v)
        /* verify: my IP address */
        if (!is_my_ip(&parms->src, ip_me))
            continue;
//printf("0x%08x 0x%08x 0x%04x 0x%08x 0x%04x    \n", cookie, ip_them, port_them, ip_me, port_me);


        /*
@@ -766,6 +768,9 @@ receive_thread(void *v)
            case FOUND_ICMP:
                handle_icmp(out, secs, px, length, &parsed);
                continue;
            case FOUND_SCTP:
                handle_sctp(out, secs, px, length, cookie, &parsed);
                break;
            case FOUND_TCP:
                /* fall down to below */
                break;
@@ -1481,6 +1486,7 @@ int main(int argc, char *argv[])
         */
        {
            int x = 0;
            x += sctp_selftest();
            x += base64_selftest();
            x += banner1_selftest();
            x += output_selftest();
+2 −0
Original line number Diff line number Diff line
@@ -8,6 +8,8 @@ enum PortStatus {
    Port_IcmpEchoResponse,
    Port_UdpOpen,
    Port_UdpClosed,
    Port_SctpOpen,
    Port_SctpClosed,
    Port_ArpOpen,
};

+2 −0
Original line number Diff line number Diff line
@@ -59,12 +59,14 @@ binary_out_status(struct Output *out, FILE *fp, time_t timestamp,
    switch (status) {
    case Port_Open:
    case Port_UdpOpen:
    case Port_SctpOpen:
    case Port_IcmpEchoResponse:
    case Port_ArpOpen:
        foo[0] = Out_Open;
        break;
    case Port_Closed:
    case Port_UdpClosed:
    case Port_SctpClosed:
        foo[0] = Out_Closed;
        break;
    default:
+14 −0
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ proto_from_status(unsigned status)
        case Port_UdpOpen: return "udp";
        case Port_UdpClosed: return "udp";
        case Port_ArpOpen: return "arp";
        case Port_SctpOpen: return "sctp";
        case Port_SctpClosed: return "sctp";
        default: return "err";
    }
}
@@ -76,6 +78,8 @@ status_string(int x)
        case Port_Closed: return "closed";
        case Port_UdpOpen: return "open";
        case Port_UdpClosed: return "closed";
        case Port_SctpOpen: return "open";
        case Port_SctpClosed: return "closed";
        case Port_IcmpEchoResponse: return "open";
        case Port_ArpOpen: return "open";
        default: return "unknown";
@@ -604,12 +608,14 @@ output_report_status(struct Output *out, time_t timestamp, int status,
    case Port_Open:
    case Port_IcmpEchoResponse:
    case Port_UdpOpen:
    case Port_SctpOpen:
    case Port_ArpOpen:
    default:
        break;

    case Port_Closed:
    case Port_UdpClosed:
    case Port_SctpClosed:
        return;
    }

@@ -677,6 +683,14 @@ output_report_status(struct Output *out, time_t timestamp, int status,
            if (out->is_open_only)
                return;
            break;
        case Port_SctpOpen:
            out->counts.sctp.open++;
            break;
        case Port_SctpClosed:
            out->counts.sctp.closed++;
            if (out->is_open_only)
                return;
            break;
        case Port_ArpOpen:
            out->counts.arp.open++;
            break;
+4 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ struct Output
            uint64_t open;
            uint64_t closed;
        } udp;
        struct {
            uint64_t open;
            uint64_t closed;
        } sctp;
        struct {
            uint64_t echo;
            uint64_t timestamp;
Loading