Skip to content

Commit

Permalink
Correct panic when IPv4 lacks IFA_ADDRESS address
Browse files Browse the repository at this point in the history
IFA_ADDRESS is to be used as the peer address if it differs from IFA_LOCAL.
Therefore, include the check for "no IFA_ADDRESS" in the difference check.

Example: ppp interfaces can contain IFA_LOCAL and no IFA_ADDRESS attribute

Signed-off-by: Joe Swantek <joseph.swantek@northwestern.edu>
  • Loading branch information
jswantek committed Jun 28, 2021
1 parent 14e832a commit 5fbbfbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addr_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func parseAddr(m []byte) (addr Addr, family int, err error) {
// But obviously, as there are IPv6 PtP addresses, too,
// IFA_LOCAL should also be handled for IPv6.
if local != nil {
if family == FAMILY_V4 && local.IP.Equal(dst.IP) {
if family == FAMILY_V4 && dst != nil && local.IP.Equal(dst.IP) {
addr.IPNet = dst
} else {
addr.IPNet = local
Expand Down

0 comments on commit 5fbbfbb

Please sign in to comment.