git: 6e0f20556126 - stable/12 - in6_mcast: Return EADDRINUSE when we've already joined the group

Kristof Provost kp at FreeBSD.org
Mon May 17 13:32:52 UTC 2021


The branch stable/12 has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e0f20556126ffb6396c6f3934b93bfff6fb06eb

commit 6e0f20556126ffb6396c6f3934b93bfff6fb06eb
Author:     Kristof Provost <kp at FreeBSD.org>
AuthorDate: 2021-05-04 17:23:15 +0000
Commit:     Kristof Provost <kp at FreeBSD.org>
CommitDate: 2021-05-17 07:51:16 +0000

    in6_mcast: Return EADDRINUSE when we've already joined the group
    
    Distinguish between truly invalid requests and those that fail because
    we've already joined the group. Both cases fail, but differentiating
    them allows userspace to make more informed decisions about what the
    error means.
    
    For example. radvd tries to join the all-routers group on every SIGHUP.
    This fails, because it's already joined it, but this failure should be
    ignored (rather than treated as a sign that the interface's multicast is
    broken).
    
    This puts us in line with OpenBSD, NetBSD and Linux.
    
    Reviewed by:    donner
    MFC after:      1 week
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D30111
    
    (cherry picked from commit 2ef5d803e3847f56771c107d9517ec560cf318c9)
---
 sys/netinet6/in6_mcast.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/netinet6/in6_mcast.c b/sys/netinet6/in6_mcast.c
index 96390335aea8..bd202e76c6b6 100644
--- a/sys/netinet6/in6_mcast.c
+++ b/sys/netinet6/in6_mcast.c
@@ -2027,7 +2027,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sopt)
 			 * state at t1, because allocation of a filter
 			 * is atomic with allocation of a membership.
 			 */
-			error = EINVAL;
+			error = EADDRINUSE;
 			goto out_in6p_locked;
 		}
 	}


More information about the dev-commits-src-all mailing list