All of lore.kernel.org
 help / color / mirror / Atom feed
* Easy question, how to use stdio.h
@ 2003-04-22 16:15 ISLERO77
  2003-04-22 17:05 ` Markus Schaber
  2003-04-22 17:14 ` Patrick Schaaf
  0 siblings, 2 replies; 7+ messages in thread
From: ISLERO77 @ 2003-04-22 16:15 UTC (permalink / raw)
  To: netfilter-devel


Hello:  
  
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???  
  
Thank you very much.  
 
Juan. 
  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
  2003-04-22 16:15 ISLERO77
@ 2003-04-22 17:05 ` Markus Schaber
  2003-04-22 17:14 ` Patrick Schaaf
  1 sibling, 0 replies; 7+ messages in thread
From: Markus Schaber @ 2003-04-22 17:05 UTC (permalink / raw)
  To: ISLERO77@telefonica.net; +Cc: netfilter-devel

Hallo,

"ISLERO77@telefonica.net" <ISLERO77@telefonica.net> 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 have
the 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ß,
Markus

-- 
Schabi's Flohmarkt: http://schabi.de/flohmarkt/

Der Dienstweg ist die Verbindung der Sackgasse mit dem Holzweg!
[DoLi in unibwm.studium]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
  2003-04-22 16:15 ISLERO77
  2003-04-22 17:05 ` Markus Schaber
@ 2003-04-22 17:14 ` Patrick Schaaf
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick Schaaf @ 2003-04-22 17:14 UTC (permalink / raw)
  To: ISLERO77@telefonica.net; +Cc: netfilter-devel

> I'm trying to use fopen, fprintf and fclose in a match
> How can I use them???  

You can't. The kernel does not support the userlevel C library.
Note that this is not a mailing list for learning about how to
program the kernel.

best regards
  Patrick

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
@ 2003-04-22 17:14 ISLERO77
  0 siblings, 0 replies; 7+ messages in thread
From: ISLERO77 @ 2003-04-22 17:14 UTC (permalink / raw)
  To: Evrim ULU, netfilter-devel


Thanks!! 
 
Just another question, I have seen the libipt_multiport.so file (it's the match 
that I'm changing) but I haven't seen any libipt_multiport.c file where I could 
modify to use stdio.h. 
 
How can I modify the multiport match in the user space? 
 
Thanks again 
 
	Juan 
 
----- Mensaje Original ----- 
De: Evrim ULU <evrim@core.gen.tr> 
Fecha: Martes, Abril 22, 2003 8:18 pm 
Asunto: Re: Easy question, how to use stdio.h 
 
> -----BEGIN PGP SIGNED MESSAGE----- 
> Hash: SHA1 
>  
> ISLERO77@telefonica.net wrote: 
>  
> |Hello:   
> |   
> |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???   
>  
> stdio.h includes glibc functions which are user space  
> implementations.  
> You cannot use them in kernel space. However, some are implemented  
> in  
> kernel space seperately like strncat, strncpy. See kernel headers  
> for  
> more detail. 
>  
> For more information about userspace/kernelspace, see kernelnewbies  
> mailing list. 
>  
> Evrim. 
>  
> | 
> -----BEGIN PGP SIGNATURE----- 
> Version: GnuPG v1.2.1 (GNU/Linux) 
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org 
>  
> iD8DBQE+pYd66+aEfy4lqIARAsOqR+I+Z9+ffKLcV0HhBQjoI= 
> =0m/J 
> -----END PGP SIGNATURE----- 
>  
>  
>  

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
@ 2003-04-22 17:27 ISLERO77
  2003-04-22 18:26 ` Patrick Schaaf
  2003-04-22 22:33 ` Markus Schaber
  0 siblings, 2 replies; 7+ messages in thread
From: ISLERO77 @ 2003-04-22 17:27 UTC (permalink / raw)
  To: Markus Schaber; +Cc: netfilter-devel


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 <markus.schaber@student.uni-ulm.de>  
Fecha: Martes, Abril 22, 2003 7:05 pm  
Asunto: Re: Easy question, how to use stdio.h  
  
> Hallo,  
>   
> "ISLERO77@telefonica.net" <ISLERO77@telefonica.net> 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ß,  
> Markus  
>   
> --   
> Schabi's Flohmarkt: http://schabi.de/flohmarkt/  
>   
> Der Dienstweg ist die Verbindung der Sackgasse mit dem Holzweg!  
> [DoLi in unibwm.studium]  
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
  2003-04-22 17:27 Easy question, how to use stdio.h ISLERO77
@ 2003-04-22 18:26 ` Patrick Schaaf
  2003-04-22 22:33 ` Markus Schaber
  1 sibling, 0 replies; 7+ messages in thread
From: Patrick Schaaf @ 2003-04-22 18:26 UTC (permalink / raw)
  To: ISLERO77@telefonica.net; +Cc: netfilter-devel

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Easy question, how to use stdio.h
  2003-04-22 17:27 Easy question, how to use stdio.h ISLERO77
  2003-04-22 18:26 ` Patrick Schaaf
@ 2003-04-22 22:33 ` Markus Schaber
  1 sibling, 0 replies; 7+ messages in thread
From: Markus Schaber @ 2003-04-22 22:33 UTC (permalink / raw)
  To: ISLERO77@telefonica.net; +Cc: netfilter-devel

Hello,

"ISLERO77@telefonica.net" <ISLERO77@telefonica.net> schrieb:

> Ok, I'm just trying to understand how netfilter works
[...]
> 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

-- 
Schabi's Flohmarkt: http://schabi.de/flohmarkt/

Der Dienstweg ist die Verbindung der Sackgasse mit dem Holzweg!
[DoLi in unibwm.studium]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-04-22 22:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-22 17:27 Easy question, how to use stdio.h ISLERO77
2003-04-22 18:26 ` Patrick Schaaf
2003-04-22 22:33 ` Markus Schaber
  -- strict thread matches above, loose matches on Subject: below --
2003-04-22 17:14 ISLERO77
2003-04-22 16:15 ISLERO77
2003-04-22 17:05 ` Markus Schaber
2003-04-22 17:14 ` Patrick Schaaf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.