Skip to content

Commit

Permalink
we do be adding awful hacks in here
Browse files Browse the repository at this point in the history
  • Loading branch information
ifd3f committed Apr 15, 2024
1 parent 174e65f commit 4d3adaa
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions machines/lucifer/etc/rc.conf.d/ipv6_ndp_hack
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipv6_ndp_hack_enable="YES"
14 changes: 14 additions & 0 deletions machines/lucifer/etc/rc.d/ipv6_ndp_hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

# See /usr/local/bin/ipv6_ndp_hack.py for more information.

. /etc/rc.subr

name="ipv6_ndp_hack"
rcvar=ipv6_ndp_hack_enable
pidfile="/tmp/ipv6_ndp_hack.pid"
command="/usr/sbin/daemon"
command_args="-p $pidfile /usr/local/bin/ipv6_ndp_hack.py"

load_rc_config $name
run_rc_command "$1"
47 changes: 47 additions & 0 deletions machines/lucifer/usr/local/bin/ipv6_ndp_hack.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/local/bin/python3
"""
This service exists because for some fucking reason this machine
is dropping neighbor advertisements. I don't know why it's doing that
and I have given up on fixing it, so this hack will be in place.
The following have been observed:
- the firewall is not seeing neighbor solicits
- the server is generating neighbor solicits
- none of the switches in between are dropping neighbor solicits
- ping server -> firewall won't insert a NDP entry
- ping firewall -> server will insert a NDP entry on both ends
- a single ping of firewall -> server allows server -> firewall to
continue to work due to the cached NDP entry
Therefore, this service will continuously ping the other host once
every 10s to ensure that NDP entry exists.
"""

import subprocess
import time

INTERVAL_SECONDS = 10

targets = [
"fd67:113:7c37:3339::2",
"fd67:113:7c37:3339::3",
]


def main():
while True:
ping_all()
time.sleep(INTERVAL_SECONDS)


def ping_all():
procs = [
subprocess.Popen(["ping", "-c", "1", "-t", "1", t], stdout=subprocess.DEVNULL)
for t in targets
]
for p in procs:
p.wait()


if __name__ == "__main__":
main()

0 comments on commit 4d3adaa

Please sign in to comment.