- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我写了一个程序来测试原始套接字sento功能,我发现当我写一个校验和错误的tcp消息时,我在wireshark中观察到一个正确的校验和,以下是我的程序:
int main()
{
int sock_raw_fd,len;
struct sockaddr_ll sll;
struct ifreq ethreq;
strncpy (ethreq.ifr_name, "eth0", (sizeof(ethreq.ifr_name) - 1));
ethreq.ifr_name[sizeof(ethreq.ifr_name)-1] = '\0';
sock_raw_fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if(sock_raw_fd < 0){
perror("socket");
exit(1);
}
if(-1 == ioctl(sock_raw_fd, SIOCGIFINDEX, ðreq)){
perror("ioctl");
close(sock_raw_fd);
exit(1);
}
bzero(&sll, sizeof(sll));
sll.sll_ifindex = ethreq.ifr_ifindex;
unsigned char buf[size] = {0xF0,0xDE,0xF1,0x06,0x71,0x3A,0x00,0xE0,0x66,0xE2,0xEA,0xC0,0x08,0x00,0x45,0x00,0x05,0xDC,0x2B,0x5E,0x40,0x00,0x40,0x06,0x85,0xE9,0xC0,0xA8,0x01,0x0A,0xC0,0xA8,0x01,0x7A,0x09,0x79,0xD8,0xB7,0x27,0x6C,0x4C,0x2C,0xF5,0x9C,0xAB,0xC9,0x50,0x10,0x01,0x00,0xAB,0xC9,0x00,0x00,0x7C,0xC8,0xE8,0x89,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFF,0xFF,0xFE,0xFF,0xFF,0xFF,0xFD,0xFF,0xFD,0xFE,0xFF,0xFE,0xFE,0xFE,0xFE,0xFE,0xFD,0xFE,0xFF,0xFD,0xFE,0xFF,0xFF,0xFC,0xFF,0xFF,0xFD,0xFF,0xFE,0xFE,0xFF,0xFD,0xFE,0xFF,0xFE,0xFC,0xFE,0xFE,0xFD,0xFE,0xFE,0xFD,0xFF,0xFE,0xFC,0xFD,0xF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,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4C,0x56,0x85,0x4A,0x57,0x85,0x4A,0x57,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0x56,0x85,0x4E,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2,0xF2, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
len = sendto(sock_raw_fd, &buf[0], size, 0, (struct sockaddr*)&sll, sizeof(sll));
printf("send succeed: %d bytes\n",len);
return 0;
}
我发送的校验和是ABC9但我在 wireshark 中收到的这条消息是 wireshark message
校验和是 DEEA,它是正确的,我想看看校验和是 ABC9 但不正确,但我不知道如何设置原始套接字不要更改我的校验和。
谢谢!
最佳答案
我假设 wireshark 转储来自接收机器,而不是来自发送方,这可能是由于您的网卡正在执行校验和卸载。您可以使用 ethtool 禁用该行为:
ethtool -K eth0 tx-checksum-ipv4 off
ethtool -K eth0 tx-checksum-ip-generic off
您现在可以检查您的设置是否正确
ethtool -k eth0
关于c - 为什么原始套接字改变了我的 TCP 校验和,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41390782/
我正在维护一些 Java 代码,我目前正在将它们转换为 C#。 Java 代码是这样做的: sendString(somedata + '\000'); 在 C# 中,我正在尝试做同样的事情: sen
如何确定函数中传递的参数是字符串还是字符(不确定如何正确调用它)文字? 我的函数(不正确): void check(const char* str) { // some code here }
我真的不知道如何准确地提出这个问题,但我希望标题已经说明了这一点。 我正在寻找一种方法(一个框架/库),它提供了执行 String.contains() 函数的能力,该函数告诉我给定的字符串是否与搜索
我正在尝试编写一些读取 Lambda 表达式并输出 beta 缩减版本的东西。 Lambda 的类型如下:\variable -> expression,应用程序的形式为 (表达式) (表达式)。因此
StackOverflow 上的第 1 篇文章,如果我没能把它做好,我深表歉意。我陷入了一个愚蠢的练习,我需要制作一个“刽子手游戏”,我尝试从“.txt”文件中读取单词,然后我得到了我的加密函数,它将
我想在 Groovy 中测试我的 Java 自定义注释,但由于字符问题而未能成功。 Groovyc: Expected 'a' to be an inline constant of type cha
当我尝试在单击按钮期间运行 javascript location.href 时,出现以下错误“字 rune 字中的字符过多”。 最佳答案 这应该使用 OnClientClick相反? 您可能还想停
我想要类似的东西: let a = ["v".utf8[0], 1, 2] 我想到的最接近的是: let a = [0x76, 1, 2] 和 "v".data(using: String.Encod
有没有办法在 MySQL 中指定 Unicode 字 rune 字? 我想用 Ascii 字符替换 Unicode 字符,如下所示: Update MyTbl Set MyFld = Replace(
阅读 PNG 规范后,我有点惊讶。我读过字 rune 字应该用像 0x41 这样的二进制值进行硬编码,而不是在(程序员友好的)'A' 中。问题似乎是在具有不同底层字符集的不同系统上编译期间字 rune
考虑一个具有 UTF-8 执行字符集的 C++11 编译器(并且符合要求 char 类型为有符号 8 位字节的 x86-64 ABI) . 字母 Ä(元音变音)具有 0xC4 的 unicode 代码
为什么即使有 UTF-8 字符串文字,C11 或 C++11 中也没有 UTF-8 字 rune 字?我知道,一般来说,字 rune 字表示单个 ASCII 字符,它与单字节 UTF-8 代码点相同,
我怎样才能用 Jade 做到这一点? how would I do this 我几乎可以做任何事情,除了引入一个 span 中间句子。 最佳答案 h3.blur. how would I do t
这似乎是一个非常简单的问题,但我只是想澄清我的疑问。我正在查看其他开发人员编写的代码。有一些涉及 float 的计算。 示例:Float fNotAvlbl = new Float(-99); 他为什
我想知道第 3 行“if dec:”中的“dec”是什么意思 1 def dec2bin(dec): 2 result='' 3 if dec:
我试图在字符串中查找不包含任何“a”字符的单词。我写了下面的代码,但它不起作用。我怎么能对正则表达式说“不包括”?我不能用“^”符号表示“不是”吗? import re string2 = "asfd
这个问题在这里已经有了答案: Is floating point math broken? (31 个答案) Is floating point arbitrary precision availa
我正在创建一个时尚的文本应用程序,但在某些地方出现错误(“字 rune 字中的字符太多”)。我只写了一个字母,但是当我粘贴它时,它会转换成许多这样的字母:“\uD83C\uDD89”,原始字母是“🆉
我正在尝试检查用户是否在文本框中输入了一个数字值,是否接受了小数位。非常感谢任何帮助。 Private Sub textbox1_AfterUpdate() If IsNumeric(textbox1
我知道一个 Byte 是 8 位,但其他的代表什么?我正在参加一个使用摩托罗拉 68k 架构的汇编类(class),我对目前的词汇感到困惑。 最佳答案 如 operator's manual for
我是一名优秀的程序员,十分优秀!