inet_* functions in kernel?

Bartosz Marcin Kojak bartek at 6bone.be
Mon Jul 12 21:59:15 UTC 2010


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.

-- 
SIGSTOP


More information about the freebsd-hackers mailing list