Commit Graph

31 Commits

Author SHA1 Message Date
Nicholas J. Kain
f1e20305ba Don't depend on external ncmlib. 2020-10-20 07:00:20 -04:00
Nicholas J. Kain
87ac82fa45 Add back project() for CMake. Corrects regression in c5a1edd5f6. 2020-10-19 04:28:06 -04:00
Nicholas J. Kain
c5a1edd5f6 Use more modern CMake syntax. 2018-10-26 13:07:05 -04:00
Nicholas J. Kain
e08d3b15b5 Remove seccomp support.
It breaks with the existing whitelists on the latest glibc and is
just too much maintenance burden.  It also causes the most questions
for new users.

Something like openbsd's pledge() would be fine, but I have no
intention of maintaining such a thing.

Most of the value-gain would come from disallowing high-risk
syscalls like ptrace() and the perf syscalls, anyway.

ndhc already uses extensive defense-in-depth and wasn't using
seccomp on non-(x86|x86-64) platforms, so it's not a huge loss.
2018-02-09 03:33:04 -05:00
Nicholas J. Kain
e8d97205e9 Compile cleanly with -Wsign-conversion.
I didn't notice anything that worried me.
2018-02-09 03:16:59 -05:00
Nicholas J. Kain
0732ed5f84 Disable GCC7 warning implicit-fallthrough and unused-const-variable 2017-05-13 13:14:35 -04:00
Nicholas J. Kain
bdad082a62 Remove -Wformat=2 -Wformat-nonliteral for C++. 2017-03-16 23:05:23 -04:00
Nicholas J. Kain
3633d55296 Enable -fno-strict-overflow just to be safer. 2017-03-16 21:59:55 -04:00
Nicholas J. Kain
3421f0c585 CMAKE_CROSSCOMPILE should be CMAKE_CROSSCOMPILING. 2015-02-13 05:12:55 -05:00
Nicholas J. Kain
9d8d653877 CMake: Do not try to test for the glibc version when cross-compiling. 2015-02-12 18:46:44 -05:00
Nicholas J. Kain
b792162113 Add CROSSCOMPILE_MACHINENAME environment variable for CMake that
will allow the host machine type detection to be skipped and
the target MACHINENAME to be manually defined.
2015-02-12 13:35:50 -05:00
Nicholas J. Kain
8e4ea0be72 CMake: Only add -lrt link dependency if glibc is detected. 2015-02-12 13:05:30 -05:00
Nicholas J. Kain
51033d3664 Detect the glibc version in CMake and link librt if it is required.
For the Makefile, unconditionally link librt with no detection.
2014-04-07 19:14:31 -04:00
Nicholas J. Kain
d267c2c44b Use the raw capability interface via updated ncmlib rather than linking
to libcap.
2014-04-07 15:05:34 -04:00
Nicholas J. Kain
b761889025 Move source from ndhc/ to src/ since ifchd is no longer a separate program. 2014-04-06 16:57:06 -04:00
Nicholas J. Kain
82d9682ed8 Update to latest ncmlib changes. 2014-03-30 17:02:48 -04:00
Nicholas J. Kain
abda60e0e9 Remove unused defines. 2014-03-28 11:17:52 -04:00
Nicholas J. Kain
22dcfc00ee Enable seccomp-filter if CMake detects that host is x86_64 or x86. 2014-03-21 23:52:15 -04:00
Nicholas J. Kain
b6444fa806 Don't strip the generated executables by default. 2014-03-14 20:49:03 -04:00
Nicholas J. Kain
84b36f0e02 Remove -Wcast-qual. The warnings are not useful on the ndhc code, and
I would effectively end up silencing them via the (uintptr_t) casting
hack.
2014-03-10 22:56:01 -04:00
Nicholas J. Kain
85fcc1e8f0 Use stricter gcc warning flags by default. 2014-03-10 18:34:53 -04:00
Nicholas J. Kain
1824802fb2 Merge ifchd into ndhc. Rather than function as entirely separate daemons,
ndhc will fork off an ifchd child that it will communicate with via
pipes rather than by connecting to a SO_PEERCRED AF_UNIX socket.

The advantages include:

1. Simpler configuration.  Much easier for users and packagers to set up.
2. Drastically less complex code for the ifch functionality.  More code
   is removed than added, and the result is a lot less complex.
3. Potentially better security.  The ifch can only service the parent
   ndhc process, and it is restricted to issuing modifications to
   the single interface that ndhc manages.
4. Less memory used on systems that allow overcommit.

The downsides:

1. Possibly more memory used on systems that run multiple ndhcs and use
   strict commit limits.

At the same time, use netlink rather than ioctls so that the
interface ip, subnet, and broadcast address can be set simultaneously.
This change reduces the netlink notification spam greatly.

The current code builds but isn't yet complete.  Subsequent commits will
flesh things out and polish out some remaining issues.
2014-03-10 00:52:56 -04:00
Nicholas J. Kain
c3c76e48d5 Enable stricter warnings on format strings. 2012-04-03 10:04:47 -04:00
Nicholas J. Kain
ab4a2e0b97 Switch to using clock_gettime() rather than gettimeofday(). 2011-07-31 01:27:59 -04:00
Nicholas J. Kain
7e1e902b34 Share ifchd command defines between ifchd and ndhc. 2011-07-25 02:01:38 -04:00
Nicholas J. Kain
2aff36a274 Provide a gmake Makefile for distro builds and packagers.
Define _GNU_SOURCE in the CFLAGS.
Update the README.
Remove the duplicate Gentoo init script ndhc.sh that is in the root.
Remove DESIGN -- it's outdated.
2011-07-12 04:09:05 -04:00
Nicholas J. Kain
01c4731403 Make sure that the netlink socket will never block after program
initialization.  Fetching if/address/index/mac mappings is done only once at
program init, so it is done synchronously as an exception to this rule.

Rewrite the netlink handling.  Now uses NIH code that should be safe, small,
and correct.  No external deps FTW.
2011-07-03 17:30:55 -04:00
Nicholas J. Kain
17570e9a38 Rewrite the netlink handling code to use libmnl. The size cost is very small,
and it is hard to do netlink completely correctly as it is poorly documented.
2011-07-02 01:34:50 -04:00
Nicholas J. Kain
b882669f85 Convert to using shared ncmlib. 2010-11-12 05:42:07 -05:00
Nicholas J. Kain
b42eeb8847 Move ifchd files to a subdirectory. 2010-11-12 04:51:49 -05:00
Nicholas J. Kain
c999fee9f5 Initial CMake support.
Fix an off-by-one array initialization.
Clean up VERSION a bit.
2010-11-12 04:44:25 -05:00