kernel

How to access IP_DF and IP_MF from iph->frag_offset when using netfilter

元气小坏坏 提交于 2020-12-13 07:19:58
问题 I am trying to write a netfilter module and want to access the fields of the IPHeader that denotes the DF and MF fields. I can access most other fields as desired but I think I have to extract the DF and MF fields from the ipheader in the struct and manipulate them say for example I want to set or unset the DF bit depending on the type of packet I receive. The below structure has 'frag_off' how do I access/rewrite IP_DF and IP_MF from this? struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD)

How to access IP_DF and IP_MF from iph->frag_offset when using netfilter

谁说我不能喝 提交于 2020-12-13 07:18:13
问题 I am trying to write a netfilter module and want to access the fields of the IPHeader that denotes the DF and MF fields. I can access most other fields as desired but I think I have to extract the DF and MF fields from the ipheader in the struct and manipulate them say for example I want to set or unset the DF bit depending on the type of packet I receive. The below structure has 'frag_off' how do I access/rewrite IP_DF and IP_MF from this? struct iphdr { #if defined(__LITTLE_ENDIAN_BITFIELD)

Where is eax in the pt_regs struct? Only ax is present

余生颓废 提交于 2020-12-01 10:20:08
问题 I am trying to use the pt_regs struct to get and set registers such as eax , but compilation errors tell me that pt_regs has no such member eax . However, I am able to get the ax register. Can anybody tell me what is happening? I am using 32-bit Ubuntu linux with the 3.0.0 kernel. Thank you again. 回答1: Take a look at the definition of struct pt_regs in arch/x86/include/asm/ptrace.h. Notice #ifndef __KERNEL__ stuff there, it means that the definition of that structure is different for kernel