@@ -535,6 +535,22 @@ pub enum ControlMessage<'a> {
535
535
target_os = "macos"
536
536
) ) ]
537
537
Ipv6PacketInfo ( & ' a libc:: in6_pktinfo ) ,
538
+ #[ cfg( any(
539
+ target_os = "freebsd" ,
540
+ target_os = "ios" ,
541
+ target_os = "macos" ,
542
+ target_os = "netbsd" ,
543
+ target_os = "openbsd" ,
544
+ ) ) ]
545
+ Ipv4RecvIf ( & ' a libc:: sockaddr_dl ) ,
546
+ #[ cfg( any(
547
+ target_os = "freebsd" ,
548
+ target_os = "ios" ,
549
+ target_os = "macos" ,
550
+ target_os = "netbsd" ,
551
+ target_os = "openbsd" ,
552
+ ) ) ]
553
+ Ipv4RecvDstAddr ( & ' a libc:: in_addr ) ,
538
554
539
555
/// Catch-all variant for unimplemented cmsg types.
540
556
#[ doc( hidden) ]
@@ -594,6 +610,26 @@ impl<'a> ControlMessage<'a> {
594
610
ControlMessage :: Ipv6PacketInfo ( pktinfo) => {
595
611
mem:: size_of_val ( pktinfo)
596
612
} ,
613
+ #[ cfg( any(
614
+ target_os = "freebsd" ,
615
+ target_os = "ios" ,
616
+ target_os = "macos" ,
617
+ target_os = "netbsd" ,
618
+ target_os = "openbsd" ,
619
+ ) ) ]
620
+ ControlMessage :: Ipv4RecvIf ( dl) => {
621
+ mem:: size_of_val ( dl)
622
+ } ,
623
+ #[ cfg( any(
624
+ target_os = "freebsd" ,
625
+ target_os = "ios" ,
626
+ target_os = "macos" ,
627
+ target_os = "netbsd" ,
628
+ target_os = "openbsd" ,
629
+ ) ) ]
630
+ ControlMessage :: Ipv4RecvDstAddr ( inaddr) => {
631
+ mem:: size_of_val ( inaddr)
632
+ } ,
597
633
ControlMessage :: Unknown ( UnknownCmsg ( _, bytes) ) => {
598
634
mem:: size_of_val ( bytes)
599
635
}
@@ -622,6 +658,22 @@ impl<'a> ControlMessage<'a> {
622
658
target_os = "macos"
623
659
) ) ]
624
660
ControlMessage :: Ipv6PacketInfo ( _) => libc:: IPPROTO_IPV6 ,
661
+ #[ cfg( any(
662
+ target_os = "freebsd" ,
663
+ target_os = "ios" ,
664
+ target_os = "macos" ,
665
+ target_os = "netbsd" ,
666
+ target_os = "openbsd" ,
667
+ ) ) ]
668
+ ControlMessage :: Ipv4RecvIf ( _) => libc:: IPPROTO_IP ,
669
+ #[ cfg( any(
670
+ target_os = "freebsd" ,
671
+ target_os = "ios" ,
672
+ target_os = "macos" ,
673
+ target_os = "netbsd" ,
674
+ target_os = "openbsd" ,
675
+ ) ) ]
676
+ ControlMessage :: Ipv4RecvDstAddr ( _) => libc:: IPPROTO_IP ,
625
677
ControlMessage :: Unknown ( ref cmsg) => cmsg. 0 . cmsg_level ,
626
678
}
627
679
}
@@ -648,6 +700,22 @@ impl<'a> ControlMessage<'a> {
648
700
target_os = "macos"
649
701
) ) ]
650
702
ControlMessage :: Ipv6PacketInfo ( _) => libc:: IPV6_PKTINFO ,
703
+ #[ cfg( any(
704
+ target_os = "freebsd" ,
705
+ target_os = "ios" ,
706
+ target_os = "macos" ,
707
+ target_os = "netbsd" ,
708
+ target_os = "openbsd" ,
709
+ ) ) ]
710
+ ControlMessage :: Ipv4RecvIf ( _) => libc:: IP_RECVIF ,
711
+ #[ cfg( any(
712
+ target_os = "freebsd" ,
713
+ target_os = "ios" ,
714
+ target_os = "macos" ,
715
+ target_os = "netbsd" ,
716
+ target_os = "openbsd" ,
717
+ ) ) ]
718
+ ControlMessage :: Ipv4RecvDstAddr ( _) => libc:: IP_RECVDSTADDR ,
651
719
ControlMessage :: Unknown ( ref cmsg) => cmsg. 0 . cmsg_type ,
652
720
}
653
721
}
@@ -708,6 +776,26 @@ impl<'a> ControlMessage<'a> {
708
776
ControlMessage :: Ipv6PacketInfo ( pktinfo) => {
709
777
copy_bytes ( pktinfo, buf)
710
778
}
779
+ #[ cfg( any(
780
+ target_os = "freebsd" ,
781
+ target_os = "ios" ,
782
+ target_os = "macos" ,
783
+ target_os = "netbsd" ,
784
+ target_os = "openbsd" ,
785
+ ) ) ]
786
+ ControlMessage :: Ipv4RecvIf ( dl) => {
787
+ copy_bytes ( dl, buf)
788
+ } ,
789
+ #[ cfg( any(
790
+ target_os = "freebsd" ,
791
+ target_os = "ios" ,
792
+ target_os = "macos" ,
793
+ target_os = "netbsd" ,
794
+ target_os = "openbsd" ,
795
+ ) ) ]
796
+ ControlMessage :: Ipv4RecvDstAddr ( inaddr) => {
797
+ copy_bytes ( inaddr, buf)
798
+ } ,
711
799
ControlMessage :: Unknown ( _) => unreachable ! ( ) ,
712
800
}
713
801
} ;
@@ -760,6 +848,28 @@ impl<'a> ControlMessage<'a> {
760
848
ControlMessage :: Ipv4PacketInfo (
761
849
& * ( data. as_ptr ( ) as * const _ ) )
762
850
}
851
+ #[ cfg( any(
852
+ target_os = "freebsd" ,
853
+ target_os = "ios" ,
854
+ target_os = "macos" ,
855
+ target_os = "netbsd" ,
856
+ target_os = "openbsd" ,
857
+ ) ) ]
858
+ ( libc:: IPPROTO_IP , libc:: IP_RECVIF ) => {
859
+ ControlMessage :: Ipv4RecvIf (
860
+ & * ( data. as_ptr ( ) as * const _ ) )
861
+ }
862
+ #[ cfg( any(
863
+ target_os = "freebsd" ,
864
+ target_os = "ios" ,
865
+ target_os = "macos" ,
866
+ target_os = "netbsd" ,
867
+ target_os = "openbsd" ,
868
+ ) ) ]
869
+ ( libc:: IPPROTO_IP , libc:: IP_RECVDSTADDR ) => {
870
+ ControlMessage :: Ipv4RecvDstAddr (
871
+ & * ( data. as_ptr ( ) as * const _ ) )
872
+ }
763
873
764
874
( _, _) => {
765
875
ControlMessage :: Unknown ( UnknownCmsg ( header, data) )
0 commit comments