我想更改linux内核代码以过滤一些tcp数据包并丢弃它。
但我总是一次又一次地收到它。下面是我的代码
/net/ipv4/tcp_ipv4.c
int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
{
// my code start
struct iphdr *iph;
iph = skb->nh.iph;
if(iph->ttl > 64) // I want to drop all tcp packet that meet this requirement
{
return 0;
}
// my cod
我在c++代码中使用基于http的文件上传(运行在linux/android上)。我使用异步tcp套接字写入文件数据。我的问题是,我的进度条反映了已写入套接字的内容,而不是实际发送到电线上的内容。慢链接的问题变得明显,在100%发送进度通知和发送完整消息之间需要几十秒(有时超过一分钟)。
我不修改SO_SNDBUF,在我的例子中它是35 by (由getsockopt查询)。如何修正进度通知以正确反映当前的传输状态?是否有一种方法来查询仍然保留在缓冲区中的数据的大小?是否有办法获得传输进度的TCP通知(由远程套接字确认)?
我在我的fedora核心5中运行了一个程序(链接是- )。在编译时,我得到了以下错误:
[root@localhost ~]# gcc sniffer_eth_ip_tcp.c
In file included from sniffer_eth_ip_tcp.c:12: /usr/include/linux/ip.h:97: error: expected specifier-qualifier-list before ‘uint8_t’
In file included from /usr/include/linux/tcp.h:21,
f