Skip to content

Commit

Permalink
Bugfix for things like VPN tunnels: on a tun interface where there is
Browse files Browse the repository at this point in the history
no concept of a MAC address, just send the IP packet. Don't add src MAC,
dest MAC and IP ethertype.
  • Loading branch information
alsmith committed Jun 14, 2020
1 parent 977db08 commit d3e065e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions multicast-relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,13 @@ def transmitPacket(self, sock, srcMac, destMac, ipHeaderLength, ipPacket):

ipHeader = ipHeader[:2]+struct.pack('!H', totalLength)+ipHeader[4:6]+struct.pack('!H', flagsOffset)+ipHeader[8:]
ipPacket = self.computeIPChecksum(ipHeader + udpHeader + dataFragment, ipHeaderLength)
etherPacket = destMac + srcMac + self.etherType + ipPacket

try:
sock.send(etherPacket)
if srcMac != binascii.unhexlify('00:00:00:00:00:00'.replace(':', '')):
etherPacket = destMac + srcMac + self.etherType + ipPacket
sock.send(etherPacket)
else:
sock.send(ipPacket)
except Exception as e:
self.logger.info('Error sending packet: %s' % str(e))

Expand Down

0 comments on commit d3e065e

Please sign in to comment.