diff mbox series

[bug#67017,v2] gnu: Add iptables-nft.

Message ID c71870c7300ae57026afbc2c0eda9b89c7981688.1699802445.git.hako@ultrarare.space
State New
Headers show
Series [bug#67017,v2] gnu: Add iptables-nft. | expand

Commit Message

Hilton Chain Nov. 12, 2023, 3:28 p.m. UTC
* gnu/packages/linux.scm (iptables-nft): New variable.

Change-Id: I281514fcf05e70b4d62f374269c50c76bb676f78
---

V1 -> V2:
Add iptables to inputs and switch to copy-build-system, since there's no need to
build it again.

 gnu/packages/linux.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)


base-commit: e35b7c5386c1bfacf47ed31bac9b503373dd26fc

Comments

Ludovic Courtès Nov. 26, 2023, 10:34 p.m. UTC | #1
Hi,

Hilton Chain <hako@ultrarare.space> skribis:

> * gnu/packages/linux.scm (iptables-nft): New variable.
>
> Change-Id: I281514fcf05e70b4d62f374269c50c76bb676f78

[...]

> +(define-public iptables-nft
> +  (package
> +    (inherit iptables)
> +    (name "iptables-nft")
> +    (source #f)
> +    (build-system copy-build-system)
> +    (arguments
> +     (list
> +      #:phases
> +      #~(modify-phases %standard-phases
> +          (delete 'unpack)
> +          (replace 'install
> +            (lambda* (#:key inputs #:allow-other-keys)
> +              (for-each
> +               (lambda (command-path)
> +                 (let ((link-path (string-append #$output command-path)))
> +                   (mkdir-p (dirname link-path))
> +                   (symlink (search-input-file inputs "sbin/xtables-nft-multi")
> +                            link-path)))
> +               (apply append
> +                      '("/bin/iptables-xml")
> +                      (map (lambda (xtables)
> +                             (list (string-append "/sbin/" xtables)
> +                                   (string-append "/sbin/" xtables "-restore")
> +                                   (string-append "/sbin/" xtables "-save")))
> +                           '("arptables"
> +                             "ebtables"
> +                             "iptables"
> +                             "ip6tables")))))))))
> +    (inputs (list iptables))
> +    (native-inputs '())))

I think we at least need ‘synopsis’ to clarify what this is about
compared to ‘iptables’.

Apart from that it LGTM, thanks!

Ludo’.
Hilton Chain Dec. 9, 2023, 12:32 p.m. UTC | #2
Hi,
On Mon, 27 Nov 2023 06:34:22 +0800,
Ludovic Courtès wrote:
>
[...]
> I think we at least need ‘synopsis’ to clarify what this is about
> compared to ‘iptables’.

Does it look good to append a "(nftables API)" to the synopsis of
iptables?  So that it says "Programs to configure Linux IP packet
filtering rules (nftables API)".
Hilton Chain Dec. 19, 2023, 1:52 p.m. UTC | #3
On Sat, 09 Dec 2023 20:32:18 +0800,
Hilton Chain wrote:
>
> Hi,
> On Mon, 27 Nov 2023 06:34:22 +0800,
> Ludovic Courtès wrote:
> >
> [...]
> > I think we at least need ‘synopsis’ to clarify what this is about
> > compared to ‘iptables’.
>
> Does it look good to append a "(nftables API)" to the synopsis of
> iptables?  So that it says "Programs to configure Linux IP packet
> filtering rules (nftables API)".

I used this for synopsis and applied the patch as
6884770464bd9ba95c1a5ccf10bf50d186a220d5.
diff mbox series

Patch

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 95a66e3d6a..397fc911ea 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -3101,6 +3101,38 @@  (define-public iptables
      '((release-monitoring-url . "https://www.netfilter.org/pub/iptables/")))
     (license license:gpl2+)))
 
+(define-public iptables-nft
+  (package
+    (inherit iptables)
+    (name "iptables-nft")
+    (source #f)
+    (build-system copy-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (delete 'unpack)
+          (replace 'install
+            (lambda* (#:key inputs #:allow-other-keys)
+              (for-each
+               (lambda (command-path)
+                 (let ((link-path (string-append #$output command-path)))
+                   (mkdir-p (dirname link-path))
+                   (symlink (search-input-file inputs "sbin/xtables-nft-multi")
+                            link-path)))
+               (apply append
+                      '("/bin/iptables-xml")
+                      (map (lambda (xtables)
+                             (list (string-append "/sbin/" xtables)
+                                   (string-append "/sbin/" xtables "-restore")
+                                   (string-append "/sbin/" xtables "-save")))
+                           '("arptables"
+                             "ebtables"
+                             "iptables"
+                             "ip6tables")))))))))
+    (inputs (list iptables))
+    (native-inputs '())))
+
 (define-public bolt
   (package
     (name "bolt")