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

problems with IP in sending UDP packets #3

Open
Andyroc opened this issue Oct 22, 2020 · 3 comments
Open

problems with IP in sending UDP packets #3

Andyroc opened this issue Oct 22, 2020 · 3 comments

Comments

@Andyroc
Copy link

Andyroc commented Oct 22, 2020

Spent several hours and still can't find how to do it. I can not send UDP to a custom IP address, only to the one with which a connection is established. Maybe there is some kind of filter that does not allow this, or somewhere I can change the destination IP manually in udp packet?

@JAndrassy
Copy link
Member

try the github version.

@Andyroc
Copy link
Author

Andyroc commented Oct 28, 2020

I solved my problem, by disabling this part in uip_arp.c

if(i == UIP_ARPTAB_SIZE)
 {
    memset(BUF->ethhdr.dest.addr, 0xff, 6);
      memset(BUF->dhwaddr.addr, 0x00, 6);
      memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
      memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
    
      uip_ipaddr_copy(BUF->dipaddr, ipaddr);
      uip_ipaddr_copy(BUF->sipaddr, uip_hostaddr);
      BUF->opcode = HTONS(ARP_REQUEST); //// ARP request. 
      BUF->hwtype = HTONS(ARP_HWTYPE_ETH);
      BUF->protocol = HTONS(UIP_ETHTYPE_IP);
      BUF->hwlen = 6;
      BUF->protolen = 4;
      BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);

      uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
    
      uip_len = sizeof(struct arp_hdr);
      return;
    }

@JAndrassy
Copy link
Member

JAndrassy commented Oct 28, 2020

there is a less invasive way for this patch, I think.
instead of removing code in uip_arp.c remove the line uip_arp_out() from UIPUDP::_send in EthernertUdp.cpp

I already looked at this and I have to investigate it to understand why the switch from normal packet to arp packet is done differently for UDP than TCP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants