Changeset df15e5f in mainline


Ignore:
Timestamp:
2012-02-12T20:09:36Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd8bfc5a
Parents:
4f64a523
Message:

Fix bug in MAC address decoding.

Location:
uspace/srv
Files:
3 edited

Legend:

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

    r4f64a523 rdf15e5f  
    198198}
    199199
     200#include <stdio.h>
    200201static void ethip_nic_received(ethip_nic_t *nic, ipc_callid_t callid,
    201202    ipc_call_t *call)
     
    212213                return;
    213214        }
     215
     216        log_msg(LVL_DEBUG, "Ethernet PDU contents (%zu bytes)",
     217            size);
     218        size_t i;
     219        for (i = 0; i < size; i++)
     220                printf("%02x ", ((uint8_t *)data)[i]);
     221        printf("\n");
    214222
    215223        log_msg(LVL_DEBUG, "call ethip_received");
  • uspace/srv/ethip/pdu.c

    r4f64a523 rdf15e5f  
    7676}
    7777
     78#include <stdio.h>
    7879/** Decode Ethernet PDU. */
    7980int eth_pdu_decode(void *data, size_t size, eth_frame_t *frame)
     
    102103            frame->size);
    103104
     105        log_msg(LVL_DEBUG, "Ethernet frame src=%llx dest=%llx etype=%x",
     106            frame->src, frame->dest, frame->etype_len);
     107        log_msg(LVL_DEBUG, "Ethernet frame payload (%zu bytes)", frame->size);
     108        size_t i;
     109        for (i = 0; i < frame->size; i++) {
     110                printf("%02x ", ((uint8_t *)(frame->data))[i]);
     111        }
     112        printf("\n");
     113
    104114        return EOK;
    105115}
     
    113123        val = addr->addr;
    114124        for (i = 0; i < MAC48_BYTES; i++) {
    115                 bbuf[i] = (val >> 8*(MAC48_BYTES - i - 1)) & 0xff;
     125                bbuf[i] = (val >> (8 * (MAC48_BYTES - i - 1))) & 0xff;
    116126                val = val >> 8;
    117127        }
     
    126136        val = 0;
    127137        for (i = 0; i < MAC48_BYTES; i++)
    128                 val |= ((uint64_t)bdata[i]) << (MAC48_BYTES - i - 1);
     138                val |= (uint64_t)bdata[i] << (8 * (MAC48_BYTES - i - 1));
    129139
    130140        addr->addr = val;
  • uspace/srv/tcp/tcp.c

    r4f64a523 rdf15e5f  
    208208        printf(NAME ": TCP (Transmission Control Protocol) network module\n");
    209209
    210         rc = log_init(NAME, LVL_ERROR);
     210        rc = log_init(NAME, LVL_DEBUG);
    211211        if (rc != EOK) {
    212212                printf(NAME ": Failed to initialize log.\n");
Note: See TracChangeset for help on using the changeset viewer.