dhcp
dhcp copied to clipboard
dhcpv6: pretty message printing
cleaned up message printing in DHCPv6. I chose some I think somewhat readable format. I kept the {}
because messages can nest so deep, imho they're really useful.
I didn't expand IANA and IAPD fields on their own line -- let me know what you think about that...
examples/everythingmessage:
RelayMessage{
MessageType=RELAY-FORW
HopCount=0
LinkAddr=<nil>
PeerAddr=<nil>
Options: [
Relay Message: Message{
MessageType=REPLY
TransactionID=0x6c95c4
Options: [
Client ID: DUID{Type=DUID-LLT HWType=Ethernet HWAddr=01:02:de:ad:be:ef}
Rapid Commit
Boot File URL: http://foobar
Boot File Parameters: [loglevel=10 uroot.nohwrng]
Client Link-Layer Address: {Type=Ethernet LinkLayerAddress=01:02:be:ef:de:ad}
4RD: {Options=[
4RD Mapping Rule: {Prefix4=123.123.0.0/16, Prefix6=fc80::/64, EA-Bits=0, WKPAuthorized=false}
4RD Non-Mapping Rule: {HubAndSpoke=true, TrafficClass=false, DomainPMTU=0}
]}
Encapsulated DHCPv4 Message: {DHCPv4 Message
opcode: BootRequest
hwtype: Ethernet
hopcount: 0
transaction ID: 0xc4077d78
num seconds: 0
flags: Unicast (0x00)
client IP: 0.0.0.0
your IP: 0.0.0.0
server IP: 0.0.0.0
gateway IP: 0.0.0.0
client MAC: 01:02:de:ad:be:ef
server hostname:
bootfile name:
options:
DHCP Message Type: DISCOVER
Parameter Request List: Subnet Mask, Router, Domain Name Server, Domain Name
}
DHCPv4-over-DHCPv6 Servers: [fe81::1]
DNS: [fe82::1]
IAPD: {IAID=0x01020304 T1=0s T2=0s Options=[
IAPrefix: {PreferredLifetime=0s ValidLifetime=0s Prefix=fc80::/64 Options=[
StatusCode: {Code=Success (0); Message=yeah whatever}
]}
]}
Information Refresh Time: 1s
Interface ID: [1 2]
Network Interface ID: First gen. PXE boot ROMs (Revision 1.0)
Vendor Options: {EnterpriseNum=123 VendorOptions=[
unknown (400): [102 111 111 98 97 114]
]}
IANA: {IAID=0xdeadbeef T1=0s T2=0s Options=[
IAAddress: {IP=fe80::1 PreferredLifetime=0s ValidLifetime=0s Options=[
StatusCode: {Code=Success (0); Message=yes}
]}
]}
IATA: {IAID=0x00000000 Options=[
IAAddress: {IP=fe80::1 PreferredLifetime=0s ValidLifetime=0s Options=[
StatusCode: {Code=Success (0); Message=yes}
]}
]}
IATA: {IAID=0x00000000 Options=[]}
]
}
Remote ID: {EnterpriseNumber=291 RemoteID=[1 2]}
]
}
stickler-ci
is not happy. There are some LongString
methods without a comment.
Closing in favor of #485