[erlang-patches] patch to fix inet:ifset/2 breakage in R11B-5 (already fixed in R12)

Matthias Lang matthias@REDACTED
Thu Feb 12 14:35:09 CET 2009


Hi,

inet:ifset/2 is an undocumented but useful function. It got broken
somewhere between R11B-2 and R11B-5, it looks like it broke when SCTP
got added. Here's what happens in R11B-5:

  1> inet:ifset("eth0", {addr, {172,16,2,1}}).
  ** exited: {function_clause,
                 [{prim_inet,encode_ifopt_val,[{addr,{172,16,2,1}},[]]},
                  {prim_inet,ifset,3},
                  {inet,withsocket,1},
                  {erl_eval,do_apply,5},
                  {shell,exprs,6},
                  {shell,eval_loop,3}]} **

I can't find any mention of the problem in the release notes for R12B-0,
but it seems to be fixed.

This patch is only of interest to people who specifically want to use
R11B-5 and inet:ifset/2, i.e. probably only me.

Matt

--- lib/kernel/src/prim_inet.erl.11B5   2007-06-11 14:55:45.000000000 +0200
+++ lib/kernel/src/prim_inet.erl        2009-02-03 06:50:01.909368558 +0100
@@ -1707,9 +1707,9 @@

 encode_ifopt_val([{Opt,Val}|Opts], Buf) ->
     Type = type_ifopt(Opt),
-    try type_value(Type, Val) of
+    try type_value(set, Type, Val) of
        true -> encode_ifopt_val(Opts,
-                                [Buf,enc_ifopt(Opt),enc_value(Type,Val)]);
+                                [Buf,enc_ifopt(Opt),enc_value(set, Type,Val)]);
        false -> {error,einval}
     catch
        Reason -> {error,Reason}




More information about the erlang-patches mailing list