On 27/03/16(Sun) 16:20, Stuart Henderson wrote:
> Noticed while looking at the minidlna problem with ART, but this is
> not responsible for the problem.
> 
> /etc/netstart has a "route -qn delete 224.0.0.0/4" before it adds
> the multicast reject route:
> 
> 270 # Multicast routing.
> 271 route -qn delete 224.0.0.0/4 >/dev/null 2>&1
> 272 [[ $multicast != YES ]] &&
> 273         route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject 
> >/dev/null
> 
> So there's no way to hook in to create the route before daemons start.
> You can't set it in hostname.if because the "route delete" will zap it.
> You can add it in /etc/rc.local but that's a bit late, really. Should
> we just get rid of the "delete"?

I think that keeping the delete makes sense if we say that running
/etc/netstart should "restore" your network configuration to what's
defined in /etc.

So I'm ok with your diff.

> Index: netstart
> ===================================================================
> RCS file: /cvs/src/etc/netstart,v
> retrieving revision 1.167
> diff -u -p -r1.167 netstart
> --- netstart  29 Dec 2015 19:37:31 -0000      1.167
> +++ netstart  27 Mar 2016 15:18:06 -0000
> @@ -268,9 +268,10 @@ done
>  done
>  
>  # Multicast routing.
> -route -qn delete 224.0.0.0/4 >/dev/null 2>&1
> -[[ $multicast != YES ]] &&
> +if [[ $multicast != YES ]]; then
> +     route -qn delete 224.0.0.0/4 >/dev/null 2>&1
>       route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject >/dev/null
> +fi
>  
>  # Configure PPPoE, GIF, GRE, TUN and PFLOW interfaces, delayed because they
>  # require routes to be set. TUN might depend on PPPoE, and GIF or GRE may
> 
> 
> Here's the code before simplification - i.e. if you set multicast_host
> to an interface name, it would add the -interface route at this point
> during startup.
> 
> 270 # Multicast routing.
> 271 #
> 272 # The routing to the 224.0.0.0/4 net is setup according to these rules:
> 273 # multicast_host        multicast_router        route           comment
> 274 # NO                    NO                      -reject         no 
> multicast
> 275 # NO                    YES                     none installed  daemon 
> will run
> 276 # YES/interface         NO                      -interface      YES=def. 
> iface
> 277 #          Any other combination                -reject         config 
> error
> 278 route -qn delete 224.0.0.0/4 >/dev/null 2>&1
> 279 case "$multicast_host:$multicast_router" in
> 280 NO:NO)
> 281         route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject 
> >/dev/null
> 282         ;;
> 283 NO:YES)
> 284         ;;
> 285 *:NO)
> 286         maddr=$(if [[ $multicast_host == YES ]]; then
> 287                 ed -s '!route -qn show -inet' <<EOF
> 288 /^default/p
> 289 EOF
> 290         else
> 291                 ed -s "!ifconfig $multicast_host" <<EOF
> 292 /^      inet /p
> 293 EOF
> 294         fi 2>/dev/null)
> 295         if [[ -n $maddr ]]; then
> 296                 set $maddr
> 297                 route -qn add -net 224.0.0.0/4 -interface $2 >/dev/null
> 298         else
> 299                 route -qn add -net 224.0.0.0/4 -interface \
> 300                         127.0.0.1 -reject >/dev/null
> 301         fi
> 302         ;;
> 303 *:*)
> 304         echo 'config error, multicasting disabled until rc.conf is fixed'
> 305         route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject 
> >/dev/null
> 306         ;;
> 307 esac
> 

Reply via email to