Some problems about network related prison_() functions

MQ antinvidia at gmail.com
Sun Feb 3 03:27:17 PST 2008


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


More information about the freebsd-jail mailing list