Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2010 23:36:06 +0200
From:      "Bartosz Marcin Kojak" <bartek@6bone.be>
To:        freebsd-hackers@freebsd.org
Subject:   inet_* functions in kernel?
Message-ID:  <op.vfq2agwbwe5x3k@brtk-mob>

next in thread | raw e-mail | index | archive | help

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



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