mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
move openflow to use subnets instead of addr for matches.
This commit is contained in:
parent
0e7ebffacf
commit
c42fbdab12
5 changed files with 13 additions and 11 deletions
|
@ -140,9 +140,9 @@ function match_conn(id: conn_id, reverse: bool &default=F): ofp_match
|
||||||
return ofp_match(
|
return ofp_match(
|
||||||
$dl_type=dl_type,
|
$dl_type=dl_type,
|
||||||
$nw_proto=proto,
|
$nw_proto=proto,
|
||||||
$nw_src=orig_h,
|
$nw_src=addr_to_subnet(orig_h),
|
||||||
$tp_src=orig_p,
|
$tp_src=orig_p,
|
||||||
$nw_dst=resp_h,
|
$nw_dst=addr_to_subnet(resp_h),
|
||||||
$tp_dst=resp_p
|
$tp_dst=resp_p
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,9 @@ export {
|
||||||
# At the moment, we store both v4 and v6 in the same fields.
|
# At the moment, we store both v4 and v6 in the same fields.
|
||||||
# This is not how OpenFlow does it, we might want to change that...
|
# This is not how OpenFlow does it, we might want to change that...
|
||||||
# IP source address.
|
# IP source address.
|
||||||
nw_src: addr &optional;
|
nw_src: subnet &optional;
|
||||||
# IP destination address.
|
# IP destination address.
|
||||||
nw_dst: addr &optional;
|
nw_dst: subnet &optional;
|
||||||
# TCP/UDP source port.
|
# TCP/UDP source port.
|
||||||
tp_src: port &optional;
|
tp_src: port &optional;
|
||||||
# TCP/UDP destination port.
|
# TCP/UDP destination port.
|
||||||
|
|
|
@ -26,6 +26,8 @@ function to_json(v: any, only_loggable: bool &default=F, field_escape_pattern: p
|
||||||
return cat(port_to_count(to_port(cat(v))));
|
return cat(port_to_count(to_port(cat(v))));
|
||||||
|
|
||||||
case "addr":
|
case "addr":
|
||||||
|
fallthrough;
|
||||||
|
case "subnet":
|
||||||
return cat("\"", v, "\"");
|
return cat("\"", v, "\"");
|
||||||
|
|
||||||
case "int":
|
case "int":
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
#empty_field (empty)
|
#empty_field (empty)
|
||||||
#unset_field -
|
#unset_field -
|
||||||
#path openflow
|
#path openflow
|
||||||
#open 2015-04-13-19-54-15
|
#open 2015-04-14-21-58-29
|
||||||
#fields ts dpid match.in_port match.dl_src match.dl_dst match.dl_vlan match.dl_vlan_pcp match.dl_type match.nw_tos match.nw_proto match.nw_src match.nw_dst match.tp_src match.tp_dst flow_mod.cookie flow_mod.table_id flow_mod.command flow_mod.idle_timeout flow_mod.hard_timeout flow_mod.priority flow_mod.out_group flow_mod.flags flow_mod.out_ports
|
#fields ts dpid match.in_port match.dl_src match.dl_dst match.dl_vlan match.dl_vlan_pcp match.dl_type match.nw_tos match.nw_proto match.nw_src match.nw_dst match.tp_src match.tp_dst flow_mod.cookie flow_mod.table_id flow_mod.command flow_mod.idle_timeout flow_mod.hard_timeout flow_mod.priority flow_mod.out_group flow_mod.flags flow_mod.out_ports
|
||||||
#types time count count string string count count count count count addr addr port port count count enum count count count count count vector[count]
|
#types time count count string string count count count count count subnet subnet port port count count enum count count count count count vector[count]
|
||||||
0.000000 42 - - - - - - - - - - - - 1 - OpenFlow::OFPFC_ADD 0 0 0 - 0 3,7
|
0.000000 42 - - - - - - - - - - - - 1 - OpenFlow::OFPFC_ADD 0 0 0 - 0 3,7
|
||||||
1254722767.875996 42 - - - - - 2048 - 6 10.10.1.4 74.53.140.153 1470 25 42 - OpenFlow::OFPFC_ADD 30 0 5 - 0 (empty)
|
1254722767.875996 42 - - - - - 2048 - 6 10.10.1.4/32 74.53.140.153/32 1470 25 42 - OpenFlow::OFPFC_ADD 30 0 5 - 0 (empty)
|
||||||
1254722767.875996 42 - - - - - 2048 - 6 74.53.140.153 10.10.1.4 25 25 42 - OpenFlow::OFPFC_ADD 30 0 5 - 0 (empty)
|
1254722767.875996 42 - - - - - 2048 - 6 74.53.140.153/32 10.10.1.4/32 25 25 42 - OpenFlow::OFPFC_ADD 30 0 5 - 0 (empty)
|
||||||
#close 2015-04-13-19-54-15
|
#close 2015-04-14-21-58-29
|
||||||
|
|
|
@ -2,6 +2,6 @@ http://127.0.0.1:8080/stats/flowentry/clear/42
|
||||||
http://127.0.0.1:8080/stats/flowentry/add
|
http://127.0.0.1:8080/stats/flowentry/add
|
||||||
{"match": {}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 0, "actions": [{"port": 3, "type": "OUTPUT"}, {"port": 7, "type": "OUTPUT"}], "cookie": 4398046511105, "idle_timeout": 0}
|
{"match": {}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 0, "actions": [{"port": 3, "type": "OUTPUT"}, {"port": 7, "type": "OUTPUT"}], "cookie": 4398046511105, "idle_timeout": 0}
|
||||||
http://127.0.0.1:8080/stats/flowentry/add
|
http://127.0.0.1:8080/stats/flowentry/add
|
||||||
{"match": {"tp_dst": 25, "nw_dst": "74.53.140.153", "nw_src": "10.10.1.4", "dl_type": 2048, "tp_src": 1470, "nw_proto": 6}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 5, "actions": [], "cookie": 4398046511146, "idle_timeout": 30}
|
{"match": {"tp_dst": 25, "nw_dst": "74.53.140.153/32", "nw_src": "10.10.1.4/32", "dl_type": 2048, "tp_src": 1470, "nw_proto": 6}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 5, "actions": [], "cookie": 4398046511146, "idle_timeout": 30}
|
||||||
http://127.0.0.1:8080/stats/flowentry/add
|
http://127.0.0.1:8080/stats/flowentry/add
|
||||||
{"match": {"tp_dst": 25, "nw_dst": "10.10.1.4", "nw_src": "74.53.140.153", "dl_type": 2048, "tp_src": 25, "nw_proto": 6}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 5, "actions": [], "cookie": 4398046511146, "idle_timeout": 30}
|
{"match": {"tp_dst": 25, "nw_dst": "10.10.1.4/32", "nw_src": "74.53.140.153/32", "dl_type": 2048, "tp_src": 25, "nw_proto": 6}, "dpid": 42, "flags": 0, "hard_timeout": 0, "priority": 5, "actions": [], "cookie": 4398046511146, "idle_timeout": 30}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue