@@ -768,10 +768,6 @@ pub unsafe extern "C" fn krun_add_net_unixstream(
768
768
features : u32 ,
769
769
flags : u32 ,
770
770
) -> i32 {
771
- if cfg ! ( not( feature = "net" ) ) {
772
- return -libc:: ENOTSUP ;
773
- }
774
-
775
771
let path = if !c_path. is_null ( ) {
776
772
match CStr :: from_ptr ( c_path) . to_str ( ) {
777
773
Ok ( path) => Some ( PathBuf :: from ( path) ) ,
@@ -828,10 +824,6 @@ pub unsafe extern "C" fn krun_add_net_unixgram(
828
824
features : u32 ,
829
825
flags : u32 ,
830
826
) -> i32 {
831
- if cfg ! ( not( feature = "net" ) ) {
832
- return -libc:: ENOTSUP ;
833
- }
834
-
835
827
let path = if !c_path. is_null ( ) {
836
828
match CStr :: from_ptr ( c_path) . to_str ( ) {
837
829
Ok ( path) => Some ( PathBuf :: from ( path) ) ,
@@ -888,10 +880,6 @@ pub unsafe extern "C" fn krun_add_net_tap(
888
880
features : u32 ,
889
881
flags : u32 ,
890
882
) -> i32 {
891
- if cfg ! ( not( feature = "net" ) ) {
892
- return -libc:: ENOTSUP ;
893
- }
894
-
895
883
let tap_name = match CStr :: from_ptr ( c_tap_name) . to_str ( ) {
896
884
Ok ( tap_name) => tap_name. to_string ( ) ,
897
885
Err ( e) => {
@@ -931,6 +919,19 @@ pub unsafe extern "C" fn krun_add_net_tap(
931
919
KRUN_SUCCESS
932
920
}
933
921
922
+ #[ allow( clippy:: missing_safety_doc) ]
923
+ #[ no_mangle]
924
+ #[ cfg( all( not( target_os = "linux" ) , feature = "net" ) ) ]
925
+ pub unsafe extern "C" fn krun_add_net_tap (
926
+ _ctx_id : u32 ,
927
+ _c_tap_name : * const c_char ,
928
+ _c_mac : * const u8 ,
929
+ _features : u32 ,
930
+ _flags : u32 ,
931
+ ) -> i32 {
932
+ -libc:: EINVAL
933
+ }
934
+
934
935
#[ allow( clippy:: missing_safety_doc) ]
935
936
#[ no_mangle]
936
937
#[ cfg( feature = "net" ) ]
@@ -939,10 +940,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
939
940
return -libc:: EINVAL ;
940
941
}
941
942
942
- if cfg ! ( not( feature = "net" ) ) {
943
- return -libc:: ENOTSUP ;
944
- }
945
-
946
943
match CTX_MAP . lock ( ) . unwrap ( ) . entry ( ctx_id) {
947
944
Entry :: Occupied ( mut ctx_cfg) => {
948
945
let cfg = ctx_cfg. get_mut ( ) ;
@@ -967,10 +964,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
967
964
#[ no_mangle]
968
965
#[ cfg( feature = "net" ) ]
969
966
pub unsafe extern "C" fn krun_set_gvproxy_path ( ctx_id : u32 , c_path : * const c_char ) -> i32 {
970
- if cfg ! ( not( feature = "net" ) ) {
971
- return -libc:: ENOTSUP ;
972
- }
973
-
974
967
let path_str = match CStr :: from_ptr ( c_path) . to_str ( ) {
975
968
Ok ( path) => path,
976
969
Err ( e) => {
0 commit comments