* Modify the sock Structure!!
@ 2006-03-25 7:11 Benjamin
2006-03-25 18:39 ` Jan Engelhardt
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin @ 2006-03-25 7:11 UTC (permalink / raw)
To: linux-kernel
Hello! I try to modify the sock Structure in sock.h in order to record
some data!
I just add a unsigned short in the end of the structure. such as:
struct sock {
/* Socket demultiplex comparisons on incoming packets. */
__u32 daddr; /* Foreign IPv4 addr */
__u32 rcv_saddr; /* Bound local IPv4 addr */
...................................................................
....................................................................
void (*destruct)(struct sock *sk);
unsigned short data; /*I put the unsigned short
here*/
};
I re-complied the kernel. The kernel and network functions work
normally so far.
However, I am a new guy for the kernel programming. I just wonder this
modification is
safe or not. Is there any side-effect? Or I need to add additional code
to avoid some unexpected
situation? Thank you very much!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Modify the sock Structure!!
2006-03-25 7:11 Modify the sock Structure!! Benjamin
@ 2006-03-25 18:39 ` Jan Engelhardt
2006-03-25 19:05 ` Benjamin
0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2006-03-25 18:39 UTC (permalink / raw)
To: Benjamin; +Cc: linux-kernel
> Hello! I try to modify the sock Structure in sock.h in order to record some
> data!
> I just add a unsigned short in the end of the structure. such as:
>
> struct sock {
> safe or not. Is there any side-effect? Or I need to add additional code to
> avoid some unexpected
> situation? Thank you very much!
Should be ok. For example, ipt_TPROXY/ipt_tproxy also adds something to
struct sock (including enlarging fields in the middle of the struct);
I have not experienced any problem with it.
Jan Engelhardt
--
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Modify the sock Structure!!
2006-03-25 18:39 ` Jan Engelhardt
@ 2006-03-25 19:05 ` Benjamin
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin @ 2006-03-25 19:05 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: linux-kernel
Cool! Thanks for the answer!
Best Regards,
Benjamin Chu
Jan Engelhardt wrote:
>> Hello! I try to modify the sock Structure in sock.h in order to record some
>> data!
>> I just add a unsigned short in the end of the structure. such as:
>>
>> struct sock {
>>
>
>
>> safe or not. Is there any side-effect? Or I need to add additional code to
>> avoid some unexpected
>> situation? Thank you very much!
>>
>
>
> Should be ok. For example, ipt_TPROXY/ipt_tproxy also adds something to
> struct sock (including enlarging fields in the middle of the struct);
> I have not experienced any problem with it.
>
>
> Jan Engelhardt
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-03-25 19:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-25 7:11 Modify the sock Structure!! Benjamin
2006-03-25 18:39 ` Jan Engelhardt
2006-03-25 19:05 ` Benjamin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox