aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded/src/socket.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2018-07-12 10:24:44 +0200
committerMicael Karlberg <[email protected]>2018-09-18 14:50:18 +0200
commite0f27afac1cb3e3a5567a05081d0cf307c154b0d (patch)
tree60d4b4cde01d1a4975976314998a9e5c7ccfc4e4 /erts/preloaded/src/socket.erl
parente5a5cb1025270c265baeda89dd4cd13a1417a262 (diff)
downloadotp-e0f27afac1cb3e3a5567a05081d0cf307c154b0d.tar.gz
otp-e0f27afac1cb3e3a5567a05081d0cf307c154b0d.tar.bz2
otp-e0f27afac1cb3e3a5567a05081d0cf307c154b0d.zip
[socket-nif] Add support for socket (level ip) option mtu_discover
Added support for the IP option MTU_DISCOVER. OTP-14831
Diffstat (limited to 'erts/preloaded/src/socket.erl')
-rw-r--r--erts/preloaded/src/socket.erl16
1 files changed, 13 insertions, 3 deletions
diff --git a/erts/preloaded/src/socket.erl b/erts/preloaded/src/socket.erl
index d6b2289b69..5338f0d988 100644
--- a/erts/preloaded/src/socket.erl
+++ b/erts/preloaded/src/socket.erl
@@ -90,6 +90,7 @@
ip_tos_flag/0,
ip_mreq/0,
+ ip_pmtudisc/0,
msg_hdr/0
@@ -149,6 +150,8 @@
-type ip_mreq() :: #{multiaddr := ip4_address(),
interface := any | ip4_address()}.
+-type ip_pmtudisc() :: want | dont | do | probe.
+
-type sockaddr_un() :: #{family := local,
path := binary() | string()}.
-type sockaddr_in4() :: #{family := inet,
@@ -523,7 +526,7 @@
%% -define(SOCKET_OPT_IP_MINTTL, 9).
%% -define(SOCKET_OPT_IP_MSFILTER, 10).
-define(SOCKET_OPT_IP_MTU, 11).
-%% -define(SOCKET_OPT_IP_MTU_DISCOVER, 12).
+-define(SOCKET_OPT_IP_MTU_DISCOVER, 12).
%% -define(SOCKET_OPT_IP_MULTICAST_ALL, 13).
-define(SOCKET_OPT_IP_MULTICAST_IF, 14).
-define(SOCKET_OPT_IP_MULTICAST_LOOP, 15).
@@ -1982,6 +1985,13 @@ enc_setopt_value(ip, drop_membership, #{multiaddr := M,
when (is_tuple(M) andalso (size(M) =:= 4)) andalso
((IF =:= any) orelse (is_tuple(IF) andalso (size(IF) =:= 4))) ->
V;
+enc_setopt_value(ip, mtu_discover, V, _D, _T, _P)
+ when (V =:= want) orelse
+ (V =:= dont) orelse
+ (V =:= do) orelse
+ (V =:= probe) orelse
+ is_integer(V) ->
+ V;
enc_setopt_value(ip, multicast_if, V, _D, _T, _P)
when (V =:= any) orelse (is_tuple(V) andalso (size(V) =:= 4)) ->
V;
@@ -2277,8 +2287,8 @@ enc_sockopt_key(ip = L, msfilter = Opt, _Dir, _D, _T, _P) ->
not_supported({L, Opt});
enc_sockopt_key(ip = _L, mtu = _Opt, get = _Dir, _D, _T, _P) ->
?SOCKET_OPT_IP_MTU;
-enc_sockopt_key(ip = L, mtu_discover = Opt, _Dir, _D, _T, _P) ->
- not_supported({L, Opt});
+enc_sockopt_key(ip = _L, mtu_discover = _Opt, _Dir, _D, _T, _P) ->
+ ?SOCKET_OPT_IP_MTU_DISCOVER;
enc_sockopt_key(ip = L, multicast_all = Opt, _Dir, _D, _T, _P) ->
not_supported({L, Opt});
enc_sockopt_key(ip = _L, multicast_if = _Opt, _Dir, _D, _T, _P) ->