anchor.diff:  -spec getifaddrs(Namespace) -> {ok, IfAddrs} | {error, Reason} when
         Namespace :: file:filename_all(),
         IfAddrs   :: [ifaddrs()],
  +      Reason    :: term();
  +                (FilterMap) -> {ok, IfAddrs} | {error, Reason} when
  +      FilterMap :: ifaddrs_filter_map(),
  +      IfAddrs   :: [ifaddrs()],
         Reason    :: term().
   
   -ifdef(USE_ESOCK).
   getifaddrs(Namespace) when is_list(Namespace) ->
  -    prim_net:getifaddrs(#{netns => Namespace}).
  +    prim_net:getifaddrs(#{netns => Namespace});
  +getifaddrs(FilterMap) when is_map(FilterMap) ->
  +    do_getifaddrs(getifaddrs_filter_map(FilterMap),
  +                  fun() -> prim_net:getifaddrs(#{}) end).
   -else.
   -dialyzer({nowarn_function, getifaddrs/1}).
   getifaddrs(Namespace) when is_list(Namespace) ->
  -    erlang:error(notsup).
  --endif.
  -
  -
  +    erlang:error(notsup);
  +getifaddrs(FilterMap) when is_map(FilterMap) ->
  +    erlang:error(notsup).
  +-endif.
  +
  +
  +-spec getifaddrs(FilterMap, Namespace) -> {ok, IfAddrs} | {error, Reason} when
  +      FilterMap :: ifaddrs_filter_map(),
  +      Namespace :: file:filename_all(),
  +      IfAddrs   :: [ifaddrs()],
  +      Reason    :: term().
  +
  +getifaddrs(FilterMap, Namespace)
  +  when is_map(FilterMap) andalso is_list(Namespace) ->
  +    do_getifaddrs(getifaddrs_filter_map(FilterMap),
  +                  fun() -> getifaddrs(Namespace) end).
  +
  +do_getifaddrs(FilterMap, GetIfAddrs) ->
  +    case GetIfAddrs() of
  +        {ok, IfAddrs0} ->
  +            Filter = fun(Elem) -> getifaddrs_filter(FilterMap, Elem) end,
  +            {ok, lists:filtermap(Filter, IfAddrs0)};
  +        {error, _} = ERROR ->
  +            ERROR
  +    end.
  +
  +getifaddrs_filter_map(FilterMap) ->
  +    maps:merge(getifaddrs_filter_map_default(), FilterMap).
  +
  +getifaddrs_filter_map_default() ->
  +    #{family => default, flags => any}.
  +
  +getifaddrs_filter(#{family := FFamily},
  +                  #{addr := #{family := Family}} = _Entry)
  +  when (FFamily =:= default) andalso
  +       ((Family =:= inet) orelse (Family =:= inet6)) ->
  +    true;
  +getifaddrs_filter(#{family := FFamily},
  +                  #{addr := #{family := Family}} = _Entry)
  +  when (FFamily =:= inet) andalso (Family =:= inet) ->
  +    true;
  +getifaddrs_filter(#{family := FFamily},
  +                  #{addr := #{family := Family}} = _Entry)
  +  when (FFamily =:= inet6) andalso (Family =:= inet6) ->
  +    true;
  +getifaddrs_filter(#{family := FFamily}, _Entry)
  +  when (FFamily =:= all) ->
  +    true;
  +getifaddrs_filter(_Filter, _Entry) ->
  +    false.
   
   
   %% ===========================================================================
  
positive.code: 
  -ifdef(USE_ESOCK).
  getifaddrs() ->
      prim_net:getifaddrs(#{}).
  -else.
  getifaddrs() ->
      erlang:error(notsup).
  
negative.code:          gethostname/0,
           getnameinfo/1, getnameinfo/2,
           getaddrinfo/1, getaddrinfo/2,
           getifaddrs/0,  getifaddrs/1, getifaddrs/2,
  
           if_name2index/1,
           if_index2name/1,
  