Browse Source

multicast_host=YES only works if a valid default gateway is available.

validate this condition and reject multicast traffic on failure.
ok todd@ naddy@
OPENBSD_3_9
reyk 18 years ago
parent
commit
287879a1b9
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      src/etc/netstart

+ 11
- 4
src/etc/netstart View File

@ -1,6 +1,6 @@
#!/bin/sh - #!/bin/sh -
# #
# $OpenBSD: netstart,v 1.111 2005/11/02 18:45:26 todd Exp $
# $OpenBSD: netstart,v 1.112 2005/12/06 17:24:18 reyk Exp $
# Strip comments (and leading/trailing whitespace if IFS is set) # Strip comments (and leading/trailing whitespace if IFS is set)
# from a file and spew to stdout # from a file and spew to stdout
@ -330,6 +330,7 @@ done
# NO YES none installed daemon will run # NO YES none installed daemon will run
# YES/interface NO -interface YES=def. iface # YES/interface NO -interface YES=def. iface
# Any other combination -reject config error # Any other combination -reject config error
route -qn delete 224.0.0.0/4 > /dev/null 2>&1
case "$multicast_host:$multicast_router" in case "$multicast_host:$multicast_router" in
NO:NO) NO:NO)
route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject > /dev/null route -qn add -net 224.0.0.0/4 -interface 127.0.0.1 -reject > /dev/null
@ -337,7 +338,7 @@ NO:NO)
NO:YES) NO:YES)
;; ;;
*:NO) *:NO)
set `if [ $multicast_host = YES ]; then
maddr=`if [ "$multicast_host" = "YES" ]; then
ed -s '!route -qn show -inet' <<EOF ed -s '!route -qn show -inet' <<EOF
/^default/p /^default/p
EOF EOF
@ -345,8 +346,14 @@ EOF
ed -s "!ifconfig $multicast_host" <<EOF ed -s "!ifconfig $multicast_host" <<EOF
/^ inet /p /^ inet /p
EOF EOF
fi`
route -qn add -net 224.0.0.0/4 -interface $2 > /dev/null
fi 2> /dev/null`
if [ "X${maddr}" != "X" ]; then
set $maddr
route -qn add -net 224.0.0.0/4 -interface $2 > /dev/null
else
route -qn add -net 224.0.0.0/4 -interface \
127.0.0.1 -reject > /dev/null
fi
;; ;;
*:*) *:*)
echo 'config error, multicasting disabled until rc.conf is fixed' echo 'config error, multicasting disabled until rc.conf is fixed'


Loading…
Cancel
Save