Ok, I tryed to reproduce your task. Speaking shortly it works, see the attached file. A test system is a VM undef FreeBSD bhyve, the global zone has an interface: vioif0: flags=1000943 mtu 1500 index 2 inet 192.168.1.3 netmask ffffff00 broadcast 192.168.1.255 Over this nic I use VNIC and test it in a non-global zone: LINK OVER SPEED MACADDRESS MACADDRTYPE VID ZONE dev0 vioif0 10000 2:8:20:2d:76:5d fixed 0 dev01 Now the non-global zone: dev01% ifconfig dev0 dev0: flags=1000843 mtu 1500 index 2 inet 192.168.1.10 netmask ffffff00 broadcast 192.168.1.255 dev01% gcc -o tst main.c dev01% pfexec id uid=0(root) gid=0(root) группы=0(root),1000(denis) dev01% pfexec ./tst result = 60; errno = 0 On the host the NIC is attached to a bridge via VMNET: asus# ifconfig bridge0 bridge0: flags=1008843 metric 0 mtu 1500 options=0 ether 58:9c:fc:10:c6:27 inet 192.168.1.1 netmask 0xffffff00 broadcast 192.168.1.255 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0 member: vmnet0 flags=143 ifmaxaddr 0 port 4 priority 128 path cost 2000000 groups: bridge nd6 options=9 asus# ifconfig vmnet0 vmnet0: flags=1008943 metric 0 mtu 1500 options=80000 ether 58:9c:fc:10:0d:5d hwaddr 58:9c:fc:00:58:3f groups: vmnet media: Ethernet 1000baseT status: active nd6 options=29 Opened by PID 4683 And the output of tcpdump on the bridge0: asus# tcpdump -i bridge0 -n not port 22 tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on bridge0, link-type EN10MB (Ethernet), snapshot length 262144 bytes 17:05:02.479797 ARP, Request who-has 10.0.0.61 (ff:ff:ff:ff:ff:ff) tell 10.0.0.13, length 46 ^C 1 packet captured 17 packets received by filter 0 packets dropped by kernel So, 10.0.0.61 and 10.0.0.13 are from your packet, therefore it works (in my test env) On Friday 31 May 2024 16:33:05 Marcel Telka wrote: > On Fri, May 31, 2024 at 03:18:23PM +0300, Denis Kozadaev wrote: > > On Friday 31 May 2024 15:07:13 Marcel Telka wrote: > > > On Fri, May 31, 2024 at 02:23:04PM +0300, Denis Kozadaev wrote: > > > > The send() function can be used only when the socket is in a > > > > connected state. (c) manual page at > > > > https://illumos.org/man/3SOCKET/send Use sendto(), Marcel. > > > > > > sendto(s, buf, sizeof buf - 1, 0, NULL, 0); > > > > > > gives the same result: succeeds, but no packet on the network. > > > > it is because > > send(sock, buf, len, flags) > > could be equivalent to > > sendto(sock, buf, len, flags, NULL, 0) > > it depend of the implementation > > You should specify a real address for sendto() > > and yes, the packet and the address have duplicate of this data. > > I tried to add this: > > > llp.sll_pkttype = PACKET_BROADCAST; > llp.sll_hatype = ARPHRD_ETHER; > llp.sll_halen = 6; > llp.sll_addr[0] = 0xff; > llp.sll_addr[1] = 0xff; > llp.sll_addr[2] = 0xff; > llp.sll_addr[3] = 0xff; > llp.sll_addr[4] = 0xff; > llp.sll_addr[5] = 0xff; > > sendto(s, buf, sizeof buf - 1, 0, (struct sockaddr *)&llp, sizeof > llp); > > And the result is stil the same: the function succeeded, no packet on > the network.