@@ -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) => {
@@ -935,6 +923,19 @@ pub unsafe extern "C" fn krun_add_net_tap(
935
923
KRUN_SUCCESS
936
924
}
937
925
926
+ #[ allow( clippy:: missing_safety_doc) ]
927
+ #[ no_mangle]
928
+ #[ cfg( all( not( target_os = "linux" ) , feature = "net" ) ) ]
929
+ pub unsafe extern "C" fn krun_add_net_tap (
930
+ _ctx_id : u32 ,
931
+ _c_tap_name : * const c_char ,
932
+ _c_mac : * const u8 ,
933
+ _features : u32 ,
934
+ _flags : u32 ,
935
+ ) -> i32 {
936
+ -libc:: EINVAL
937
+ }
938
+
938
939
#[ allow( clippy:: missing_safety_doc) ]
939
940
#[ no_mangle]
940
941
#[ cfg( feature = "net" ) ]
@@ -943,10 +944,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
943
944
return -libc:: EINVAL ;
944
945
}
945
946
946
- if cfg ! ( not( feature = "net" ) ) {
947
- return -libc:: ENOTSUP ;
948
- }
949
-
950
947
match CTX_MAP . lock ( ) . unwrap ( ) . entry ( ctx_id) {
951
948
Entry :: Occupied ( mut ctx_cfg) => {
952
949
let cfg = ctx_cfg. get_mut ( ) ;
@@ -971,10 +968,6 @@ pub unsafe extern "C" fn krun_set_passt_fd(ctx_id: u32, fd: c_int) -> i32 {
971
968
#[ no_mangle]
972
969
#[ cfg( feature = "net" ) ]
973
970
pub unsafe extern "C" fn krun_set_gvproxy_path ( ctx_id : u32 , c_path : * const c_char ) -> i32 {
974
- if cfg ! ( not( feature = "net" ) ) {
975
- return -libc:: ENOTSUP ;
976
- }
977
-
978
971
let path_str = match CStr :: from_ptr ( c_path) . to_str ( ) {
979
972
Ok ( path) => path,
980
973
Err ( e) => {
0 commit comments