anchor.diff:      decode_options(Rest, [#ipv4_opt{type=decode_option_type(Class, Number),
                                       copy=Copy, data=Data} | Acc]).
   
  -encode_options([]) ->
  -    <<>>.
  +%% {ipv4_opt,rtralt,1,<<0,0>>}
  +encode_options(Options) ->
  +    iolist_to_binary([encode_option(Opt)
  +                      || Opt <- Options]).
  +
  +encode_option(#ipv4_opt{type=Type,copy=Copy,data=Data}) ->
  +    {Class, Number} = encode_option_type(Type),
  +    OptSz = byte_size(Data) + 2,
  +    <<Copy:1, Class:2, Number:5, OptSz:8/big, Data/binary>>.
  +
  +options_coding_test() ->
  +    OptList = [{ipv4_opt,rtralt,1,<<0,0>>}],
  +    ?assert( decode_options(encode_options(OptList)) =:= OptList ).
  +
   
   check_header_checksum(Dgram,HLen,HdrChkSum) when is_binary(Dgram),
                                                    is_integer(HLen),
  
positive.code: -include("types.hrl").
  -define(IP_VERSION, 4).
  -define(IP_MIN_HDR_LEN, 5).
  
  %%====================================================================
  %% API
  
negative.code: expand(Pkt = #ipv4{options=Opts}) when is_list(Opts) ->
      expand(Pkt#ipv4{options=encode_options(Opts)});
  expand(Pkt = #ipv4{hlen=H, options=Opts}) when not is_integer(H), is_binary(Opts) ->
      expand(Pkt#ipv4{hlen=?IP_MIN_HDR_LEN + (byte_size(Opts) div 4)});
  expand(Pkt = #ipv4{flags=Flags}) when is_list(Flags) ->
      expand(Pkt#ipv4{flags=encode_flags(Flags)});
  expand(Pkt = #ipv4{src=Src}) when not (is_binary(Src) andalso byte_size(Src) =:= 4) ->
  