Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2010 18:26:10 -0400
From:      Boris Kochergin <spawk@acm.poly.edu>
To:        Bartosz Marcin Kojak <bartek@6bone.be>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: inet_* functions in kernel?
Message-ID:  <4C3B9682.2040309@acm.poly.edu>
In-Reply-To: <op.vfq2agwbwe5x3k@brtk-mob>
References:  <op.vfq2agwbwe5x3k@brtk-mob>

next in thread | previous in thread | raw e-mail | index | archive | help
Bartosz Marcin Kojak wrote:
>
> Hi.
>
> Currently I'm writing a kernel module using MAC Framework to control 
> binding to local IP addresses (kind of mac_portacl variation) and I 
> need some advice.
>
> I want to be able to write rules for module through sysctl (rule will 
> contain IP addresses in human-readable format, e.g. 
> "uid:1002:192.168.2.3") and I'm wondering how to translate addresses 
> to network byte order without inet_* functions.  Well, they look like 
> they're available to use in kernel (using <netinet/in.h>) but it's no 
> able to compile module with inet_* functions using typical Makefile 
> (this one with ".include <bsd.kmod.mk>" line) - it just produces 
> warnings, and all warnings are treated as errors in this case.
>
> So, possible solutions are: just add custom CFLAGS without "-Werror" 
> to Makefile (but it's quite ugly though) or write an userspace 
> application that will write an addresses in NBO to sysctl (but now 
> sysctl won't be easy to read and modify by hand).
>
> What do you think?
>
> Thanks in advance for any useful hints.
>
Check out the byteorder(9) man page.

-Boris



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C3B9682.2040309>