Brn master 20051115.click: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
// |
|||
f |
|||
// 802.11b access point |
|||
// |
|||
// needs INTERFACE (interface for the ap), SSID (name of the network), CHANNEL (operating channel), BEACON_INTERVAL |
|||
// (interval for sending beacons in milliseconds) |
|||
// input[0] from device with decap and so on, only management frames ???? filtering necessary (only packets for me?) |
|||
// output[0] to device without encap, settx and so on |
|||
elementclass AccessPoint { |
|||
DSR $DSR, INTERFACE $device, SSID $ssid, CHANNEL $channel, BEACON_INTERVAL $beacon_interval | |
|||
AddressInfo(ether_address $device:eth); |
|||
winfo :: WirelessInfo(SSID $ssid, BSSID ether_address, CHANNEL $channel, INTERVAL $beacon_interval); |
|||
rates :: AvailableRates(DEFAULT 2 4 11 12 18 22); |
|||
input[0] |
|||
-> mgt_cl :: Classifier(0/00%f0, //assoc req |
|||
0/10%f0, //assoc resp |
|||
0/40%f0, //probe req |
|||
0/50%f0, //probe resp |
|||
0/80%f0, //beacon |
|||
0/a0%f0, //disassoc |
|||
0/b0%f0, //disassoc |
|||
); |
|||
mgt_cl[0] |
|||
//-> PrintWifi("assoc_req") |
|||
//-> AssociationResponder(WIRELESS_INFO winfo, RT rates) |
|||
-> BRNAssocResponder(DEBUG false, WIRELESS_INFO winfo, RT rates, AssocList client_lst) |
|||
//-> PrintWifi("assoc_reply") |
|||
-> [0]output; |
|||
mgt_cl[1] |
|||
//-> PrintWifi("assoc_resp") |
|||
-> Discard; |
|||
mgt_cl[2] |
|||
-> BeaconSource(WIRELESS_INFO winfo, RT rates) |
|||
-> [0]output; |
|||
mgt_cl[3] |
|||
//-> PrintWifi("probe_resp") |
|||
-> Discard; |
|||
mgt_cl[4] |
|||
-> BeaconScanner(RT rates) |
|||
-> Discard; |
|||
mgt_cl[5] |
|||
//-> PrintWifi("disassoc") |
|||
-> Discard; |
|||
mgt_cl[6] |
|||
//-> PrintWifi("auth") |
|||
-> OpenAuthResponder(WIRELESS_INFO winfo) |
|||
//-> PrintWifi("auth_reply") |
|||
-> [0]output; |
|||
} |
|||
// |
|||
// BRN Dynamic Source Routing |
|||
// |
|||
// input[0] - ethernet (802.3) frames from external nodes (no BRN protocol) |
|||
// input[1] - BRN DSR packets from internal nodes |
|||
// input[2] - failed transmission of a BRN DSR packet (broken link) from ds |
|||
// [0]output - ethernet (802.3) frames to external nodes/clients or me (no BRN protocol) |
|||
// [1]output - BRN DSR packets to internal nodes (BRN DSR protocol) |
|||
elementclass DSR {$DEVICE_1, $DEVICE_2, $DEVICE_3 | |
|||
// |
|||
// definitions |
|||
// |
|||
rc :: BrnRouteCache(ACTIVE false, |
|||
DROP /* 1/20 = 5% */ 0, SLICE /* 100ms */ 0, TTL /* 4*100ms */4); |
|||
lt :: BrnLinkTable(rc); |
|||
id :: NodeIdentity($DEVICE_1, $DEVICE_2, $DEVICE_3, lt); |
|||
brn_encap :: BRNEncap; |
|||
dsr_decap :: DSRDecap(id, lt); |
|||
dsr_encap :: DSREncap(id, lt); |
|||
nb :: DstClassifier(id, client_lst); |
|||
querier :: RouteQuerier(lt, dsr_encap, brn_encap, dsr_decap); |
|||
req_forwarder :: RequestForwarder(id, lt, dsr_decap, dsr_encap, brn_encap, querier, client_lst); |
|||
rep_forwarder :: ReplyForwarder(id, dsr_decap, querier, client_lst, dsr_encap, lt); |
|||
src_forwarder :: SrcForwarder(id, client_lst, dsr_encap, dsr_decap, lt); |
|||
err_forwarder :: ErrorForwarder(id, lt, client_lst, dsr_encap, dsr_decap, querier, brn_encap); |
|||
// ------------------ |
|||
// external packets |
|||
// ------------------ |
|||
input[0] |
|||
//-> Print(XXXXX) |
|||
-> clf_bcast :: Classifier(0/ffffffffffff, -); // broadcast & unicast packets |
|||
clf_bcast[0] |
|||
-> Discard; |
|||
clf_bcast[1] |
|||
//-> Print(from_ext_node) |
|||
-> nb; |
|||
nb[0] // packet is for me |
|||
-> [0]output; |
|||
nb[1] // packet for associated client (external) |
|||
-> [0]output; |
|||
nb[2] // packet for internal nodes |
|||
//-> Print(dest_far_away) |
|||
-> querier; |
|||
querier[0]-> [1]output; // rreq packets (broadcast) |
|||
querier[1]-> [0]src_forwarder; // src routed packets (unicast) |
|||
src_forwarder[0] |
|||
//-> Print(forward_packet) |
|||
-> [1]output; |
|||
src_forwarder[1] |
|||
//-> Print(for_me_or_assoc_client) |
|||
-> [0]output; |
|||
// ------------------ |
|||
// internal packets |
|||
// ------------------ |
|||
input[1] |
|||
//-> $NB_LST // collect information about neighbors |
|||
//-> NeighborList($NB_LST) |
|||
-> dsrclf :: Classifier(6/01, //DSR_RREQ |
|||
6/02, //DSR_RREP |
|||
6/03, //DSR_RERR |
|||
6/04, //DSR_SRC |
|||
); |
|||
dsrclf[0] |
|||
//-> Print(rreq) |
|||
-> req_forwarder[0] |
|||
-> [1]output; |
|||
req_forwarder[1] |
|||
//-> BRNPrint(to_replier) |
|||
-> [0]rep_forwarder |
|||
-> [1]output; |
|||
dsrclf[1] |
|||
//-> Print(reply) |
|||
-> [1]rep_forwarder; |
|||
dsrclf[2] |
|||
//-> Print(error) |
|||
-> [1]err_forwarder |
|||
-> [1]output; |
|||
dsrclf[3] |
|||
//-> Print(dsr_src) |
|||
-> [1]src_forwarder; |
|||
// ------------------ |
|||
// undeliverable packets |
|||
// ------------------ |
|||
input[2] |
|||
-> [0]err_forwarder; |
|||
} |
|||
// |
|||
// BRN DHCP |
|||
// |
|||
// input - broadcast packets (no arp, no brn) |
|||
// output - dhcp packets (to wireless queue) |
|||
elementclass DHCP { |
|||
server :: DHCPServerLeases(10.9.0.1 , 10.9.0.0); |
|||
input // check for dhcp |
|||
//-> Print(Check_for_dhcp) |
|||
-> EtherDecap() |
|||
-> Align(4, 0) |
|||
-> ip_check :: CheckIPHeader(CHECKSUM true) |
|||
-> udp_check::CheckUDPHeader |
|||
-> ipclass :: IPClassifier(icmp type echo-reply, -); |
|||
ipclass[0] |
|||
//-> Print("ICMP ECHO REPLY") |
|||
-> [1]serverOffer :: DHCPServerOffer(server); |
|||
ipclass[1] |
|||
-> CheckDHCPMsg(request) |
|||
-> class :: DHCPClassifier( discover, request, release, -); |
|||
class[0] |
|||
//-> Print(DISCOVER) |
|||
-> [0]serverOffer; |
|||
class[1] |
|||
//-> Print(REQUEST) |
|||
-> DHCPServerACKorNAK(server) |
|||
-> UDPIPEncap( 10.9.0.1, 67, 255.255.255.255, 68 ) |
|||
-> EtherEncap( 0x0800, my_wlan, ff:ff:ff:ff:ff:ff) |
|||
-> output; |
|||
class[2] |
|||
//-> Print(RELEASE) |
|||
-> DHCPServerRelease(server); |
|||
class[3] |
|||
//-> Print(OTHER_drop) |
|||
-> Discard; |
|||
serverOffer[0] |
|||
-> UDPIPEncap( 10.9.0.1, 67, 255.255.255.255, 68 ) |
|||
-> EtherEncap( 0x0800, my_wlan, ff:ff:ff:ff:ff:ff) |
|||
-> output; |
|||
serverOffer[1] |
|||
-> icmpEncap::ICMPPingEncap(10.9.0.1, 255.255.255.255) |
|||
-> DHCP_ICMP_Encap(serverOffer.dhcp_icmp_ping_src, serverOffer.dhcp_icmp_ping_dst) |
|||
-> output; |
|||
class[4] -> Discard(); |
|||
class[5] -> Discard(); |
|||
class[6] -> Discard(); |
|||
class[7] -> Discard(); |
|||
class[8] -> Discard(); |
|||
} |
|||
out_q_0 :: Null(); //wifi_out_queue does the job |
|||
// ---------------------------------------------------------------------------- |
|||
// Integration of DSR |
|||
// ---------------------------------------------------------------------------- |
|||
AddressInfo(my_wlan ath0:eth); |
|||
AddressInfo(my_vlan eth0:eth); |
|||
//me :: NodeIdentity(my_wlan, my_vlan); |
|||
nb_lst :: NeighborList(); // collect information about neighbors |
|||
dsr :: DSR(ath0, eth0, eth0); // using DSR |
|||
ds :: BRNDS(dsr/id, nb_lst); |
|||
client_lst :: AssocList(); |
|||
client_ds :: ClientDS(ath0, eth0, vlan2, vlan0, client_lst); |
|||
// ---------------------------------------------------------------------------- |
|||
// AP-Functionality |
|||
// ---------------------------------------------------------------------------- |
|||
// TODO: BEACON_INTERVAL 100 |
|||
ap :: AccessPoint(DSR dsr, INTERFACE ath0, SSID ##brn2##, CHANNEL 1, BEACON_INTERVAL 100); |
|||
// ---------------------------------------------------------------------------- |
|||
// Link Metric |
|||
// ---------------------------------------------------------------------------- |
|||
//ett_metric :: BRNETTMetric(LT dsr/lt); |
|||
etx_metric :: BRNETXMetric(LT dsr/lt); |
|||
link_stat :: BRNLinkStat(ETHTYPE 0x0a04, |
|||
NODEIDENTITY dsr/id, |
|||
PERIOD 300 /* .3 sec */, |
|||
TAU 30000, |
|||
##PROBES##, |
|||
//ETT ett_metric, |
|||
ETX etx_metric, |
|||
RT ap/rates, |
|||
LOGGING true); |
|||
// ---------------------------------------------------------------------------- |
|||
// ARP-Table required for gateway functionality |
|||
// ---------------------------------------------------------------------------- |
|||
arp :: ARPTable(); |
|||
// ---------------------------------------------------------------------------- |
|||
// Handling ath0-device |
|||
// ---------------------------------------------------------------------------- |
|||
FromDevice(ath0) //, PROMISC true |
|||
-> Prism2Decap() |
|||
-> ExtraDecap() |
|||
-> FilterPhyErr() |
|||
-> filter :: FilterTX(); |
|||
filter[0] |
|||
-> WifiDupeFilter() |
|||
-> mgm_clf :: Classifier(0/00%0f, -); // management frames |
|||
mgm_clf[0] //handle mgmt frames |
|||
-> ap |
|||
-> SetTXRate(22) // ap beacons send at constant bitrate |
|||
-> wlan_out_queue :: NotifierQueue(50); |
|||
mgm_clf[1] //handle other frames (data) |
|||
-> WifiDecap() |
|||
//-> rxstats :: RXStats() |
|||
-> clf_bcast :: Classifier(0/ffffffffffff, -); // broadcast & unicast packets |
|||
clf_bcast[0] |
|||
// -> ToDump(from.dat, ENCAP ETHER) |
|||
-> arp_clf :: Classifier (12/0806, 12/8086, -); |
|||
// ---------------------------------------------------------------------------- |
|||
// Handling DHCP queries |
|||
// ---------------------------------------------------------------------------- |
|||
//TODO |
|||
dhcp :: DHCP(); |
|||
arp_clf[2] // check for dhcp |
|||
//-> Discard; |
|||
//Idle() |
|||
-> dhcp |
|||
-> WifiEncap(0x02, WIRELESS_INFO ap/winfo) //to station |
|||
-> SetTXRate(22) // currently bitrate with clients no adopted |
|||
-> wlan_out_queue; |
|||
clf_bcast[1] |
|||
-> protoclf :: Classifier(12/8086, //brn-protocoll |
|||
-); |
|||
arp_clf[0] -> Discard; |
|||
arp_clf[1] // brn broadcasts |
|||
-> protoclf; |
|||
protoclf[1] //simple packets (no brn) |
|||
//-> PrintWifi(from_dev) |
|||
-> Classifier(12/0800) // ip packet |
|||
-> host_cl :: IPClassifier(dst net 10.9.1.1 mask 255.255.255.0, |
|||
-); |
|||
host_cl[0] // for other brn clients or internal nodes |
|||
-> [0]dsr; |
|||
//AddressInfo(gw 00:0F:B5:3F:21:60); |
|||
//AddressInfo(gw 00:0F:B5:3F:1B:BF); |
|||
//AddressInfo(gw 00:0F:B5:3F:1E:EA); |
|||
//AddressInfo(gw 00:0F:B5:3F:20:D6); |
|||
host_cl[1] // packet for the outside world |
|||
//-> Print(set_brn_gw) |
|||
//-> BRNGateway(gw) // prefered gw |
|||
-> [0]dsr; |
|||
protoclf[0] //brn packets |
|||
//-> Print(brn, 128) |
|||
-> EtherDecap() |
|||
-> nb_lst //know your neighbor |
|||
-> brnclf :: Classifier(0/01, //BrnSDP |
|||
0/02, //BrnTFTP |
|||
0/03, //BrnDSR |
|||
0/04, //BrnBcast |
|||
0/06, //LinkProbe |
|||
- //other |
|||
); |
|||
brnclf[0] // sdp |
|||
-> Discard; |
|||
brnclf[1] // tftp |
|||
-> Discard; |
|||
brnclf[2] //dsr |
|||
-> [1]dsr; |
|||
brnclf[3] //bcast |
|||
-> Discard; |
|||
brnclf[4] //linkprobe |
|||
//-> Print(linkprobe) |
|||
-> link_stat |
|||
-> SetTimestamp() |
|||
-> EtherEncap(0x8086, my_wlan, ff:ff:ff:ff:ff:ff) |
|||
//-> Print(link_probe_to_dev) |
|||
-> WifiEncap(0x00, 0:0:0:0:0:0) // packet to brn peer node |
|||
-> wlan_out_queue; |
|||
brnclf[5] //other |
|||
-> Discard; |
|||
//Idle() |
|||
//-> [1]udt |
|||
dsr[0] //for an assoc client |
|||
//-> Print(from_dsr0) |
|||
-> dst_clf :: DstClassifier(dsr/id, client_lst); |
|||
//udt[0] |
|||
// -> Print(UDT_0) |
|||
// -> dst_clf; |
|||
dst_clf[1] // for assoc client |
|||
//-> Print(packet_assoc_client_raw) |
|||
-> client_ds; |
|||
client_ds[0] |
|||
//-> Print(wireless_client) |
|||
-> WifiEncap(0x02, WIRELESS_INFO ap/winfo) //to station |
|||
-> SetTXRate(22) // no bitrate selection to client nodes! |
|||
-> wlan_out_queue; |
|||
client_ds[1] |
|||
-> dev_eth0_q :: Queue |
|||
-> dev_eth0 :: ToDevice(eth0); //eth0 |
|||
client_ds[2] |
|||
-> Discard; //vlan2 |
|||
client_ds[3] |
|||
-> Discard; //vlan0 (debug) |
|||
dst_clf[0] |
|||
//-> Print(packet_for_me) |
|||
-> Classifier(12/0800) // ip packet |
|||
-> CheckIPHeader(14) |
|||
//-> IPPrint(xxx) |
|||
-> tohost_cl :: IPClassifier(dst net 10.9.1.1 mask 255.255.255.0, |
|||
-); |
|||
dst_clf[2] |
|||
//-> Print(Unknown) |
|||
-> Discard; |
|||
tohost_cl[0] |
|||
//-> Print(to_ping) |
|||
-> EtherDecap() |
|||
-> CheckIPHeader |
|||
-> ICMPPingResponder |
|||
-> BRNEtherEncap |
|||
//-> Print(ping_resp) |
|||
-> [0]dsr; // back on route |
|||
tohost_cl[1] // for the tun device |
|||
//-> Print(ToHost) |
|||
// -> IPPrint(ToHost) |
|||
// -> ToHost(ath0); |
|||
-> SetEtherAnno() |
|||
-> MarkIPHeader(14) |
|||
-> rewriter2 :: EtherIpAddrRewriter(ACTIVE false) |
|||
//-> IPPrint(before) -> Print(before) |
|||
-> dev_eth0_q; |
|||
// -> Print(to_tun) |
|||
// -> Strip(14) |
|||
// -> MarkIPHeader(0) |
|||
//-> StoreIPEthernet(arp) // store ip mac combination |
|||
//-> EtherDecap() |
|||
// -> CheckIPHeader(0) |
|||
// -> IPPrint(to_fake) |
|||
// replace the real destination address with the fake address |
|||
// -> StoreIPAddress(192.168.3.22, 12) //src |
|||
// -> SetPacketType(HOST) |
|||
// -> SetIPChecksum |
|||
// -> IPPrint(to_fake2) |
|||
// -> EtherEncap(0x0800, my_vlan, my_vlan) |
|||
// -> Print(to_fake2) |
|||
// -> ToHost(eth0); |
|||
dsr[1] //for an other internal node; make use of ds |
|||
//-> Print(from_dsr1) |
|||
-> ds; |
|||
ds[0] -> out_q_0; |
|||
ds[1] -> Discard; |
|||
ds[2] -> Discard; |
|||
out_q_0 |
|||
-> WifiEncap(0x00, 0:0:0:0:0:0) // sollte das WDS Packet erzeugen mit Hilfe eines Parameters |
|||
-> SetTXRate(22) |
|||
-> wlan_out_queue |
|||
//-> SetTXRate(22) |
|||
-> SetTXPower(63) |
|||
//-> PrintWifi(to_wlan) |
|||
//-> ToDump(todev_node5, ENCAP 802_11) |
|||
-> ExtraEncap() |
|||
-> ToDevice(ath0); |
|||
filter[1] //take a closer look at tx-annotated packets |
|||
-> failures :: FilterFailures(); |
|||
failures[0] |
|||
-> Discard; |
|||
failures[1] |
|||
-> WifiDupeFilter() |
|||
-> mgm_clf2 :: Classifier(0/00%0f, -); // management frames |
|||
mgm_clf2[0] //handle mgmt frames |
|||
-> Discard; |
|||
mgm_clf2[1] //other frames |
|||
//-> PrintWifi(failure) |
|||
-> WifiDecap() |
|||
-> Classifier(12/8086) //handle only brn protocol |
|||
//-> Print(failure) |
|||
-> EtherDecap() |
|||
-> [2]dsr; |
|||
// ------------------------------------------------ |
|||
// Test Area |
|||
// ------------------------------------------------ |
|||
AddressInfo(peer_client 00:11:11:3E:B8:79); |
|||
chan_setter :: SetChannel(ath0); |
|||
ch :: CompoundHandler( debug, "ds dsr/id dsr/lt dsr/dsr_encap |
|||
dsr/brn_encap dsr/dsr_decap client_lst nb_lst dsr/querier |
|||
dsr/req_forwarder dsr/rep_forwarder dsr/src_forwarder dsr/err_forwarder", false ); |
|||
poki :: PokeHandlers(//write client_lst.insert 00:0e:35:a2:e4:31 ath0, //associate client with node1 |
|||
// write madwifi_rate.debug true, |
|||
// write dhcp/server.dhcpd_conf |
|||
// subnet 10.9.1.0 netmask 255.255.255.0{ |
|||
// option routers 10.9.1.1 |
|||
// option subnet-mask 255.255.255.0 |
|||
// option domain-name brn |
|||
// option domain-name-servers 141.20.20.50 |
|||
// range dynamic-bootp 10.9.1.2 10.9.1.30 |
|||
// default-lease-time 3000 |
|||
// max-lease-time 6000 |
|||
// }, |
|||
wait 1, |
|||
// read dhcp/server.read_free_leases, |
|||
// write dsr/querier.fixed_route |
|||
// 00:0f:b5:3f:21:60 |
|||
// 00:0f:b5:3f:20:d6 |
|||
// 00:0f:b5:3f:1e:ea |
|||
// 00:0f:b5:0b:95:29 |
|||
// 00:0f:b5:3f:1b:bf |
|||
// 00:0e:35:a2:e4:31 |
|||
); |
Latest revision as of 09:26, 25 January 2006
// // 802.11b access point // // needs INTERFACE (interface for the ap), SSID (name of the network), CHANNEL (operating channel), BEACON_INTERVAL // (interval for sending beacons in milliseconds) // input[0] from device with decap and so on, only management frames ???? filtering necessary (only packets for me?) // output[0] to device without encap, settx and so on elementclass AccessPoint { DSR $DSR, INTERFACE $device, SSID $ssid, CHANNEL $channel, BEACON_INTERVAL $beacon_interval | AddressInfo(ether_address $device:eth); winfo :: WirelessInfo(SSID $ssid, BSSID ether_address, CHANNEL $channel, INTERVAL $beacon_interval); rates :: AvailableRates(DEFAULT 2 4 11 12 18 22); input[0] -> mgt_cl :: Classifier(0/00%f0, //assoc req 0/10%f0, //assoc resp 0/40%f0, //probe req 0/50%f0, //probe resp 0/80%f0, //beacon 0/a0%f0, //disassoc 0/b0%f0, //disassoc ); mgt_cl[0] //-> PrintWifi("assoc_req") //-> AssociationResponder(WIRELESS_INFO winfo, RT rates) -> BRNAssocResponder(DEBUG false, WIRELESS_INFO winfo, RT rates, AssocList client_lst) //-> PrintWifi("assoc_reply") -> [0]output; mgt_cl[1] //-> PrintWifi("assoc_resp") -> Discard; mgt_cl[2] -> BeaconSource(WIRELESS_INFO winfo, RT rates) -> [0]output; mgt_cl[3] //-> PrintWifi("probe_resp") -> Discard; mgt_cl[4] -> BeaconScanner(RT rates) -> Discard; mgt_cl[5] //-> PrintWifi("disassoc") -> Discard; mgt_cl[6] //-> PrintWifi("auth") -> OpenAuthResponder(WIRELESS_INFO winfo) //-> PrintWifi("auth_reply") -> [0]output; } // // BRN Dynamic Source Routing // // input[0] - ethernet (802.3) frames from external nodes (no BRN protocol) // input[1] - BRN DSR packets from internal nodes // input[2] - failed transmission of a BRN DSR packet (broken link) from ds // [0]output - ethernet (802.3) frames to external nodes/clients or me (no BRN protocol) // [1]output - BRN DSR packets to internal nodes (BRN DSR protocol) elementclass DSR {$DEVICE_1, $DEVICE_2, $DEVICE_3 | // // definitions // rc :: BrnRouteCache(ACTIVE false, DROP /* 1/20 = 5% */ 0, SLICE /* 100ms */ 0, TTL /* 4*100ms */4); lt :: BrnLinkTable(rc); id :: NodeIdentity($DEVICE_1, $DEVICE_2, $DEVICE_3, lt); brn_encap :: BRNEncap; dsr_decap :: DSRDecap(id, lt); dsr_encap :: DSREncap(id, lt); nb :: DstClassifier(id, client_lst); querier :: RouteQuerier(lt, dsr_encap, brn_encap, dsr_decap); req_forwarder :: RequestForwarder(id, lt, dsr_decap, dsr_encap, brn_encap, querier, client_lst); rep_forwarder :: ReplyForwarder(id, dsr_decap, querier, client_lst, dsr_encap, lt); src_forwarder :: SrcForwarder(id, client_lst, dsr_encap, dsr_decap, lt); err_forwarder :: ErrorForwarder(id, lt, client_lst, dsr_encap, dsr_decap, querier, brn_encap); // ------------------ // external packets // ------------------ input[0] //-> Print(XXXXX) -> clf_bcast :: Classifier(0/ffffffffffff, -); // broadcast & unicast packets clf_bcast[0] -> Discard; clf_bcast[1] //-> Print(from_ext_node) -> nb; nb[0] // packet is for me -> [0]output; nb[1] // packet for associated client (external) -> [0]output; nb[2] // packet for internal nodes //-> Print(dest_far_away) -> querier; querier[0]-> [1]output; // rreq packets (broadcast) querier[1]-> [0]src_forwarder; // src routed packets (unicast) src_forwarder[0] //-> Print(forward_packet) -> [1]output; src_forwarder[1] //-> Print(for_me_or_assoc_client) -> [0]output; // ------------------ // internal packets // ------------------ input[1] //-> $NB_LST // collect information about neighbors //-> NeighborList($NB_LST) -> dsrclf :: Classifier(6/01, //DSR_RREQ 6/02, //DSR_RREP 6/03, //DSR_RERR 6/04, //DSR_SRC ); dsrclf[0] //-> Print(rreq) -> req_forwarder[0] -> [1]output; req_forwarder[1] //-> BRNPrint(to_replier) -> [0]rep_forwarder -> [1]output; dsrclf[1] //-> Print(reply) -> [1]rep_forwarder; dsrclf[2] //-> Print(error) -> [1]err_forwarder -> [1]output; dsrclf[3] //-> Print(dsr_src) -> [1]src_forwarder; // ------------------ // undeliverable packets // ------------------ input[2] -> [0]err_forwarder; } // // BRN DHCP // // input - broadcast packets (no arp, no brn) // output - dhcp packets (to wireless queue) elementclass DHCP { server :: DHCPServerLeases(10.9.0.1 , 10.9.0.0); input // check for dhcp //-> Print(Check_for_dhcp) -> EtherDecap() -> Align(4, 0) -> ip_check :: CheckIPHeader(CHECKSUM true) -> udp_check::CheckUDPHeader -> ipclass :: IPClassifier(icmp type echo-reply, -); ipclass[0] //-> Print("ICMP ECHO REPLY") -> [1]serverOffer :: DHCPServerOffer(server); ipclass[1] -> CheckDHCPMsg(request) -> class :: DHCPClassifier( discover, request, release, -); class[0] //-> Print(DISCOVER) -> [0]serverOffer; class[1] //-> Print(REQUEST) -> DHCPServerACKorNAK(server) -> UDPIPEncap( 10.9.0.1, 67, 255.255.255.255, 68 ) -> EtherEncap( 0x0800, my_wlan, ff:ff:ff:ff:ff:ff) -> output; class[2] //-> Print(RELEASE) -> DHCPServerRelease(server); class[3] //-> Print(OTHER_drop) -> Discard; serverOffer[0] -> UDPIPEncap( 10.9.0.1, 67, 255.255.255.255, 68 ) -> EtherEncap( 0x0800, my_wlan, ff:ff:ff:ff:ff:ff) -> output; serverOffer[1] -> icmpEncap::ICMPPingEncap(10.9.0.1, 255.255.255.255) -> DHCP_ICMP_Encap(serverOffer.dhcp_icmp_ping_src, serverOffer.dhcp_icmp_ping_dst) -> output; class[4] -> Discard(); class[5] -> Discard(); class[6] -> Discard(); class[7] -> Discard(); class[8] -> Discard(); } out_q_0 :: Null(); //wifi_out_queue does the job // ---------------------------------------------------------------------------- // Integration of DSR // ---------------------------------------------------------------------------- AddressInfo(my_wlan ath0:eth); AddressInfo(my_vlan eth0:eth); //me :: NodeIdentity(my_wlan, my_vlan); nb_lst :: NeighborList(); // collect information about neighbors dsr :: DSR(ath0, eth0, eth0); // using DSR ds :: BRNDS(dsr/id, nb_lst); client_lst :: AssocList(); client_ds :: ClientDS(ath0, eth0, vlan2, vlan0, client_lst); // ---------------------------------------------------------------------------- // AP-Functionality // ---------------------------------------------------------------------------- // TODO: BEACON_INTERVAL 100 ap :: AccessPoint(DSR dsr, INTERFACE ath0, SSID ##brn2##, CHANNEL 1, BEACON_INTERVAL 100); // ---------------------------------------------------------------------------- // Link Metric // ---------------------------------------------------------------------------- //ett_metric :: BRNETTMetric(LT dsr/lt); etx_metric :: BRNETXMetric(LT dsr/lt); link_stat :: BRNLinkStat(ETHTYPE 0x0a04, NODEIDENTITY dsr/id, PERIOD 300 /* .3 sec */, TAU 30000, ##PROBES##, //ETT ett_metric, ETX etx_metric, RT ap/rates, LOGGING true); // ---------------------------------------------------------------------------- // ARP-Table required for gateway functionality // ---------------------------------------------------------------------------- arp :: ARPTable(); // ---------------------------------------------------------------------------- // Handling ath0-device // ---------------------------------------------------------------------------- FromDevice(ath0) //, PROMISC true -> Prism2Decap() -> ExtraDecap() -> FilterPhyErr() -> filter :: FilterTX(); filter[0] -> WifiDupeFilter() -> mgm_clf :: Classifier(0/00%0f, -); // management frames mgm_clf[0] //handle mgmt frames -> ap -> SetTXRate(22) // ap beacons send at constant bitrate -> wlan_out_queue :: NotifierQueue(50); mgm_clf[1] //handle other frames (data) -> WifiDecap() //-> rxstats :: RXStats() -> clf_bcast :: Classifier(0/ffffffffffff, -); // broadcast & unicast packets clf_bcast[0] // -> ToDump(from.dat, ENCAP ETHER) -> arp_clf :: Classifier (12/0806, 12/8086, -); // ---------------------------------------------------------------------------- // Handling DHCP queries // ---------------------------------------------------------------------------- //TODO dhcp :: DHCP(); arp_clf[2] // check for dhcp //-> Discard; //Idle() -> dhcp -> WifiEncap(0x02, WIRELESS_INFO ap/winfo) //to station -> SetTXRate(22) // currently bitrate with clients no adopted -> wlan_out_queue; clf_bcast[1] -> protoclf :: Classifier(12/8086, //brn-protocoll -); arp_clf[0] -> Discard; arp_clf[1] // brn broadcasts -> protoclf; protoclf[1] //simple packets (no brn) //-> PrintWifi(from_dev) -> Classifier(12/0800) // ip packet -> host_cl :: IPClassifier(dst net 10.9.1.1 mask 255.255.255.0, -); host_cl[0] // for other brn clients or internal nodes -> [0]dsr; //AddressInfo(gw 00:0F:B5:3F:21:60); //AddressInfo(gw 00:0F:B5:3F:1B:BF); //AddressInfo(gw 00:0F:B5:3F:1E:EA); //AddressInfo(gw 00:0F:B5:3F:20:D6); host_cl[1] // packet for the outside world //-> Print(set_brn_gw) //-> BRNGateway(gw) // prefered gw -> [0]dsr; protoclf[0] //brn packets //-> Print(brn, 128) -> EtherDecap() -> nb_lst //know your neighbor -> brnclf :: Classifier(0/01, //BrnSDP 0/02, //BrnTFTP 0/03, //BrnDSR 0/04, //BrnBcast 0/06, //LinkProbe - //other ); brnclf[0] // sdp -> Discard; brnclf[1] // tftp -> Discard; brnclf[2] //dsr -> [1]dsr; brnclf[3] //bcast -> Discard; brnclf[4] //linkprobe //-> Print(linkprobe) -> link_stat -> SetTimestamp() -> EtherEncap(0x8086, my_wlan, ff:ff:ff:ff:ff:ff) //-> Print(link_probe_to_dev) -> WifiEncap(0x00, 0:0:0:0:0:0) // packet to brn peer node -> wlan_out_queue; brnclf[5] //other -> Discard; //Idle() //-> [1]udt dsr[0] //for an assoc client //-> Print(from_dsr0) -> dst_clf :: DstClassifier(dsr/id, client_lst); //udt[0] // -> Print(UDT_0) // -> dst_clf; dst_clf[1] // for assoc client //-> Print(packet_assoc_client_raw) -> client_ds; client_ds[0] //-> Print(wireless_client) -> WifiEncap(0x02, WIRELESS_INFO ap/winfo) //to station -> SetTXRate(22) // no bitrate selection to client nodes! -> wlan_out_queue; client_ds[1] -> dev_eth0_q :: Queue -> dev_eth0 :: ToDevice(eth0); //eth0 client_ds[2] -> Discard; //vlan2 client_ds[3] -> Discard; //vlan0 (debug) dst_clf[0] //-> Print(packet_for_me) -> Classifier(12/0800) // ip packet -> CheckIPHeader(14) //-> IPPrint(xxx) -> tohost_cl :: IPClassifier(dst net 10.9.1.1 mask 255.255.255.0, -); dst_clf[2] //-> Print(Unknown) -> Discard; tohost_cl[0] //-> Print(to_ping) -> EtherDecap() -> CheckIPHeader -> ICMPPingResponder -> BRNEtherEncap //-> Print(ping_resp) -> [0]dsr; // back on route tohost_cl[1] // for the tun device //-> Print(ToHost) // -> IPPrint(ToHost) // -> ToHost(ath0); -> SetEtherAnno() -> MarkIPHeader(14) -> rewriter2 :: EtherIpAddrRewriter(ACTIVE false) //-> IPPrint(before) -> Print(before) -> dev_eth0_q; // -> Print(to_tun) // -> Strip(14) // -> MarkIPHeader(0) //-> StoreIPEthernet(arp) // store ip mac combination //-> EtherDecap() // -> CheckIPHeader(0) // -> IPPrint(to_fake) // replace the real destination address with the fake address // -> StoreIPAddress(192.168.3.22, 12) //src // -> SetPacketType(HOST) // -> SetIPChecksum // -> IPPrint(to_fake2) // -> EtherEncap(0x0800, my_vlan, my_vlan) // -> Print(to_fake2) // -> ToHost(eth0); dsr[1] //for an other internal node; make use of ds //-> Print(from_dsr1) -> ds; ds[0] -> out_q_0; ds[1] -> Discard; ds[2] -> Discard; out_q_0 -> WifiEncap(0x00, 0:0:0:0:0:0) // sollte das WDS Packet erzeugen mit Hilfe eines Parameters -> SetTXRate(22) -> wlan_out_queue //-> SetTXRate(22) -> SetTXPower(63) //-> PrintWifi(to_wlan) //-> ToDump(todev_node5, ENCAP 802_11) -> ExtraEncap() -> ToDevice(ath0); filter[1] //take a closer look at tx-annotated packets -> failures :: FilterFailures(); failures[0] -> Discard; failures[1] -> WifiDupeFilter() -> mgm_clf2 :: Classifier(0/00%0f, -); // management frames mgm_clf2[0] //handle mgmt frames -> Discard; mgm_clf2[1] //other frames //-> PrintWifi(failure) -> WifiDecap() -> Classifier(12/8086) //handle only brn protocol //-> Print(failure) -> EtherDecap() -> [2]dsr; // ------------------------------------------------ // Test Area // ------------------------------------------------ AddressInfo(peer_client 00:11:11:3E:B8:79); chan_setter :: SetChannel(ath0); ch :: CompoundHandler( debug, "ds dsr/id dsr/lt dsr/dsr_encap dsr/brn_encap dsr/dsr_decap client_lst nb_lst dsr/querier dsr/req_forwarder dsr/rep_forwarder dsr/src_forwarder dsr/err_forwarder", false ); poki :: PokeHandlers(//write client_lst.insert 00:0e:35:a2:e4:31 ath0, //associate client with node1 // write madwifi_rate.debug true, // write dhcp/server.dhcpd_conf // subnet 10.9.1.0 netmask 255.255.255.0{ // option routers 10.9.1.1 // option subnet-mask 255.255.255.0 // option domain-name brn // option domain-name-servers 141.20.20.50 // range dynamic-bootp 10.9.1.2 10.9.1.30 // default-lease-time 3000 // max-lease-time 6000 // }, wait 1, // read dhcp/server.read_free_leases, // write dsr/querier.fixed_route // 00:0f:b5:3f:21:60 // 00:0f:b5:3f:20:d6 // 00:0f:b5:3f:1e:ea // 00:0f:b5:0b:95:29 // 00:0f:b5:3f:1b:bf // 00:0e:35:a2:e4:31 );