Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't send udp packet to local network without gateway. #269

Open
bestpika opened this issue Apr 18, 2017 · 4 comments
Open

Can't send udp packet to local network without gateway. #269

bestpika opened this issue Apr 18, 2017 · 4 comments
Labels

Comments

@bestpika
Copy link

bestpika commented Apr 18, 2017

I can't send udp packet to local network without gateway.
But can send to broadcast address (255.255.255.255).

#define PORT 5000

#include <EtherCard.h>
#include <IPAddress.h>

uint8_t macAddr[] = { 0, 0, 0, 0, 255, 1 };
uint8_t ipAddr[] = { 172, 16, 255, 1 };
uint8_t netMask[] = { 255, 255, 0, 0 };

uint8_t distAddr[] = { 255, 255, 255, 255 }; // I can't send packet to 172.16.255.2.

byte Ethernet::buffer[256];

void setup() {
  ether.begin(sizeof(Ethernet::buffer), macAddr);
  ether.staticSetup(ipAddr, 0, 0, netMask);
  ether.printIp("", ether.myip);
}

void loop() {
  char c[] = { 'h', 'i' };
  ether.sendUdp(c, sizeof(c), PORT, distAddr, PORT);
  delay(1000);
}
@bestpika bestpika changed the title Can't send udp packet to local network with no gateway. Can't send udp packet to local network without gateway. Apr 18, 2017
@solarkennedy
Copy link
Contributor

This may need a fix similar to #167.

But udp already does this
https://github.com/jcw/ethercard/blob/master/tcpip.cpp#L377

Can you confirm you are using the latest version of the library?

@bestpika
Copy link
Author

I use git clone https://github.com/jcw/ethercard.git to clone this repo.
So I think I get the latest version.

@solarkennedy
Copy link
Contributor

It is possible that we have a /24 assumption somewhere in the code.

Can you get a packet capture (tcpdump -s 1500) of the thing trying to transmit packets? (I know this is difficult if they are not arriving at 172.16.255.2, but maybe they are being sent out incorrectly)

@Tzoreol
Copy link

Tzoreol commented May 20, 2017

Same problem with repo clone today.

@njh njh added the bug label Jul 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants