Extra bytes in my packets!!

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
0b1
Member
Member
Posts: 35
Joined: Sun Feb 04, 2018 8:04 pm

Extra bytes in my packets!!

Post by 0b1 »

Anyone been through the pain of developing a network driver on Bochs?


I have extra bytes in my received packets, from ... I don't know where!
ne2k-buffer-comparison.png
If you look at the green "wut?" label you can see four extra bytes at the START of my ARP response. I know the sender isn't generating them - the number of bytes sent and buffer contents tally. It seems as though Bochs is adding them, or the ne2k module. There is nothing in the logs, except two entries that don't say much:

Code: Select all

00519512000d[NE2K  ] eth_socket: got packet: 64 bytes, dst=b0:c5:aa:bb:cc:2, src=de:de:de:1:2:3
00519512000d[NE2K  ] rx_frame with length 64
This might be TMI, but my NIC configuration looks like this:

Code: Select all

ne2k = {
  CR = {
    stop = false
    start = true
    tx_packet = false
    rdma_cmd = 4
    pgsel = 0
  }
  ISR = {
    pkt_rx = true
    pkt_tx = true
    rx_err = false
    tx_err = false
    overwrite = false
    cnt_oflow = false
    rdma_done = true
    reset = false
  }
  IMR = {
    rx_inte = false
    tx_inte = false
    rxerr_inte = false
    txerr_inte = false
    overw_inte = false
    cofl_inte = false
    rdma_inte = false
  }
  DCR = {
    wdsize = true
    endian = false
    longaddr = false
    loop = false
    auto_rx = false
    fifo_size = 0
  }
  TCR = {
    crc_disable = false
    loop_cntl = 0
    ext_stoptx = false
    coll_prio = false
  }
  TSR = {
    tx_ok = true
    collided = false
    aborted = false
    no_carrier = false
    fifo_ur = false
    cd_hbeat = false
    ow_coll = false
  }
  RCR = {
    errors_ok = false
    runts_ok = false
    broadcast = true
    multicast = false
    promisc = false
    monitor = false
  }
  RSR = {
    rx_ok = true
    bad_crc = false
    bad_falign = false
    fifo_or = false
    rx_missed = false
    rx_mbit = false
    rx_disabled = false
    deferred = false
  }
  local_dma = 0x0000
  page_start = 0x46
  page_stop = 0x80
  bound_ptr = 0x46
  tx_page_start = 0x40
  num_coll = 0x00
  tx_bytes = 0x0040
  fifo = 0x00
  remote_dma = 0x4040
  remote_start = 0x4000
  remote_bytes = 0x0000
  tallycnt_0 = 0x00
  tallycnt_1 = 0x00
  tallycnt_2 = 0x00
  physaddr = [
    0xb0, 0xc5, 0xaa, 0xbb, 0xcc, 0x02
  ]
  curr_page = 0x47
  mchash = [
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  ]
  rempkt_ptr = 0x00
  localpkt_ptr = 0x00
  address_cnt = 0x0000
  mem = ne2k.mem
  tx_timer_active = false
  pci_conf = [
[I deleted this for brevity]
  ]
}
After spending about 2 weeks on this, I am completely flummoxed. I can't find anything about a 4 byte header, preamble, etc.

If you have any ideas, even wacky ones, I am open to them.

Thanks!
Code or code not. There is no try.
Gigasoft
Member
Member
Posts: 854
Joined: Sat Nov 21, 2009 5:11 pm

Re: Extra bytes in my packets!!

Post by Gigasoft »

It's on page 11 in the DP8390 datasheet.
Post Reply