Open Source Computing

Week 13







Linux kernel source

    jiffies

Brief overview of TCP

Start with af_inet.c::tcp_protocol() and tcp_ipv4.c::tcp_v4_rcv
    => __inet_lookup_skb => __inet_lookup()
    => tcp_v4_do_rcv                                        // got here last week
        =>     tcp_rcv_established() | tcp_v4_hnd_req(sk, skb) | tcp_child_process
        =>     tcp_input.c::tcp_rcv_state_process()
                    -> icsk->icsk_af_ops->conn_request(sk, skb)
        == tcp_v4_conn_request()        // see table at tcp_ipv4.c::line 1758

tcp_v4_hnd_req():
    inet_csk_search_req: this is looking for the "request socket", a mini-socket with additional info
    tcp_check_req: checks if there is space in the accept queue
    inet_lookup_established: we *did* just call this: same as __inet_lookup_established with hnum=dport
    main path: ends up returning sk

Caller is tcp_v4_do_rcv();
    caller falls through to tcp_rcv_state_process
        -> icsk->icsk_af_ops->conn_request(sk, skb)
        == tcp_v4_conn_request()        // see table at tcp_ipv4.c::line 1758

tcp_v4_conn_request():        // handles incoming SYN
    // error cases first
    tcp_clear_options();
    tcp_parse_options;
    tcp_openreq_init
    save saddr/daddr in ireq, which is a cast of req, which is a struct request_sock.

    saves req using inet_csk_reqsk_queue_hash_add(sk, req, TCP_TIMEOUT_INIT);    // csk = Connected SocKet
    see also inet_csk_search_req
    calls __tcp_v4_send_synack

tcp_input.c:
    int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)    // called by tcp_v4_do_rcv for states besides ESTABLISHED, LISTEN
    ESTABLISHED: tcp_data_queue()

Wednesday

lib/rbtree.c

Brief overview of HTB

htb_classify()

htb_dequeue()

    htb_dequeue_tree()

Does this even belong in the kernel?