Coder Social home page Coder Social logo

nanodeuip's People

Contributors

jmccrohan avatar maniacbug avatar njh avatar sde1000 avatar thiseldo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nanodeuip's Issues

[PATCH] Packet slicer: DHCP with <400-byte uip buffer

From 5f386f3 Mon Sep 17 00:00:00 2001
From: maniacbug [email protected]
Date: Sun, 8 Jan 2012 14:24:33 -0800
Subject: [PATCH] Packet slicer.

Allows processing of (and ignores checksums on) packets which are smaller than the packet header believes. This is very useful in highly-constrained memory environments. The most likely case of a sliced packet is the network later truncated it because the packet is larger than the UIP buffer.

A good example of where this helps is DHCP. The official minimum size of a DHCP packet is 590, but we don't want to have a UIP buffer of 590, we'd rather have 400. Fortunately, only the bottom 330 bytes have any data, so we can safely ignore the sliced off part. This allows DHCP without wasting RAM on otherwise unneeded UIP buffer space.

uip.cpp | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/uip.cpp b/uip.cpp
index 8e577a9..5618d50 100644
--- a/uip.cpp
+++ b/uip.cpp
@@ -690,6 +690,8 @@ void
uip_process(u8_t flag)
{
register struct uip_conn *uip_connr = uip_conn;

  • /* Whether this packet was sliced (truncated) by the network layer */
  • uint8_t packet_sliced = 0;

if UIP_UDP

if(flag == UIP_UDP_SEND_CONN) {
@@ -876,7 +878,8 @@ uip_process(u8_t flag)

endif /* UIP_CONF_IPV6 */

} else {
UIP_LOG("ip: packet shorter than reported in IP header.");

  • goto drop;
  • packet_sliced = 1;
  • UIP_LOG("Assuming it was sliced by the network layer.");
    }

if !UIP_CONF_IPV6

@@ -950,7 +953,10 @@ uip_process(u8_t flag)
UIP_STAT(++uip_stat.ip.drop);
UIP_STAT(++uip_stat.ip.chkerr);
UIP_LOG("ip: bad checksum.");

  • goto drop;
  • if (packet_sliced)
  •  UIP_LOG("Ignoring because packet was sliced.");
    
  • else
  •  goto drop;
    
    }
    #endif /* UIP_CONF_IPV6 */

@@ -1100,7 +1106,10 @@ uip_process(u8_t flag)
UIP_STAT(++uip_stat.udp.drop);
UIP_STAT(++uip_stat.udp.chkerr);
UIP_LOG("udp: bad checksum.");

  • goto drop;
  • if (packet_sliced)
  •  UIP_LOG("Ignoring because packet was sliced.");
    
  • else
  •  goto drop;
    

    }
    #else /* UIP_UDP_CHECKSUMS */
    uip_len = uip_len - UIP_IPUDPH_LEN;

    1.7.5.4

README: DHCP packet size issues

You might want to point out in the readme that DHCP can cause issues for a 450-byte packet size. The default DHCP Offer packet is 590 bytes. Some routers have a configuration to reduce it down to the ~300 necessary bytes, but others do not. (See http://www.linksysinfo.org/index.php?threads/dhcp-reduce-packet-size.20699/ for one example).

In fact, RFC2131 says, "A DHCP client must be prepared to receive DHCP messages with an 'options' field of at least length 312 octets. This requirement implies that a DHCP client must be prepared to receive a message of up to 576 octets, the minimum IP datagram size an IP host must be prepared to accept [3]. " No help to those of us on MCU's!

[PATCH] Buffer overrun bug in enc28j60ReadBuffer


From e7db1e7d356eaff1d6f8c53a6e017673bd55748c Mon Sep 17 00:00:00 2001
From: maniacbug 
Date: Sun, 1 Jan 2012 21:50:05 -0800
Subject: [PATCH] Fixed a buffer overrun bug in enc28j60ReadBuffer.  This
 writes all over memory it doesn't own.  Bad stuff.

---
 enc28j60.cpp |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/enc28j60.cpp b/enc28j60.cpp
index 3d5630e..ee04647 100644
--- a/enc28j60.cpp
+++ b/enc28j60.cpp
@@ -86,7 +86,6 @@ void enc28j60ReadBuffer(uint16_t len, uint8_t* data)
         *data++ = SPDR;
     }
     disableChip();
-    *data='\0';
 }
 
 static word enc28j60ReadBufferWord() {
-- 
1.7.5.4

DHCP with the NanodeUIP library

Hi guys,
I am developpin' on an arduino UNO board rev 3 and I have plugged into it a ENC28J60-H ethernet shield.
I'm using the NanodeUIP,NanodeUNIO librairies for my application and I don't know how to get an IP address usin' DHCP. I've also tried the uiptest example but it doesn't work at all.
Maybe I'm just an ignorant newbie in the Arduino World but I definitively don't know how to make it works.
Please I need some help.
Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.