Changeset 1cc8b42 in mainline for uspace/srv/ethip/pdu.c


Ignore:
Timestamp:
2012-02-27T20:34:58Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f9d3dd4
Parents:
56792a2
Message:

Correct IP checksum and identification.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ethip/pdu.c

    r56792a2 r1cc8b42  
    4949
    5050/** Encode Ethernet PDU. */
     51#include <stdio.h>
    5152int eth_pdu_encode(eth_frame_t *frame, void **rdata, size_t *rsize)
    5253{
     
    6970            frame->size);
    7071
     72        log_msg(LVL_DEBUG, "Encoding Ethernet frame src=%llx dest=%llx etype=%x",
     73            frame->src, frame->dest, frame->etype_len);
     74        log_msg(LVL_DEBUG, "Encoded Ethernet frame (%zu bytes)", size);
     75        size_t i;
     76        for (i = 0; i < size; i++) {
     77                printf("%02x ", ((uint8_t *)(data))[sizeof(eth_header_t) + i]);
     78        }
     79        printf("\n");
     80
     81
    7182        *rdata = data;
    7283        *rsize = size;
     
    101112            frame->size);
    102113
    103         log_msg(LVL_DEBUG, "Ethernet frame src=%llx dest=%llx etype=%x",
     114        log_msg(LVL_DEBUG, "Decoding Ethernet frame src=%llx dest=%llx etype=%x",
    104115            frame->src, frame->dest, frame->etype_len);
    105         log_msg(LVL_DEBUG, "Ethernet frame payload (%zu bytes)", frame->size);
     116        log_msg(LVL_DEBUG, "Decoded Ethernet frame payload (%zu bytes)", frame->size);
    106117        size_t i;
    107118        for (i = 0; i < frame->size; i++) {
     
    200211        }
    201212
    202         if (uint16_t_be2host(pfmt->proto_addr_space) != ETYPE_IP) {
     213        if (uint16_t_be2host(pfmt->proto_addr_space) != 0x0800) {
    203214                log_msg(LVL_DEBUG, "Proto address space != %u (%" PRIu16 ")",
    204215                    ETYPE_IP, uint16_t_be2host(pfmt->proto_addr_space));
Note: See TracChangeset for help on using the changeset viewer.