diff options
author | Raimo Niskanen <[email protected]> | 2014-12-03 11:00:15 +0100 |
---|---|---|
committer | Raimo Niskanen <[email protected]> | 2014-12-03 11:00:15 +0100 |
commit | b5d8e067caad14b98a23c16bfcc19eb984d1703c (patch) | |
tree | a96baae4ea6667be427e92f0acad863b1784fc57 /lib/kernel/test/inet_SUITE.erl | |
parent | 588e344102ac9d9a6954336a650087a54c84fa53 (diff) | |
parent | 810ce7f8826ecdf2fb488c59c0a0689141995b39 (diff) | |
download | otp-b5d8e067caad14b98a23c16bfcc19eb984d1703c.tar.gz otp-b5d8e067caad14b98a23c16bfcc19eb984d1703c.tar.bz2 otp-b5d8e067caad14b98a23c16bfcc19eb984d1703c.zip |
Merge branch 'raimo/netns-opt-gen_udp/OTP-12314' into maint
* raimo/netns-opt-gen_udp/OTP-12314:
Text netns option at socket open
Fix handling netns option in gen_udp
Diffstat (limited to 'lib/kernel/test/inet_SUITE.erl')
-rw-r--r-- | lib/kernel/test/inet_SUITE.erl | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/kernel/test/inet_SUITE.erl b/lib/kernel/test/inet_SUITE.erl index ed43749cc0..d45dfc2173 100644 --- a/lib/kernel/test/inet_SUITE.erl +++ b/lib/kernel/test/inet_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2013. All Rights Reserved. +%% Copyright Ericsson AB 1997-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -38,7 +38,7 @@ gethostnative_debug_level/0, gethostnative_debug_level/1, getif/1, getif_ifr_name_overflow/1,getservbyname_overflow/1, getifaddrs/1, - parse_strict_address/1, simple_netns/1]). + parse_strict_address/1, simple_netns/1, simple_netns_open/1]). -export([get_hosts/1, get_ipv6_hosts/1, parse_hosts/1, parse_address/1, kill_gethost/0, parallell_gethost/0, test_netns/0]). @@ -53,7 +53,7 @@ all() -> t_gethostnative, gethostnative_parallell, cname_loop, gethostnative_debug_level, gethostnative_soft_restart, getif, getif_ifr_name_overflow, getservbyname_overflow, - getifaddrs, parse_strict_address, simple_netns]. + getifaddrs, parse_strict_address, simple_netns, simple_netns_open]. groups() -> [{parse, [], [parse_hosts, parse_address]}]. @@ -1128,6 +1128,32 @@ jog_netns_opt(S) -> ok. +simple_netns_open(Config) when is_list(Config) -> + case gen_udp:open(0, [binary,{netns,"/"},inet]) of + {ok,U} -> + ok = gen_udp:close(U); + {error,E1} when E1 =:= einval; E1 =:= eperm -> + ok + end, + case gen_tcp:listen(0, [binary,{netns,"/"},inet]) of + {ok,T} -> + ok = gen_tcp:close(T); + {error,E2} when E2 =:= einval; E2 =:= eperm -> + ok + end, + try gen_sctp:open(0, [binary,{netns,"/"},inet]) of + {ok,S} -> + ok = gen_sctp:close(S); + {error,E3} + when E3 =:= einval; E3 =:= eperm; E3 =:= eprotonosupport -> + ok + catch + error:badarg -> + %% Some older platforms does not allow netns for sctp + ok + end. + + %% Manual test to be run outside test_server in an emulator %% started by root, in a machine with setns() support... test_netns() -> |