@@ -813,10 +813,6 @@ pub unsafe extern "C" fn krun_add_net_unixstream(
813
813
features : u32 ,
814
814
flags : u32 ,
815
815
) -> i32 {
816
- if cfg ! ( not( feature = "net" ) ) {
817
- return -libc:: ENOTSUP ;
818
- }
819
-
820
816
let path = if !c_path. is_null ( ) {
821
817
match CStr :: from_ptr ( c_path) . to_str ( ) {
822
818
Ok ( path) => Some ( PathBuf :: from ( path) ) ,
@@ -873,10 +869,6 @@ pub unsafe extern "C" fn krun_add_net_unixgram(
873
869
features : u32 ,
874
870
flags : u32 ,
875
871
) -> i32 {
876
- if cfg ! ( not( feature = "net" ) ) {
877
- return -libc:: ENOTSUP ;
878
- }
879
-
880
872
let path = if !c_path. is_null ( ) {
881
873
match CStr :: from_ptr ( c_path) . to_str ( ) {
882
874
Ok ( path) => Some ( PathBuf :: from ( path) ) ,
@@ -933,10 +925,6 @@ pub unsafe extern "C" fn krun_add_net_tap(
933
925
features : u32 ,
934
926
flags : u32 ,
935
927
) -> i32 {
936
- if cfg ! ( not( feature = "net" ) ) {
937
- return -libc:: ENOTSUP ;
938
- }
939
-
940
928
let tap_name = match CStr :: from_ptr ( c_tap_name) . to_str ( ) {
941
929
Ok ( tap_name) => tap_name. to_string ( ) ,
942
930
Err ( e) => {
@@ -976,6 +964,19 @@ pub unsafe extern "C" fn krun_add_net_tap(
976
964
KRUN_SUCCESS
977
965
}
978
966
967
+ #[ allow( clippy:: missing_safety_doc) ]
968
+ #[ no_mangle]
969
+ #[ cfg( all( not( target_os = "linux" ) , feature = "net" ) ) ]
970
+ pub unsafe extern "C" fn krun_add_net_tap (
971
+ _ctx_id : u32 ,
972
+ _c_tap_name : * const c_char ,
973
+ _c_mac : * const u8 ,
974
+ _features : u32 ,
975
+ _flags : u32 ,
976
+ ) -> i32 {
977
+ -libc:: EINVAL
978
+ }
979
+
979
980
#[ allow( clippy:: missing_safety_doc) ]
980
981
#[ no_mangle]
981
982
#[ cfg( feature = "net" ) ]
@@ -984,10 +985,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
984
985
return -libc:: EINVAL ;
985
986
}
986
987
987
- if cfg ! ( not( feature = "net" ) ) {
988
- return -libc:: ENOTSUP ;
989
- }
990
-
991
988
match CTX_MAP . lock ( ) . unwrap ( ) . entry ( ctx_id) {
992
989
Entry :: Occupied ( mut ctx_cfg) => {
993
990
let cfg = ctx_cfg. get_mut ( ) ;
@@ -1012,10 +1009,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
1012
1009
#[ no_mangle]
1013
1010
#[ cfg( feature = "net" ) ]
1014
1011
pub unsafe extern "C" fn krun_set_gvproxy_path ( ctx_id : u32 , c_path : * const c_char ) -> i32 {
1015
- if cfg ! ( not( feature = "net" ) ) {
1016
- return -libc:: ENOTSUP ;
1017
- }
1018
-
1019
1012
let path_str = match CStr :: from_ptr ( c_path) . to_str ( ) {
1020
1013
Ok ( path) => path,
1021
1014
Err ( e) => {
0 commit comments