lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] DHCP malformed discover packet


From: samyuktar
Subject: [lwip-users] DHCP malformed discover packet
Date: Mon, 16 Dec 2019 04:42:54 -0700 (MST)

Hi,
Using CC1352P1 with ENC28J60 SPI-Ethernet bridge - able to ping device with
fixed IP address and send TCP message, udp.tcp echo etc. with static IP
address assigned to my PC and to the device. Wanted to set up DHCP so that
the PC would assign a free IP address to my device.

I am seeing a malformed DHCP discover message on Wireshark. Here's a summary
:

No.     Time           Source                Destination           Protocol
Length Info
      8 14.196334      0.0.0.0               255.255.255.255       BOOTP   
96     Boot Request from 74:69:69:2d:30:31 (74:69:69:2d:30:31)[Malformed
Packet]

Frame 8: 96 bytes on wire (768 bits), 96 bytes captured (768 bits) on
interface 0
Ethernet II, Src: 74:69:69:2d:30:31 (74:69:69:2d:30:31), Dst: Broadcast
(ff:ff:ff:ff:ff:ff)
    Destination: Broadcast (ff:ff:ff:ff:ff:ff)
        Address: Broadcast (ff:ff:ff:ff:ff:ff)
        .... ..1. .... .... .... .... = LG bit: Locally administered address
(this is NOT the factory default)
        .... ...1 .... .... .... .... = IG bit: Group address
(multicast/broadcast)
    Source: 74:69:69:2d:30:31 (74:69:69:2d:30:31)
        Address: 74:69:69:2d:30:31 (74:69:69:2d:30:31)
        .... ..0. .... .... .... .... = LG bit: Globally unique address
(factory default)
        .... ...0 .... .... .... .... = IG bit: Individual address (unicast)
    Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 0.0.0.0, Dst: 255.255.255.255
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
    Total Length: 336
        [Expert Info (Error/Protocol): IPv4 total length exceeds packet
length (82 bytes)]
            [IPv4 total length exceeds packet length (82 bytes)]
            [Severity level: Error]
            [Group: Protocol]
    Identification: 0x0000 (0)
    Flags: 0x0000
        0... .... .... .... = Reserved bit: Not set
        .0.. .... .... .... = Don't fragment: Not set
        ..0. .... .... .... = More fragments: Not set
        ...0 0000 0000 0000 = Fragment offset: 0
    Time to live: 255
    Protocol: UDP (17)
    Header checksum: 0xba9d [validation disabled]
    [Header checksum status: Unverified]
    Source: 0.0.0.0
    Destination: 255.255.255.255
User Datagram Protocol, Src Port: 68, Dst Port: 67
Dynamic Host Configuration Protocol
    Message type: Boot Request (1)
    Hardware type: Ethernet (0x01)
    Hardware address length: 6
    Hops: 0
    Transaction ID: 0xabcd0001
    Seconds elapsed: 0
    Bootp flags: 0x0000 (Unicast)
    Client IP address: 0.0.0.0
    Your (client) IP address: 0.0.0.0
    Next server IP address: 0.0.0.0
    Relay agent IP address: 0.0.0.0
    Client MAC address: 74:69:69:2d:30:31 (74:69:69:2d:30:31)
    Client hardware address padding: 00000000000000000000
[Malformed Packet: DHCP/BOOTP]
    [Expert Info (Error/Malformed): Malformed Packet (Exception occurred)]
        [Malformed Packet (Exception occurred)]
        [Severity level: Error]
        [Group: Malformed]


And here is how I am setting up my dhcp request: 

/*! @brief Add a net interface and make it the default interface
 */
static void default_netif_add(void)
{ 
  /* Gateway */
  IP4_ADDR(&gw, 0,0,0,0);
 
  /* local IP address */
  IP4_ADDR(&ip_addr, 0,0,0,0);
 
  /* netmask */
  IP4_ADDR(&netmask, 0,0,0,0);

  /* Destination (Remote) IP */
  IP4_ADDR(&dest_ip, 172,16,1,11);

  /* Broadcast */
//  IP4_ADDR(&broadcast, 255,255,255,255);
  IP4_ADDR(&broadcast, 255,255,255,255);

  /* First add the interface - ethernetif_init is defined in ethernetif.c,
for NO_SYS=0 input function is ethernetif_input */
  /* set this netif as the default */
  netif_set_default(netif_add(&mynetif, &ip_addr, &netmask,
                              &gw, NULL, (netif_init_fn) ethernetif_init,
ethernet_input));
  /* Bring the interface up */
  netif_set_up(&mynetif);

  /* Bring the link up */
  netif_set_link_up(&mynetif);
  
  dhcp_start(&mynetif);
}


I've read something on various forums stating that memory alignment of the
transmit buffer is relevant in this case, and I've set MEM_ALIGNMENT to 4 in
lwipopts.h, and I have copied the contents to be transmitted out from the
struct pbuf *p into a 4-byte aligned buffer in low_level_output  (reference
to this thread: 

https://lwip-users.nongnu.narkive.com/XOjYra1z/dhcp-issues-problem-found-how-do-i-solve-it)
 
- however this hasn't helped. 





--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]