Page MenuHomeFreeBSD

Prepare for network stack as a module: Move protocol-specific functionality out of common jail-related source files.
ClosedPublic

Authored by stevek on Jun 10 2016, 1:47 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 12, 12:31 AM
Unknown Object (File)
Fri, May 3, 3:22 PM
Unknown Object (File)
Thu, May 2, 12:20 PM
Unknown Object (File)
Wed, May 1, 11:08 PM
Unknown Object (File)
Feb 21 2024, 5:27 AM
Unknown Object (File)
Dec 29 2023, 6:39 AM
Unknown Object (File)
Dec 22 2023, 10:01 PM
Unknown Object (File)
Nov 6 2023, 2:46 PM

Details

Summary

Network stack as a module: Move protocol-specific functionality out of common jail-related source files.

Move IPv4-specific jail functions to new file netinet/in_jail.c
_prison_check_ip4 renamed to prison_check_ip4_locked

Move IPv6-specific jail functions to new file netinet6/in6_jail.c
_prison_check_ip6 renamed to prison_check_ip6_locked

Add appropriate prototypes to sys/sys/jail.h

Adjust kern_jail.c to call prison_check_ip4_locked and prison_check_ip6_locked accordingly.

Add netinet/in_jail.c and netinet6/in6_jail.c to the list of files that need to be built when INET and INET6, respectively, are configured in the kernel configuration file.

Note: this is only the first step, more needs to be done to separate the protocol-specific data from jail structures, handle configuration, etc.

Obtained from: Juniper Networks, Inc.

Test Plan

Built LINT and LINT-NOIP kernels.
Booted kernel for amd64 in VM and arm on RPI2.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

stevek retitled this revision from to Prepare for network stack as a module: Move protocol-specific functionality out of common jail-related source files..
stevek updated this object.
stevek edited the test plan for this revision. (Show Details)
stevek added a reviewer: gnn.
stevek set the repository for this revision to rS FreeBSD src repository - subversion.
stevek added subscribers: transport, jtl, sjg.
stevek updated this object.

See comments. After those changes are made, it looks like it should be OK. But, I'd prefer a second set of eyes...

sys/netinet6/in6_jail.c
147 ↗(On Diff #17494)

should be pr_ip6s?

sys/sys/jail.h
395 ↗(On Diff #17494)

Please be consistent in using (or not using) parameter names. I think style(9) says you should include parameter names in kernel-only prototypes.

Updated with changes to netinet6/in6_jail.c and sys/jail.h as commented by jtl

jtl added a reviewer: jtl.

Looks good to me. Thanks!

This revision is now accepted and ready to land.Jul 15 2016, 4:31 PM

If there any additional reviews, please submit them this weekend. Unless I hear more comments, I plan to commit this by the end of Monday.

I'd suggest avoiding any style changes in the initial copy of code to the new locations, so diffs can more easily be checked, and changes can be more easily merged. Apply style/comment/etc changes in a separate commit.

I'd suggest avoiding any style changes in the initial copy of code to the new locations, so diffs can more easily be checked, and changes can be more easily merged. Apply style/comment/etc changes in a separate commit.

Sure, makes sense.

sys/netinet6/in6_jail.c
147 ↗(On Diff #17494)

Yes, it should be, I'll fix.

stevek edited edge metadata.
stevek updated this object.

Update in_jail.c and in6_jail.c to not contain formatting changes.

Updated diff to have in_jail.c and in6_jail.c use the code moved from
kern_jail.c without formatting changes, per rwatson's suggestion.

  1. Updating D6799: Prepare for network stack as a module: Move protocol-specific functionality out of common jail-related source files.
This revision now requires review to proceed.Jul 20 2016, 2:46 PM
This revision was automatically updated to reflect the committed changes.