Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 Feb 2008 18:59:17 +0800
From:      MQ <antinvidia@gmail.com>
To:        freebsd-net@freebsd.org
Cc:        freebsd-jail@freebsd.org
Subject:   Some problems about network related prison_() functions
Message-ID:  <be0088ce0802030259i1b15c45bke51009d2b07c76f8@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi, everyone
I skimmed through the jail implementation in the kernel recently. Now, I
have some questions about the codes.

1. The flag parameter of both prison_ip() and prison_remote_ip() are not
used actually. All the calls to them pass 0 as the argument. From the codes,
I think these unused parameters should be used to indicate the byte order of
the ip parameter. However, no caller passes ip in host byte order. Now, I'm
thinking if we could remove this flag, and assume all the callers to these
two functions should pass ip in network byte order?

2. The pr_ip member in the prison structure is used to store an IPv4 address
in host byte order. This implementation requires a translation between host
byte order and network byte order on certain veriable before comparison or
assignment. To meet this requirement, some extra codes should be written,
and it also increased the running time of the system. So, I am considering
if storing an IP address in network byte order is possible. Though it may
break some userland utilities temporarily, I think this change will make the
codes more straightforward and clear.

Please let me know how you see my questions. Thanks.

By the way, I've heard that someone is making the improvements that allow
the jail to hold multiple IP addresses. Maybe you can take a look at my
suggestions? Thanks.

MQ



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