Git Product home page Git Product logo

udp-broadcast-relay's Introduction

UDP Broadcast Packet Relay

This program listens for packets on a specified UDP broadcast port. When a packet is received, it sends that packet to all specified interfaces but the one it came from as though it originated from the original sender.

The primary purpose of this is to allow games on machines on separated local networks (Ethernet, WLAN) that use udp broadcasts to find each other to do so.

It also works on ppp links, so you can log in from windows boxes (e.g. using pptp) and play LAN-based games together. Currently, you have to care about upcoming or downgoing interfaces yourself.

Note that it is possible to achieve this using iptables as well.

INSTALL

make 
cp udp-broadcast-relay /some/where

USAGE

/some/where/udp-broadcast-relay id udp-port eth0 eth1...

udp-broadcast-relay must be run as root to be able to create a raw socket (necessary) to send packets as though they originated from the original sender.

COMPATIBILITY

  • I run debian woody with Linux 2.4.20, and here it works.

EXAMPLE

/some/where/udp-broadcast-relay -f 1 6112 eth0 eth1  # forward Warcraft 3 broadcast packets

CONTRIBUTORS

Over the last years, various people submitted code to the project. Note that I do not use udp-broadcast-relay any more myself, so these changes were not tested by me.

  • Patrick Huesmann submitted a patch to make udp-broadcast-relay send the packes to those NICs it did not recieve it from, based on the actual socket, not the broadcast IP. This is useful if more than one physical networks share the same broadcast range.
  • Савченко В. М. submitted an ip-up.local an ip-down.local file to automatically restart udp-broadcast-relay when new ppp-interfaces come up, see ppp-if.up-local for details.
  • Roman Hoog Antink contributed the option -s to spoof the source IP of forwarded packages.

Thanks to all contributors!

BUGS/CRITICISM/PATCHES/ETC

HISTORY

  • 0.3 2003-09-28

    Sending packets also to ppp addresses

  • 0.2 2003-09-18

    Flags for debugging and forking, Compilefixes, Makefile-Target "clean"

  • 0.1 2003-09-15

    Initial rewrite of udp_broadcast_fw

CREDITS

This is based upon udp_broadcast_fw by Nathan O'Sullivan.

HISTORY of udp_broadcast_fw

  • 0.1.1 - 19 Feb 02

    Moved fork() code to just before main loop so that errors would appear

  • 0.1 - 18 Feb 02

    Initial release

LICENSE

This code is made available under the GPL. Read the COPYING file inside the archive for more info.

udp-broadcast-relay's People

Contributors

boomer41 avatar delitants avatar mwarning avatar nomeata avatar patrislav1 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

udp-broadcast-relay's Issues

Can't find the TTL!

Hi I was using your util but it couldn't find the TTL of some incoming packets, exiting with the message:

TTL not found on incoming packet
: Success

I have your utility running as ./udp-broadcast-relay -d 1 27036 br0 vlan2
on a DD-WRT v24-sp2 router: Linux DD-WRT 2.4.37 #13289 Thu Aug 12 02:43:07 CEST 2010 mips unknown.

I've noticed that when it is iterating through all the packet headers it only goes through one iteration,
and never hits the IP_TTL message header type.

Another issue I noticed is that only broadcast messages from br0 are being detected and none from vlan2, some info about them:

br0       Link encap:Ethernet  HWaddr 00:23:69:4A:B7:0B  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1

vlan2     Link encap:Ethernet  HWaddr 00:23:69:4A:B7:0C  
          inet addr:128.61.105.148  Bcast:128.61.107.255  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

Thank you!

Unable to compile on CentOS 7

When trying to compile on CentOS 7 I receive the following output:

[root@TURMERIC udp-broadcast-relay]# make
c99   -Wall main.c -o udp-broadcast-relay
main.c:64:1: error: unknown type name ‘u_char’
 static u_char gram[4096] = {
 ^
main.c: In function ‘main’:
main.c:80:2: error: unknown type name ‘u_char’
  u_char id;
  ^
main.c:81:2: error: unknown type name ‘u_char’
  u_char ttl;
  ^
main.c:100:2: error: unknown type name ‘u_char’
  u_char pkt_infos[16384];
  ^
main.c:235:3: warning: implicit declaration of function ‘bcopy’ [-Wimplicit-function-declaration]
   bcopy((struct sockaddr_in *) &reqbuf.ifr_addr,
   ^
main.c:316:4: error: ‘u_short’ undeclared (first use in this function)
  *(u_short*)(gram + 22) = (u_short) htons(port);
    ^
main.c:316:4: note: each undeclared identifier is reported only once for each function it appears in
main.c:316:12: error: expected expression before ‘)’ token
  *(u_short*)(gram + 22) = (u_short) htons(port);
            ^
main.c:316:37: error: expected ‘;’ before ‘htons’
  *(u_short*)(gram + 22) = (u_short) htons(port);
                                     ^
main.c:347:59: error: dereferencing pointer to incomplete type
      rcv_ifindex = ((struct in_pktinfo *) CMSG_DATA(cmsg))->ipi_ifindex;
                                                           ^
main.c:374:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
             ^
main.c:374:38: error: expected ‘;’ before ‘rcv_addr’
   *(u_short*)(gram + 20) = (u_short) rcv_addr.sin_port;
                                      ^
main.c:377:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 24) = htons(8 + len);
             ^
main.c:378:13: error: expected expression before ‘)’ token
   *(u_short*)(gram + 2) = htons(28 + len);
             ^
main.c:392:21: error: expected expression before ‘)’ token
     ntohs(*(u_short*) (gram + 22)), /* dst port */
                     ^
make: *** [udp-broadcast-relay] Error 1
[root@TURMERIC udp-broadcast-relay]# c99 --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.