Don't set the ifindex when sending a normal reply.

Setting the ifindex in the IP_PKTINFO results in setting
the source address too (ignoring the source address that
we also supply).  The sequence here is that we send with
no interface specified but the request's destination
specified as our source.  If we get EINVAL, it's because
the request's destination was a broadcast address which
is an invalid source address, so we try again with the
incoming interface's if_index and specify the source
as INADDR_ANY.

If we supply the ifindex in the first call, a reply from
a multi-homed agent may come from a different source address
than the request was sent to, potentially confusing a manager.
This bug was first introduced in SVN r17855 and was fixed
in SVN r19767; also see the mailing list thread
http://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTim37H7M7Ba010Lmdk1YGYKwPTkDyRKoDr76uqDT%40mail.gmail.com&forum_name=net-snmp-coders
1 file changed