Changeset 313824a in mainline


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)

Location:
uspace/srv/net/inetsrv
Files:
4 edited

Legend:

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

    rfc4bf2a r313824a  
    5252static bool first_link6 = true;
    5353
     54static FIBRIL_MUTEX_INITIALIZE(ip_ident_lock);
     55static uint16_t ip_ident = 0;
     56
    5457static int inet_link_open(service_id_t);
    5558static int inet_iplink_recv(iplink_t *, iplink_recv_sdu_t *, uint16_t);
     
    366369        packet.proto = proto;
    367370        packet.ttl = ttl;
     371       
     372        /* Allocate identifier */
     373        fibril_mutex_lock(&ip_ident_lock);
     374        packet.ident = ++ip_ident;
     375        fibril_mutex_unlock(&ip_ident_lock);
     376       
    368377        packet.df = df;
    369378        packet.data = dgram->data;
    370379        packet.size = dgram->size;
    371380       
     381        int rc;
    372382        size_t offs = 0;
    373         int rc;
    374383       
    375384        do {
     
    421430        packet.proto = proto;
    422431        packet.ttl = ttl;
     432       
     433        /* Allocate identifier */
     434        fibril_mutex_lock(&ip_ident_lock);
     435        packet.ident = ++ip_ident;
     436        fibril_mutex_unlock(&ip_ident_lock);
     437       
    423438        packet.df = df;
    424439        packet.data = dgram->data;
  • uspace/srv/net/inetsrv/inet_std.h

    rfc4bf2a r313824a  
    4848        /** Total Length */
    4949        uint16_t tot_len;
    50         /** Identification */
     50        /** Identifier */
    5151        uint16_t id;
    5252        /** Flags, Fragment Offset */
     
    126126        /** Fragmentation offset, reserved and M flag */
    127127        uint16_t offsmf;
    128         /** Identification */
     128        /** Identifier */
    129129        uint32_t id;
    130130} ip6_header_fragment_t;
  • uspace/srv/net/inetsrv/inetsrv.h

    rfc4bf2a r313824a  
    113113        uint8_t ttl;
    114114        /** Identifier */
    115         uint16_t ident;
     115        uint32_t ident;
    116116        /** Do not fragment */
    117117        bool df;
  • 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.