From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 12 21:59:15 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EFD21065677 for ; Mon, 12 Jul 2010 21:59:15 +0000 (UTC) (envelope-from bartek@6bone.be) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9CB988FC18 for ; Mon, 12 Jul 2010 21:59:14 +0000 (UTC) Received: by bwz12 with SMTP id 12so3214180bwz.13 for ; Mon, 12 Jul 2010 14:59:13 -0700 (PDT) Received: by 10.204.82.130 with SMTP id b2mr10920575bkl.12.1278970569344; Mon, 12 Jul 2010 14:36:09 -0700 (PDT) Received: from brtk-mob (91-145-140-249.internetia.net.pl [91.145.140.249]) by mx.google.com with ESMTPS id bq20sm20338155bkb.4.2010.07.12.14.36.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 12 Jul 2010 14:36:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: freebsd-hackers@freebsd.org Date: Mon, 12 Jul 2010 23:36:06 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: "Bartosz Marcin Kojak" Message-ID: User-Agent: Opera Mail/10.60 (Win32) Subject: inet_* functions in kernel? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2010 21:59:15 -0000 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 ) but it's no able to compile module with inet_* functions using typical Makefile (this one with ".include " 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