fw.ns 978 Bytes
Newer Older
1 2 3 4 5 6
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2006 University of Utah and the Flux Group.
# All rights reserved.
#

7 8 9 10
#
# This file is intended to be included into another NS file. It is not
# a stand alone file.
# 
11 12 13 14
if {${::GLOBALS::explicit_firewall}} {
    # explicit firewalls require disk zappage
    set ::GLOBALS::security_level ${::GLOBALS::security_level_diskzap}
} elseif {${::GLOBALS::security_level} >= 1} {
15
    # Set up a firewall
16 17 18
    # XXX hack: have to clear the security level temporarily
    set sl ${::GLOBALS::security_level}
    set ::GLOBALS::security_level 0
19
    set fw [new Firewall $ns]
20 21
    set ::GLOBALS::security_level $sl

22 23 24
    $fw set-type ipfw2-vlan
        
    if {${::GLOBALS::security_level} == 1} {
25
	$fw set-style basic
26
    } elseif {${::GLOBALS::security_level} == 2} {
27 28
	$fw set-style basic	
    } elseif {${::GLOBALS::security_level} == 3} {
29 30 31
	if {${::GLOBALS::elab_in_elab}} {
	    $fw set-style emulab
	} else {
32
	    $fw set-style closed
33 34 35
	}
    }
}