Commit 6eb3e78
committed
dhcpv6/ztpv6: avoid panic in ParseVendorData on non-Message packets
The Ciena branch of ParseVendorData unconditionally type-asserted the
DHCPv6 packet to *dhcpv6.Message to read the client identifier. Because
ParseVendorData accepts the dhcpv6.DHCPv6 interface and the ztpv6
helpers are documented to run on relayed packets, passing a
*dhcpv6.RelayMessage carrying a Ciena vendor class option panicked with
'interface conversion: dhcpv6.DHCPv6 is *dhcpv6.RelayMessage, not
*dhcpv6.Message'.
Guard the assertion with the comma-ok form so a non-Message packet
simply skips the serial-number lookup instead of crashing. Behavior for
*dhcpv6.Message inputs is unchanged. Adds a regression test.
Signed-off-by: Chris (ChrisJr404) <11917633+ChrisJr404@users.noreply.github.com>1 parent c308df0 commit 6eb3e78
2 files changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
0 commit comments