Changeset 6896409c in mainline for uspace/srv/net/tl/tcp/header.c


Ignore:
Timestamp:
2011-11-21T22:46:37Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1812a0d
Parents:
eea65f4
Message:

Fix off-by-one bug in BIT_V.
Fix FIN being sent too early.
Fix FIN not being sent.
Fix seg→len from decoded PDU.
Add segment dumps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tl/tcp/header.c

    reea65f4 r6896409c  
    3535 */
    3636
     37#include <bitops.h>
    3738#include <byteorder.h>
    3839#include <errno.h>
     
    4142#include "header.h"
    4243#include "segment.h"
     44#include "seq_no.h"
    4345#include "std.h"
    4446#include "tcp_type.h"
     
    7375        ctl = 0;
    7476
    75         if ((doff_flags & DF_URG) != 0)
     77        if ((doff_flags & BIT_V(uint16_t, DF_URG)) != 0)
    7678                ctl |= 0 /* XXX */;
    77         if ((doff_flags & DF_ACK) != 0)
     79        if ((doff_flags & BIT_V(uint16_t, DF_ACK)) != 0)
    7880                ctl |= CTL_ACK;
    79         if ((doff_flags & DF_PSH) != 0)
     81        if ((doff_flags & BIT_V(uint16_t, DF_PSH)) != 0)
    8082                ctl |= 0 /* XXX */;
    81         if ((doff_flags & DF_RST) != 0)
     83        if ((doff_flags & BIT_V(uint16_t, DF_RST)) != 0)
    8284                ctl |= CTL_RST;
    83         if ((doff_flags & DF_SYN) != 0)
     85        if ((doff_flags & BIT_V(uint16_t, DF_SYN)) != 0)
    8486                ctl |= CTL_SYN;
    85         if ((doff_flags & DF_FIN) != 0)
     87        if ((doff_flags & BIT_V(uint16_t, DF_FIN)) != 0)
    8688                ctl |= CTL_FIN;
    8789
     
    9799
    98100        if ((ctl & CTL_ACK) != 0)
    99                 doff_flags |= DF_ACK;
     101                doff_flags |= BIT_V(uint16_t, DF_ACK);
    100102        if ((ctl & CTL_RST) != 0)
    101                 doff_flags |= DF_RST;
     103                doff_flags |= BIT_V(uint16_t, DF_RST);
    102104        if ((ctl & CTL_SYN) != 0)
    103                 doff_flags |= DF_SYN;
     105                doff_flags |= BIT_V(uint16_t, DF_SYN);
    104106        if ((ctl & CTL_FIN) != 0)
    105                 doff_flags |= DF_FIN;
     107                doff_flags |= BIT_V(uint16_t, DF_FIN);
    106108
    107109        *rdoff_flags = doff_flags;
     
    203205
    204206        tcp_header_decode(pdu->header, nseg);
     207        nseg->len += seq_no_control_len(nseg->ctrl);
    205208
    206209        hdr = (tcp_header_t *)pdu->header;
Note: See TracChangeset for help on using the changeset viewer.