Skip to content

Commit

Permalink
Use iplib instead of ip
Browse files Browse the repository at this point in the history
  • Loading branch information
ates committed Aug 7, 2012
1 parent 72d111b commit 1791f67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/iptraffic_session.erl
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ process_netflow_packet(_Pdu) ->
?WARNING_MSG("Unsupported NetFlow version~n", []).

match_record(H, Rec) ->
SrcIP = ip:long2ip(Rec#nfrec_v5.src_addr),
DstIP = ip:long2ip(Rec#nfrec_v5.dst_addr),
SrcIP = iplib:long2ip(Rec#nfrec_v5.src_addr),
DstIP = iplib:long2ip(Rec#nfrec_v5.dst_addr),
case match_session(SrcIP, DstIP) of
{ok, Matches} ->
Fun = fun({Dir, Session}) ->
Expand Down Expand Up @@ -264,8 +264,8 @@ build_iptraffic_args(H, Rec, Direction) when is_record(H, nfh_v5) ->
{_Days, Time} = calendar:seconds_to_daystime(H#nfh_v5.unix_secs),
Args = #ipt_args{
sec = calendar:time_to_seconds(Time),
src_ip = ip:long2ip(Rec#nfrec_v5.src_addr),
dst_ip = ip:long2ip(Rec#nfrec_v5.dst_addr),
src_ip = iplib:long2ip(Rec#nfrec_v5.src_addr),
dst_ip = iplib:long2ip(Rec#nfrec_v5.dst_addr),
src_port = Rec#nfrec_v5.src_port,
dst_port = Rec#nfrec_v5.dst_port,
proto = Rec#nfrec_v5.prot,
Expand Down
4 changes: 2 additions & 2 deletions src/iptraffic_tariffs.erl
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ match_rule(any, _) ->
match_rule(Rule, Args) ->
match_time(Rule#netflow_rule.time, Args#ipt_args.sec) andalso
(Rule#netflow_rule.dir == Args#ipt_args.dir orelse Rule#netflow_rule.dir == any) andalso
ip:in_range(Args#ipt_args.src_ip, Rule#netflow_rule.src_net) andalso
ip:in_range(Args#ipt_args.dst_ip, Rule#netflow_rule.dst_net) andalso
iplib:in_range(Args#ipt_args.src_ip, Rule#netflow_rule.src_net) andalso
iplib:in_range(Args#ipt_args.dst_ip, Rule#netflow_rule.dst_net) andalso
(Rule#netflow_rule.src_port == Args#ipt_args.src_port orelse Rule#netflow_rule.src_port == any) andalso
(Rule#netflow_rule.dst_port == Args#ipt_args.dst_port orelse Rule#netflow_rule.dst_port == any) andalso
(Rule#netflow_rule.proto == Args#ipt_args.proto orelse Rule#netflow_rule.proto == any).
Expand Down

0 comments on commit 1791f67

Please sign in to comment.