[DPI][TCP] linux API的接口如何控制urgent包的收发

做DPI,写协议栈的时候,处理到了urgent数据包。突然好奇应用层是如何控制发出urgent包的呢?而接收端又是如何知道,接受到了urgent包的呢?

man 7 tcp,中有如下一段:

TCP supports urgent data.  Urgent data is used to signal the receiver that some important message is part of the data stream and that it should be processed as soon as possible.
To send urgent data specify the MSG_OOB option to send(2).  When urgent data is received, the kernel sends a SIGURG signal to the process or process group that has been  set  as
the  socket  "owner" using the SIOCSPGRP or FIOSETOWN ioctls (or the POSIX.1-specified fcntl(2) F_SETOWN operation).  When the SO_OOBINLINE socket option is enabled, urgent data
is put into the normal data stream (a program can test for its location using the SIOCATMARK ioctl described below), otherwise it can be received only when the MSG_OOB  flag  is
set for recv(2) or recvmsg(2).
原文地址:https://www.cnblogs.com/hugetong/p/8398886.html