Skip to content

Instantly share code, notes, and snippets.

diff -ur /root/dhclient/clparse.c sbin/dhclient/clparse.c
--- /root/dhclient/clparse.c 2023-06-15 11:41:32.754958000 -0230
+++ sbin/dhclient/clparse.c 2023-06-15 12:23:19.363379000 -0230
@@ -47,6 +47,7 @@
#include "dhcpd.h"
#include "dhctoken.h"
+#include <netinet/ip.h>
struct client_config top_level_config;
diff -ur /root/dhclient/bpf.c sbin/dhclient/bpf.c
--- /root/dhclient/bpf.c 2023-06-15 11:41:32.749372000 -0230
+++ sbin/dhclient/bpf.c 2023-06-15 16:12:19.135346000 -0230
@@ -365,7 +365,7 @@
if (to.s_addr == INADDR_BROADCAST)
assemble_hw_header(interface, buf, &bufp);
assemble_udp_ip_header(buf, &bufp, from.s_addr, to.s_addr,
- htons(REMOTE_PORT), (unsigned char *)&raw, len);
+ htons(REMOTE_PORT), (unsigned char *)&raw, len, interface);
<?php
# to get a eeprom dump from the stick:
# ethtool -m pon0 raw on | base64
function dH(int $dec) { $hex = strtoupper(dechex($dec)); $l = strlen($hex); return "0x".str_pad($hex, ceil($l / 2) * 2, "0", STR_PAD_LEFT); }
function sH(string $string) { return strtoupper(bin2hex($string)); }
function cH(string $char) { return dH(ord($char)); }
function dB(int $dec) { $bin = decbin($dec); $l = strlen($bin); return str_pad($bin, ceil($l/8) * 8, "0", STR_PAD_LEFT); }
function bl(bool $bool) { return $bool ? 'true' : 'false'; }
# WARNING: DO NOT RUN THIS AS A SCRIPT, RUN THE COMMANDS MANUALLY
# Make rootfs persistent (yes, this command must be run twice)
fw_setenv bootcmd "run ubi_init; run flash_flash"
fw_setenv bootcmd "run ubi_init; run flash_flash"
# Confirm the change:
strings /dev/mtd1 | grep bootcmd
strings /dev/mtd2 | grep bootcmd