1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/iana-protocols/iana-protocols.conf
3 # Copyright (C) 2024 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
16 hook_add inmake 5 iana_protocols_inmake
18 iana_protocols_inmake() {
19 local iana_protocols=$(match_source_file -p protocol-numbers.xml)
20 local iana_ports=$(match_source_file -p service-names-port-numbers.xml)
22 mkdir -p $root$datadir/iana/
23 install -Dm644 $iana_ports $iana_protocols $root$datadir/iana/
26 BEGIN { print "# Full data: /usr/share/iana/protocol-numbers.xml\n" }
27 (/<record/) { v=n="" }
29 (/<name/ && $3!~/ /) { n=$3 }
30 (/<\/record/ && n && v!="") { printf "%-12s %3i %s\n", tolower(n),v,n }
31 ' $iana_protocols > $root$sysconfdir/protocols
34 BEGIN { print "# Full data: /usr/share/iana-etc/port-numbers.xml\n" }
35 (/<record/) { n=u=p=c="" }
36 (/<name/ && !/\(/) { n=$3 }
38 (/<protocol/) { p=$3 }
39 (/Unassigned/ || /Reserved/ || /historic/) { c=1 }
40 (/<\/record/ && n && u && p && !c) { printf "%-15s %5i/%s\n", n,u,p }
41 ' $iana_ports > $root$sysconfdir/services