Commit e28bc6eb authored by Ghislain MARY's avatar Ghislain MARY

Fix setsockopt() to ask for IPv6 received packet info.

parent 4a83d12b
...@@ -454,25 +454,35 @@ int rtp_session_set_pktinfo(RtpSession *session, int activate) ...@@ -454,25 +454,35 @@ int rtp_session_set_pktinfo(RtpSession *session, int activate)
optname = IP_RECVDSTADDR; optname = IP_RECVDSTADDR;
#endif #endif
retval = setsockopt(session->rtp.gs.socket, IPPROTO_IP, optname, optval, optlen); retval = setsockopt(session->rtp.gs.socket, IPPROTO_IP, optname, optval, optlen);
if (retval < 0) break; if (retval < 0) {
ortp_warning ("Fail to set packet info on RTP socket: %s.", getSocketError());
}
retval = setsockopt(session->rtcp.gs.socket, IPPROTO_IP, optname, optval, optlen); retval = setsockopt(session->rtcp.gs.socket, IPPROTO_IP, optname, optval, optlen);
if (retval < 0) {
ortp_warning ("Fail to set packet info on RTCP socket: %s.", getSocketError());
}
break; break;
case AF_INET6: case AF_INET6:
#ifdef IPV6_PKTINFO #ifdef IPV6_RECVPKTINFO
optname = IPV6_PKTINFO; optname = IPV6_RECVPKTINFO;
#else #else
optname = IPV6_RECVDSTADDR; optname = IPV6_RECVDSTADDR;
#endif #endif
retval = setsockopt(session->rtp.gs.socket, IPPROTO_IPV6, optname, optval, optlen); retval = setsockopt(session->rtp.gs.socket, IPPROTO_IPV6, optname, optval, optlen);
if (retval < 0) break; if (retval < 0) {
ortp_warning ("Fail to set packet info on RTP socket: %s.", getSocketError());
}
retval = setsockopt(session->rtcp.gs.socket, IPPROTO_IPV6, optname, optval, optlen); retval = setsockopt(session->rtcp.gs.socket, IPPROTO_IPV6, optname, optval, optlen);
if (retval < 0) {
ortp_warning ("Fail to set packet info on RTCP socket: %s.", getSocketError());
}
break; break;
default: default:
retval = -1; retval = -1;
ortp_warning("Unknow socket family %d used to set packet info", session->rtp.gs.sockfamily);
break; break;
} }
if (retval < 0) ortp_warning("Failed to set packet info on socket.");
return retval; return retval;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment