netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* L2 NAT
@ 2008-12-03 17:22 ivan
  2008-12-04  1:01 ` James King
  0 siblings, 1 reply; 5+ messages in thread
From: ivan @ 2008-12-03 17:22 UTC (permalink / raw)
  To: netfilter-devel

Hi,

After having a lot of help of Grant Taylor in order to analyze if I
was able to achieve my idea using the available iptables features, and
getting as result the fact that I had to develop my own kernel module.
I'm writing to this list because my question is related to the linux
kernel programing.

I would like to pass parameters to the kernel module in run time from
user space. These parameters could be IP address and MAC. Somebody
know how I can do this??

I was thinking about passing this parameters thorough a sysctl syscall
or using /proc filesystem, but I beleave that this is not the correct
way.

Also I was taking a look to iptables source code and analyzing the
source code of iptables and libiptc lib, but I could not find any clue
how to these ones change the kernel parameters.

Could you pleas help me???

thanks!

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

* Re: L2 NAT
  2008-12-03 17:22 L2 NAT ivan
@ 2008-12-04  1:01 ` James King
  2008-12-04 13:34   ` ivan
  0 siblings, 1 reply; 5+ messages in thread
From: James King @ 2008-12-04  1:01 UTC (permalink / raw)
  To: ivan; +Cc: netfilter-devel

On Wed, Dec 3, 2008 at 9:22 AM, ivan <lagigliaivan@gmail.com> wrote:
> I would like to pass parameters to the kernel module in run time from
> user space. These parameters could be IP address and MAC. Somebody
> know how I can do this??

Use the module_param functions (you probably want the string variant).
 See http://tldp.org/LDP/lkmpg/2.6/html/x323.html for examples.

> I was thinking about passing this parameters thorough a sysctl syscall
> or using /proc filesystem, but I beleave that this is not the correct
> way.

Depends on if you need to be able to modify it after the module has
already been loaded.  If not, a module parameter should suffice.


HTH,
James

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

* Re: L2 NAT
  2008-12-04  1:01 ` James King
@ 2008-12-04 13:34   ` ivan
  2008-12-04 14:38     ` John Haxby
  0 siblings, 1 reply; 5+ messages in thread
From: ivan @ 2008-12-04 13:34 UTC (permalink / raw)
  To: James King; +Cc: netfilter-devel

James,

Thanks for your soon reply!

I think that your answer is a good approach, but I would like to
pass/modify the module parameters while this one is running. I believe
this way allows to the user more flexibility to add/configure the
module behavior.

Please, let me know if you have any idea.

Thanks again.

ivan.




On Wed, Dec 3, 2008 at 11:01 PM, James King <t.james.king@gmail.com> wrote:
> On Wed, Dec 3, 2008 at 9:22 AM, ivan <lagigliaivan@gmail.com> wrote:
>> I would like to pass parameters to the kernel module in run time from
>> user space. These parameters could be IP address and MAC. Somebody
>> know how I can do this??
>
> Use the module_param functions (you probably want the string variant).
>  See http://tldp.org/LDP/lkmpg/2.6/html/x323.html for examples.
>
>> I was thinking about passing this parameters thorough a sysctl syscall
>> or using /proc filesystem, but I beleave that this is not the correct
>> way.
>
> Depends on if you need to be able to modify it after the module has
> already been loaded.  If not, a module parameter should suffice.
>
>
> HTH,
> James
>

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

* Re: L2 NAT
  2008-12-04 13:34   ` ivan
@ 2008-12-04 14:38     ` John Haxby
  2008-12-04 15:43       ` ivan
  0 siblings, 1 reply; 5+ messages in thread
From: John Haxby @ 2008-12-04 14:38 UTC (permalink / raw)
  To: ivan; +Cc: James King, netfilter-devel

ivan wrote:
> I think that your answer is a good approach, but I would like to
> pass/modify the module parameters while this one is running. I believe
> this way allows to the user more flexibility to add/configure the
> module behavior.
>   

You can do that with module parameters, they appears as files in 
/sys/module/<module-name>/parameters and, given the right permissions, 
you can modify them as you see fit.

jch

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

* Re: L2 NAT
  2008-12-04 14:38     ` John Haxby
@ 2008-12-04 15:43       ` ivan
  0 siblings, 0 replies; 5+ messages in thread
From: ivan @ 2008-12-04 15:43 UTC (permalink / raw)
  To: John Haxby; +Cc: James King, netfilter-devel

Thanks jch,

I will try doing this!
My module works changing the IP address of a package according to its
MAC address, so I would like to add diferents <MAC-IP> couples while
the module is running.

Thanks!!

On Thu, Dec 4, 2008 at 12:38 PM, John Haxby <john.haxby@oracle.com> wrote:
> ivan wrote:
>>
>> I think that your answer is a good approach, but I would like to
>> pass/modify the module parameters while this one is running. I believe
>> this way allows to the user more flexibility to add/configure the
>> module behavior.
>>
>
> You can do that with module parameters, they appears as files in
> /sys/module/<module-name>/parameters and, given the right permissions, you
> can modify them as you see fit.
>
> jch
>

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

end of thread, other threads:[~2008-12-04 15:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 17:22 L2 NAT ivan
2008-12-04  1:01 ` James King
2008-12-04 13:34   ` ivan
2008-12-04 14:38     ` John Haxby
2008-12-04 15:43       ` ivan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).