new: new ndp.spoof.router_lifetime option

This commit is contained in:
konradh 2024-01-24 17:56:55 +01:00
commit 4dc7bae48c
2 changed files with 18 additions and 10 deletions

View file

@ -40,7 +40,7 @@ func ICMP6NeighborAdvertisement(srcHW net.HardwareAddr, srcIP net.IP, dstHW net.
var macIpv6Multicast = net.HardwareAddr([]byte{0x33, 0x33, 0x00, 0x00, 0x00, 0x01})
var ipv6Multicast = net.ParseIP("ff02::1")
func ICMP6RouterAdvertisement(ip net.IP, hw net.HardwareAddr, prefix string, prefixLength uint8) (error, []byte) {
func ICMP6RouterAdvertisement(ip net.IP, hw net.HardwareAddr, prefix string, prefixLength uint8, routerLifetime uint16) (error, []byte) {
eth := layers.Ethernet{
SrcMAC: hw,
DstMAC: macIpv6Multicast,
@ -69,7 +69,7 @@ func ICMP6RouterAdvertisement(ip net.IP, hw net.HardwareAddr, prefix string, pre
adv := layers.ICMPv6RouterAdvertisement{
HopLimit: 255,
Flags: 0x08, // prf
RouterLifetime: 1800,
RouterLifetime: routerLifetime,
Options: []layers.ICMPv6Option{
{
Type: layers.ICMPv6OptSourceAddress,