Skip to content

Commit

Permalink
Reorder validation check
Browse files Browse the repository at this point in the history
  • Loading branch information
msantos committed Apr 1, 2012
1 parent a192a89 commit c7790f1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/sut.erl
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,7 @@ aton(Address) when is_list(Address) ->
aton(Address) when is_tuple(Address) ->
Address.

% Invalid protocol
valid(<<Protocol:4, _/binary>>, _State) when Protocol =/= 6 ->
false;

% loopback
valid(<<6:4, _Class:8, _Flow:20,
_Len:16, _Next:8, _Hop:8,
Expand Down Expand Up @@ -224,5 +222,8 @@ valid(<<6:4, _Class:8, _Flow:20,
0:16, 0:16, 0:16, 0:16, 0:16, 16#FFFF:16, _:16, _:16,
_Payload/binary>>, _State) ->
false;
valid(_, _) ->
true.
valid(<<6:4, _/binary>>, _State) ->
true;
% Invalid protocol
valid(_Packet, _State) ->
false.

0 comments on commit c7790f1

Please sign in to comment.