Correct panic when IPv4 lacks IFA_ADDRESS address

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
This commit is contained in:
Joe Swantek 2021-06-28 13:50:44 -05:00 committed by Alessandro Boch
parent 14e832ae1e
commit 53455394aa

View File

@ -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