mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	Sending multicasts out of Sockets without setting the broadcast to true - causes the error "Bad value for ai_flags" on some systems (#3404)
The underlying cause looks to be https://github.com/dotnet/runtime/issues/28630. Basically, it's an access denied bug. It looks like multicasts need the same access rights as broadcasts on some systems.
This commit is contained in:
		
							parent
							
								
									c07d8abfd5
								
							
						
					
					
						commit
						f01baad05e
					
				@ -4,7 +4,6 @@ using System;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Net.Sockets;
 | 
			
		||||
using MediaBrowser.Model.Net;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
 | 
			
		||||
namespace Emby.Server.Implementations.Net
 | 
			
		||||
{
 | 
			
		||||
@ -123,6 +122,7 @@ namespace Emby.Server.Implementations.Net
 | 
			
		||||
 | 
			
		||||
                retVal.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse(ipAddress), localIp));
 | 
			
		||||
                retVal.MulticastLoopback = true;
 | 
			
		||||
 | 
			
		||||
                return new UdpSocket(retVal, localPort, localIp);
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,6 @@
 | 
			
		||||
#pragma warning disable CS1591
 | 
			
		||||
 | 
			
		||||
using System.Net;
 | 
			
		||||
using Microsoft.Extensions.Logging;
 | 
			
		||||
 | 
			
		||||
namespace MediaBrowser.Model.Net
 | 
			
		||||
{
 | 
			
		||||
@ -25,6 +24,5 @@ namespace MediaBrowser.Model.Net
 | 
			
		||||
        /// <param name="localPort">The local port to bind to.</param>
 | 
			
		||||
        /// <returns>A <see cref="ISocket"/> implementation.</returns>
 | 
			
		||||
        ISocket CreateUdpMulticastSocket(string ipAddress, int multicastTimeToLive, int localPort);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -339,6 +339,7 @@ namespace Rssdp.Infrastructure
 | 
			
		||||
        private ISocket ListenForBroadcastsAsync()
 | 
			
		||||
        {
 | 
			
		||||
            var socket = _SocketFactory.CreateUdpMulticastSocket(SsdpConstants.MulticastLocalAdminAddress, _MulticastTtl, SsdpConstants.MulticastPort);
 | 
			
		||||
            
 | 
			
		||||
            _ = ListenToSocketInternal(socket);
 | 
			
		||||
 | 
			
		||||
            return socket;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user