[Click] wifi llc handling problem in Click 1.5

Mathias Kurth kurth at informatik.hu-berlin.de
Thu Sep 21 05:32:16 EDT 2006


Hi Eddie,

Maybe there is something wrong with my compiler but it reports a size of 4
for the llc header definition.
Here is a cut&paste example that demonstrates what I mean:

#include <stdlib.h> 
#include <stdio.h>
#include <stdint.h>
#include <string.h>

// 6-byte LLC header (last byte is terminating NUL)
#define wifi_llc_header ((const uint8_t *) "\xAA\xAA\x03\x00\x00")

int main()
{
  uint8_t* p;
  int i;
 
  p = (uint8_t*)malloc( 200*sizeof(uint8_t) );
  memset(p, '\x99', 200);
  uint16_t ethtype = 256 + 1;

  memcpy(p, wifi_llc_header, sizeof(wifi_llc_header));
  memcpy(p + 6, &ethtype, 2);

  printf("sizeof wifi_llc_header = %d\n", sizeof((char*)"hallo"));
  for (i = 0; i < 20; i++)
    printf("%.2x ", p[i]);

  return (0);
}

It generates the following output:

sizeof wifi_llc_header = 4
aa aa 03 00 99 99 01 01 99 99 99 99 99 99 99 99 99 99 99 99

This corresponds to the observations we made in our testbed. We
captured the frames generated by click and did see that they contained
an invalid llc header. 

Kind regards,
Mathias

-----Ursprüngliche Nachricht-----
Von: Eddie Kohler [mailto:kohler at cs.ucla.edu] 
Gesendet: Sonntag, 17. September 2006 05:18
An: Mathias Kurth
Cc: click at amsterdam.lcs.mit.edu
Betreff: Re: [Click] wifi llc handling problem in Click 1.5

Hi Mathias,

I think that code was written expecting that C would add a trailing null byte, 
as it is required to.  In fact C reports that "sizeof("\xAA\xAA\x03\x00\x00")" 
is 6.  The last byte is 0.  So I think your diagnosis is wrong although maybe 
you are really seeing a problem.

Your diagnosis of the shift_data() problem is right, though!  The easiest 
change is probably to shift the packet's headroom as well as its currently 
active data area (which would shift the old ether header), and that is what 
I've done.  This will affect performance, however, since we are shifting more 
data per misaligned packet.  In our defense if you are having to align packets 
you have performance problems anyway.

Report any problems you see.  Thanks.

Eddie




Mathias Kurth wrote:
> Hi,
> 
> It seems there is something wrong with the wifi llc header 
> in wifi.h. It does not consist of 6 bytes as expected:
> 
> #define wifi_llc_header ((const uint8_t *) "\xAA\xAA\x03\x00\x00")
> 
> The result is that the org-code is not zero and most of the 
> client station's wifi drivers do not accept the generated frame.
> 
> BTW: We've got another problem with the align element. It uses 
> the method Packet::shift_data(), which moves the data part of 
> the packet and adjusts the data and ether_header pointers according 
> to the offset. But if ether_header() points to a valid Ethernet header, 
> the header is not moved in memory so that ether_header() does not point to 
> the header any more. Accessing ether_header() afterwards results 
> obviously in trash data. 
> Is it a bug? Or is the behavior intentional and we use the 
> ether_header() in a wrong way?
> 
> Kind regards,
> Mathias 
> 
>  
> 
>  
> 
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list