--- /dev/null
+*
+!/.gitignore
--- /dev/null
+// rabit_noop.c — Rabit no-op netfilter interposer (Debian 12/Bookworm)
+// Build: out-of-tree module. Load/unload to verify hook coverage.
+// Behavior: increments counters, returns NF_ACCEPT. No packet mutation.
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <linux/skbuff.h>
+#include <linux/atomic.h>
+#include <linux/netdevice.h>
+#include <linux/netfilter.h>
+#include <linux/netfilter_ipv4.h>
+#include <linux/netfilter_ipv6.h>
+
+static atomic64_t cnt_v4_local_out = ATOMIC_LONG_INIT(0);
+static atomic64_t cnt_v4_postroute = ATOMIC_LONG_INIT(0);
+static atomic64_t cnt_v6_local_out = ATOMIC_LONG_INIT(0);
+static atomic64_t cnt_v6_postroute = ATOMIC_LONG_INIT(0);
+
+static unsigned int rabit_v4_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) {
+ if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v4_local_out);
+ else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v4_postroute);
+ return NF_ACCEPT;
+}
+
+static unsigned int rabit_v6_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) {
+ if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v6_local_out);
+ else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v6_postroute);
+ return NF_ACCEPT;
+}
+
+static struct nf_hook_ops rabit_ops[] = {
+ { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_FIRST },
+ { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP_PRI_FIRST },
+ { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_FIRST },
+ { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP6_PRI_FIRST },
+};
+
+static int __init rabit_init(void) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0)
+ int ret = nf_register_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops));
+#else
+ int ret = nf_register_hooks(rabit_ops, ARRAY_SIZE(rabit_ops));
+#endif
+ if (ret)
+ pr_err("rabit_noop: nf_register_* failed: %d\n", ret);
+ else
+ pr_info("rabit_noop: loaded (no-op)\n");
+ return ret;
+}
+
+static void __exit rabit_exit(void) {
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0)
+ nf_unregister_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops));
+#else
+ nf_unregister_hooks(rabit_ops, ARRAY_SIZE(rabit_ops));
+#endif
+ pr_info("rabit_noop: unload stats v4(lo=%lld,po=%lld) v6(lo=%lld,po=%lld)\n",
+ (long long)atomic64_read(&cnt_v4_local_out),
+ (long long)atomic64_read(&cnt_v4_postroute),
+ (long long)atomic64_read(&cnt_v6_local_out),
+ (long long)atomic64_read(&cnt_v6_postroute));
+}
+
+module_init(rabit_init);
+module_exit(rabit_exit);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Rabit");
+MODULE_DESCRIPTION("Rabit no-op netfilter interposer");
+++ /dev/null
-// rabit_noop.c — Rabit no-op netfilter interposer (Debian 12/Bookworm)
-// Build: out-of-tree module. Load/unload to verify hook coverage.
-// Behavior: increments counters, returns NF_ACCEPT. No packet mutation.
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <linux/skbuff.h>
-#include <linux/atomic.h>
-#include <linux/netdevice.h>
-#include <linux/netfilter.h>
-#include <linux/netfilter_ipv4.h>
-#include <linux/netfilter_ipv6.h>
-
-static atomic64_t cnt_v4_local_out = ATOMIC_LONG_INIT(0);
-static atomic64_t cnt_v4_postroute = ATOMIC_LONG_INIT(0);
-static atomic64_t cnt_v6_local_out = ATOMIC_LONG_INIT(0);
-static atomic64_t cnt_v6_postroute = ATOMIC_LONG_INIT(0);
-
-static unsigned int rabit_v4_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) {
- if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v4_local_out);
- else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v4_postroute);
- return NF_ACCEPT;
-}
-
-static unsigned int rabit_v6_hook(void *priv, struct sk_buff *skb, const struct nf_hook_state *st) {
- if (st->hook == NF_INET_LOCAL_OUT) atomic64_inc(&cnt_v6_local_out);
- else if (st->hook == NF_INET_POST_ROUTING) atomic64_inc(&cnt_v6_postroute);
- return NF_ACCEPT;
-}
-
-static struct nf_hook_ops rabit_ops[] = {
- { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP_PRI_FIRST },
- { .hook = rabit_v4_hook, .pf = NFPROTO_IPV4, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP_PRI_FIRST },
- { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_LOCAL_OUT, .priority = NF_IP6_PRI_FIRST },
- { .hook = rabit_v6_hook, .pf = NFPROTO_IPV6, .hooknum = NF_INET_POST_ROUTING,.priority = NF_IP6_PRI_FIRST },
-};
-
-static int __init rabit_init(void) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0)
- int ret = nf_register_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops));
-#else
- int ret = nf_register_hooks(rabit_ops, ARRAY_SIZE(rabit_ops));
-#endif
- if (ret)
- pr_err("rabit_noop: nf_register_* failed: %d\n", ret);
- else
- pr_info("rabit_noop: loaded (no-op)\n");
- return ret;
-}
-
-static void __exit rabit_exit(void) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,3,0)
- nf_unregister_net_hooks(&init_net, rabit_ops, ARRAY_SIZE(rabit_ops));
-#else
- nf_unregister_hooks(rabit_ops, ARRAY_SIZE(rabit_ops));
-#endif
- pr_info("rabit_noop: unload stats v4(lo=%lld,po=%lld) v6(lo=%lld,po=%lld)\n",
- (long long)atomic64_read(&cnt_v4_local_out),
- (long long)atomic64_read(&cnt_v4_postroute),
- (long long)atomic64_read(&cnt_v6_local_out),
- (long long)atomic64_read(&cnt_v6_postroute));
-}
-
-module_init(rabit_init);
-module_exit(rabit_exit);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Rabit");
-MODULE_DESCRIPTION("Rabit no-op netfilter interposer");
+++ /dev/null
-scratchpad/no-op.lib.o: cc/no-op.lib.c \
- /home/Thomas/subu_data/developer/project/Linux/Rabbit/tool_shared/third_party/RT-project-share/release/make/RT_0.h
-scratchpad/hello.cli.o: cc/hello.cli.c \
- /home/Thomas/subu_data/developer/project/Linux/Rabbit/tool_shared/third_party/RT-project-share/release/make/RT_0.h
-
-machine/hello : scratchpad/hello.cli.o scratchpad/libRabbit.a
- gcc -o machine/hello scratchpad/hello.cli.o -Lscratchpad -L/lib64 -L/lib -lRabbit
+.SUFFIXES:
# developer/tool/makefile — Orchestrator (Hybrid)
-ifndef REPO_HOME
- $(error REPO_HOME is not set; source your project env (tool_shared/bespoke/env) first)
-endif
-
RT_INCOMMON := $(REPO_HOME)/tool_shared/third_party/RT-project-share/release
include $(RT_INCOMMON)/make/environment_RT_1.mk
-.PHONY: all usage lib_cli kmod clean check-pwd
-all: lib_cli kmod
-
+.PHONY: usage
usage:
- @printf "Usage: make [usage|lib_cli|kmod|clean|check-pwd]\n"; exit 2
-
-# Build user-space static lib + CLI (cli target builds lib first)
-lib_cli:
+ @printf "Usage: make [usage|information|all|lib|cli|kmod|clean]\n"; exit 2
+
+.PHONY: version
+version:
+ @echo tool/makefile version 2.0
+ @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk version
+ @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk version
+
+.PHONY: information
+information:
+ @printf "local ----------------------------------------\n"
+ -@echo CURDIR='$(CURDIR)'
+ @echo REPO_HOME="$(REPO_HOME)"
+ @echo KMOD_BUILD_DIR="/lib/modules/$(shell uname -r)/build"
+ @echo CURDIR="$(CURDIR)"
+ @printf "target_lib_cli.mk ----------------------------------------\n"
+ @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk information
+ @printf "target_kmod.mk ----------------------------------------\n"
+ @$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk information
+
+.PHONY: all
+all: lib cli kmod
+
+.PHONY: lib
+lib:
+ @$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk lib
+
+.PHONY: cli
+cli:
@$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk cli
-# Build all kernel modules
+.PHONY: kmod
kmod:
@$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk kmod
+.PHONY: clean
clean:
@$(MAKE) -f $(RT_INCOMMON)/make/target_lib_cli.mk clean
@$(MAKE) -f $(RT_INCOMMON)/make/target_kmod.mk clean
-check-pwd:
- @if [ "$(CURDIR)" != "$(REPO_HOME)/developer" ]; then \
- printf "warn: CURDIR=%s (expected %s)\n" "$(CURDIR)" "$(REPO_HOME)/developer"; \
- fi
+