otherwise, if the mld timers are not cancelled, an illegal address will
be accessed after timeout. to avoid this scenario, when the network card
is unregistered, all MLD timers must be attempted to be synchronously
cancelled.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
insufficient IOB during IP fragment is a normal scenario and should
not crash directly. The assert needs to be removed and corresponding
error handling needs to be added.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
When SOL_SOCKET options (e.g., SO_BINDTODEVICE via ping -I) hit ICMP sockets, icmp_{get,set}sockopt logged “Unrecognized ICMP option: 17” before fallback. Handle SOL_SOCKET explicitly by returning -ENOPROTOOPT so psock_* routes to the socket-level handler. Removes noisy logs without changing behavior (invalid devices still return -ENODEV).
Signed-off-by: wangchen <wangchen41@xiaomi.com>
when dev is down, tcp_pollsetup returns the value 'OK' and sets the connection status to 'down' and eventset to POLLERR & POLLUP
Signed-off-by: wangchen <wangchen41@xiaomi.com>
Some third-party network libraries use PACKET_ADD_MEMBERSHIP to add MAC
addresses to devices, and this patch can add support for this.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Setting group->flags to IGMP_SCHEDMSG is a possible outcome, not unacceptable. If it occurs, an error log message will be reported
Signed-off-by: wangchen <wangchen41@xiaomi.com>
After first connection refused happend,The user use the same connection failed,becasue the tcpstateflags is not TCP_ALLOCATED
Signed-off-by: wangchen <wangchen41@xiaomi.com>
According to the definitions of PF_PACKET and SOCK_DGRAM,
extend the current protocol stack pkt protocol to support SOCK_DGRAM mode.
Some third-party network libraries use AF_PACKET, SOCK_DGRAM type sockets
to construct packets and send/receive data, This patch can add support
for this.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
on some device, the wifi driver uses dev->d_len as the length of the sent packet. However, due to the lack of update in d_len, the sent packet is not considered a normal packet and is not processed by the other end
Signed-off-by: wangchen <wangchen41@xiaomi.com>
When triggering TCP retransmission through a timer, conn->unacked_q will save more packets, which may result in sndseq being equal to ackseq. Previous implementations may cause conn->nrtx to not be cleared, leading to an increase in conn->rto errors and a longer timer time
Signed-off-by: wangchen <wangchen41@xiaomi.com>
The modification is to solve the problem that the opposite end cannot receive the retransmission message, and the protocol stack no longer sends retransmission messages
Signed-off-by: wangchen <wangchen41@xiaomi.com>
since the current txnotify is executed synchronously at the location of
the current call without switching threads, resources such as d_iob need
to be cached first.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
TCP_CORK and TCP_NODELAY behave almost exactly the opposite,
so first provide simple support for TCP_CORK.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
When using usrsock to pass the network interface name, omitting "\0" will cause the host to parse extra characters. therefore, the tail section should be inspected during device binding.
Signed-off-by: zhangshuai39 <zhangshuai39@xiaomi.com>
If there is data in readahead, it needs to be released; otherwise,
it will cause the leakage of IOB resources
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
Ref: https://man7.org/linux/man-pages/man7/packet.7.html
1. For `socket(AF_PACKET, int socket_type, int protocol)`: When `protocol` is set to `htons(ETH_P_ALL)`, then all protocols are received. If `protocol` is set to zero, no packets are received.
2. For `bind`: `bind` can optionally be called with a nonzero `sll_protocol` to start receiving packets for the protocols specified.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
When app send a pkt-packet, then it will read back it and case some problem. Connection should not read back the message sent by itself.
Signed-off-by: gaohedong <gaohedong@xiaomi.com>
Inspired by Linux's way, we also create VLAN devices for managing VLAN,
which will become interfaces like `eth0.58`.
QinQ is also supported, we can create VLAN devices above another VLAN
devices, like `eth0.100.101` (or even `eth0.1.2.3.4`, also supported on
Linux).
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
Resolve some timing issues caused by calling net_breaklock to release netlock in the function NET_BUFPOOL_TRYALLOC
Signed-off-by: wangchen <wangchen41@xiaomi.com>