Changeset 313824a in mainline for uspace/srv/net/inetsrv/pdu.c


Ignore:
Timestamp:
2013-07-16T17:05:30Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f97352
Parents:
fc4bf2a
Message:

all fragments of a packet need to have the same identifier (thx Antonin Steinhauser)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/inetsrv/pdu.c

    rfc4bf2a r313824a  
    4949#include "pdu.h"
    5050
    51 static FIBRIL_MUTEX_INITIALIZE(ip_ident_lock);
    52 static uint16_t ip_ident = 0;
    5351
    5452/** One's complement addition.
     
    107105 */
    108106int inet_pdu_encode(inet_packet_t *packet, addr32_t src, addr32_t dest,
    109    size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
     107    size_t offs, size_t mtu, void **rdata, size_t *rsize, size_t *roffs)
    110108{
    111109        /* Upper bound for fragment offset field */
     
    152150                return ENOMEM;
    153151       
    154         /* Allocate identifier */
    155         fibril_mutex_lock(&ip_ident_lock);
    156         uint16_t ident = ++ip_ident;
    157         fibril_mutex_unlock(&ip_ident_lock);
    158        
    159152        /* Encode header fields */
    160153        ip_header_t *hdr = (ip_header_t *) data;
     
    164157        hdr->tos = packet->tos;
    165158        hdr->tot_len = host2uint16_t_be(size);
    166         hdr->id = host2uint16_t_be(ident);
     159        hdr->id = host2uint16_t_be(packet->ident);
    167160        hdr->flags_foff = host2uint16_t_be(flags_foff);
    168161        hdr->ttl = packet->ttl;
     
    259252                return ENOMEM;
    260253       
    261 #if 0
    262         // FIXME TODO fragmentation
    263        
    264         /* Allocate identifier */
    265         fibril_mutex_lock(&ip_ident_lock);
    266         uint16_t ident = ++ip_ident;
    267         fibril_mutex_unlock(&ip_ident_lock);
    268 #endif
    269        
    270254        /* Encode header fields */
    271255        ip6_header_t *hdr6 = (ip6_header_t *) data;
Note: See TracChangeset for help on using the changeset viewer.