[ISSUE-95] Fixed IPv6 handling, reduced OOB buffer size to 40 bytes

This commit is contained in:
Omri Bahumi 2014-07-08 00:19:51 +03:00
parent dea4cb300a
commit 4fb9d5f005
2 changed files with 6 additions and 1 deletions

2
udp.go
View File

@ -27,7 +27,7 @@ func NewUDPConn(conn *net.UDPConn) (newconn *UDPConn, err error) {
}
func (conn *UDPConn) ReadFromSessionUDP(b []byte) (n int, session *UDPSession, err error) {
oob := make([]byte, 1024)
oob := make([]byte, 40)
n, oobn, _, raddr, err := conn.ReadMsgUDP(b, oob)
if err != nil {

View File

@ -14,6 +14,11 @@ func udpSocketOobData(conn *net.UDPConn) (err error) {
}
err = syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IP, syscall.IP_PKTINFO, 1)
if err != nil {
return
}
err = syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_RECVPKTINFO, 1)
return
}