Easy question, how to use stdio.h
Ok, I'm just trying to understand how netfilter works, because after I would like to make my own match (it's an University task)
So I'm making some changes in an existent match, ipt_multiport.c concretely. And now I was trying to load in a file the source and the dest ports of the packets.
If you could tell me how can I do that (in the kernel space or in the user space, it's the same)
Thank you very much.
Juan.
----- Mensaje Original -----
De: Markus Schaber <[email protected]>
Fecha: Martes, Abril 22, 2003 7:05 pm
Asunto: Re: Easy question, how to use stdio.h
Quoted 33 lines
Hallo,
Quoted 7 lines · "[email protected]" <[email protected]> schrieb:
Maybe my question is very easy, but I'm new developing in Linux. I'm trying to use fopen, fprintf and fclose in a match, so I'm
writting #include <stdio.h>
but when I compile the kernel and I do
make modules
the system doesn't recognize any of these functions How can I use them???Basically, you can't.
As matches are kernel modules, they run in kernel space. They don't havethe usual application infrastructure (as it is the kernel's task to
provide the fundament of this infrastructure, and the libc's task to provide the rest.)Maybe you could tell us what you want to achieve, so we can possibly tell you how to do it.
Gruß,
MarkusSignature · 4 lines
Schabi's Flohmarkt: http://schabi.de/flohmarkt/ Der Dienstweg ist die Verbindung der Sackgasse mit dem Holzweg! [DoLi in unibwm.studium]
Quoted 2 lines
And now I was trying to load in a file the source and the dest ports of the packets.
I would do it this way:
while read sport dport; do
iptables -t whatever -A WHEREEVER \ -m TCP --sport $sport --dport $dport -j DOSOMETHING
done <inputfile
and variations thereof.
If you could indicate suitable values of whatever, WHEREEVER, TCP, and DOSOMETHING, we could maybe try to understand what task you have to solve. That may lead to suitable proposals on how to proceed.
Questions:
- do you really mean 'source AND dest ports'? That's what leads me to the above iptables command.
- when the file changes, what do you expect to happen?
best regards
Patrick
Hello,
Quoted 1 line · "[email protected]" <[email protected]> schrieb:
Ok, I'm just trying to understand how netfilter works
[...]
Quoted 2 lines
If you could tell me how can I do that (in the kernel space or in the user space, it's the same)
Maybe that you still have to learn some fundamental basics of how Linux (or Unix-Like OSes in general) work?
E. G. what user space and kernel space are, and where which parts of the os live?
If yes, you should do so.
Gruß,
Markus
Signature · 4 lines
Schabi's Flohmarkt: http://schabi.de/flohmarkt/ Der Dienstweg ist die Verbindung der Sackgasse mit dem Holzweg! [DoLi in unibwm.studium]