Message ID | 1253164811-15820-1-git-send-email-dfeng@redhat.com |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
Xiaotian Feng wrote, at 09/17/2009 01:20 PM: > ip_mreq and ip_mreqn is almost the same, and do_ip_setsockopt for IP_MULTICAST_IF > part supported ip_mreqn struct. This patch adds support for ip_mreq struct. > It's not meaning to support the ip_mreq struct, the imr_multiaddr member never be used by the IP_MULTICAST_IF. In addition, using the option normally like this: struct in_addr interface_addr; setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)); Do your patch suggest using the option like this? struct ip_mreq mreq; setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF, &mreq, sizeof(mreq)); Best Regards ----- Shan Wei -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 09/17/2009 05:16 PM, Shan Wei wrote: > Xiaotian Feng wrote, at 09/17/2009 01:20 PM: >> ip_mreq and ip_mreqn is almost the same, and do_ip_setsockopt for IP_MULTICAST_IF >> part supported ip_mreqn struct. This patch adds support for ip_mreq struct. >> > > It's not meaning to support the ip_mreq struct, the imr_multiaddr member > never be used by the IP_MULTICAST_IF. > > In addition, using the option normally like this: > struct in_addr interface_addr; > setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF,&interface_addr, sizeof(interface_addr)); > > Do your patch suggest using the option like this? > struct ip_mreq mreq; > setsockopt (socket, IPPROTO_IP, IP_MULTICAST_IF,&mreq, sizeof(mreq)); > In fact, current implemetation supports: struct ip_mreqn mreqn; setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn)); Then why not support mreq? > > Best Regards > ----- > Shan Wei > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello! On Thu, Sep 17, 2009 at 05:19:16PM +0800, Danny Feng wrote: > In fact, current implemetation supports: > > struct ip_mreqn mreqn; > setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, &mreqn, sizeof(mreqn)); > > Then why not support mreq? Because support of ip_mreqn makes sense (it user interface index) and support of ip_mreq, which does not contain interface index, does not. "Polymorphic" IP_MULTICAST_IF was a stupid mistake (mine), which should not grow like a tumor. Ack to patch #1, nack to #2. Alexey -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 5a29dce..1e8d026 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -612,11 +612,16 @@ static int do_ip_setsockopt(struct sock *sk, int level, */ err = -EFAULT; + memset(&mreq, 0, sizeof(mreq)); + if (optlen >= sizeof(struct ip_mreqn)) { if (copy_from_user(&mreq, optval, sizeof(mreq))) break; + } else if (optlen >= sizeof(struct ip_mreq)) { + if (copy_from_user(&mreq, optval, + sizeof(struct ip_mreq))) + break; } else if (optlen >= sizeof(struct in_addr)) { - memset(&mreq, 0, sizeof(mreq)); if (copy_from_user(&mreq.imr_address, optval, sizeof(struct in_addr))) break;