-
Notifications
You must be signed in to change notification settings - Fork 0
/
freerouter.spec
184 lines (157 loc) · 6.31 KB
/
freerouter.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
%undefine _missing_build_ids_terminate_build
%undefine _debugsource_packages
Name: freerouter
Version: 24.11.7
Release: 1%{?dist}
Summary: Free, open source router OS process
License: CC-BY-SA
URL: http://www.freertr.org/
Source0: https://github.com/mc36/freeRtr/archive/refs/tags/v%{?version}.tar.gz
Source1: freerouter-p4dpdk.service
Source2: freerouter-p4dpdk-pkt.service
Source3: freerouter-p4emu.service
Source4: freerouter-p4mnl.service
Source5: freerouter-p4udp.service
Source6: freerouter-p4urng.service
Source7: freerouter-p4xdp.service
Source8: freerouter-p4xsk.service
Source9: 10-virtio.link
Source10: 20-veth.link
Source11: veth250.network
Source12: veth251.network
Source13: veth251.netdev
Source14: 80-freerouter.conf
%if 0%{?rhel} == 7
BuildRequires: openssl1.1-devel
%else
BuildRequires: openssl-devel
BuildRequires: liburing-devel
BuildRequires: libxdp-devel
Recommends: freerouter-native
Recommends: socat
Recommends: telnet
%endif
BuildRequires: systemd
BuildRequires: clang llvm
BuildRequires: dpdk-devel
BuildRequires: libpcap-devel
BuildRequires: libmnl-devel
%if 0%{?fedora} > 41 || 0%{?rhel} > 9
BuildRequires: java-21-openjdk-devel
Requires: java-21-openjdk-headless
%else
BuildRequires: java-11-openjdk-devel
Requires: java-11-openjdk-headless
%endif
%description
freeRouter speaks routing protocols, and (re)encapsulates packets on
interfaces since it handles packets itself, it is independent of
underlaying os capabilities (optionally, it can export forwarding tables
through openflow to external switch) since it is an unprivilegized process,
it receives and sends packets through sockets there are external, privileged
processes that place traffic to these sockets (it means that internet can
be used as backplane for router processes) the command line tries to
mimic the industry standards with one exception: no global routing table:
every routed interface must be in a virtual routing table positive side
effect: there are no vrf-awareness questions
%package native
Summary: Native tools for better performance than socat
Requires: %{name} = %{version}-%{release}
%if 0%{?rhel} != 7
Recommends: dpdk-tools xdp-tools systemd-networkd
%endif
%description native
These tools are completely optional but should deliver better performance
than socat.
%package doc
BuildArch: noarch
Summary: Examples of freeRouter test configurations
Requires: %{name} = %{version}-%{release}
%description doc
Examples of freeRouter test configurations.
%prep
%setup -q -n freeRtr-%{?version}
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} %{SOURCE7} %{SOURCE8} .
%build
pushd src
./cj.sh
./cp.sh
popd
pushd misc/native
sed -i '/^strip/d' c.sh
./c.sh
popd
%install
find binTmp -size 0 -print -delete
find misc/demo -type f -not -name '*.txt' -delete
%if 0%{?fedora} > 41 || 0%{?rhel} > 9
sed -i 's|/usr/bin/freerouter|/usr/lib/jvm/jre-21-openjdk/bin/java -jar /usr/share/java/rtr.jar|g' misc/debian2/freerouter.service
%else
sed -i 's|/usr/bin/freerouter|/usr/lib/jvm/jre-11-openjdk/bin/java -jar /usr/share/java/rtr.jar|g' misc/debian2/freerouter.service
%endif
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_javadir}
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_datadir}/freerouter
mkdir -p %{buildroot}%{_sysconfdir}/sysctl.d
mkdir -p %{buildroot}%{_sysconfdir}/freerouter/interfaces
mkdir -p %{buildroot}%{_sysconfdir}/systemd/network
mkdir -p %{buildroot}%{_sharedstatedir}/freerouter
install -m644 src/rtr.jar %{buildroot}%{_javadir}
cp binTmp/*.bin %{buildroot}%{_bindir}
install -m755 binTmp/*.so %{buildroot}%{_libdir}
install -m755 misc/debian2/interface.sh %{buildroot}%{_datadir}/freerouter/
install -m644 misc/debian2/interface.cpu_port %{buildroot}%{_sysconfdir}/freerouter/interfaces/cpu_port
install -m644 misc/debian2/rtr-hw.txt misc/debian2/rtr-sw.txt %{buildroot}%{_sysconfdir}/freerouter/
install -m644 %{SOURCE9} %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{buildroot}%{_sysconfdir}/systemd/network/
install -m644 %{SOURCE14} %{buildroot}%{_sysconfdir}/sysctl.d/
install -m644 misc/debian2/[email protected] %{buildroot}%{_unitdir}
install -m644 misc/debian2/freerouter.service %{buildroot}%{_unitdir}
install -m644 misc/debian2/freerouter.service %{buildroot}%{_unitdir}/[email protected]
sed -i 's|rtr-|%i-|g' %{buildroot}%{_unitdir}/[email protected]
%pre
getent group freerouter >/dev/null 2>&1 || groupadd -r freerouter >/dev/null 2>&1 || :
getent passwd freerouter >/dev/null 2>&1 || useradd -M -r -g freerouter -s /sbin/nologin \
-c "freeRouter OS process" -d %{_sharedstatedir}/freerouter freerouter || :
usermod -aG dialout freerouter
%post
%systemd_post freerouter.service
%systemd_post freerouter@\*.service
%preun
%systemd_preun freerouter.service
%systemd_preun freerouter@\*.service
%postun
%systemd_postun_with_restart freerouter.service
%systemd_postun_with_restart freerouter@\*.service
%post native
%systemd_post freerouter-native@\*.service
%preun native
%systemd_preun freerouter-native@\*.service
%postun native
%systemd_postun_with_restart freerouter-native@\*.service
%files
%license misc/debian2/copyright
%doc misc/demo misc/captures readme.md changelog.txt todo.txt rtr-hw.txt rtr-sw.txt
%dir %attr(0755,freerouter,freerouter) %{_sharedstatedir}/freerouter
%dir %attr(0770,freerouter,freerouter) %{_sysconfdir}/freerouter
%attr(0644,freerouter,freerouter) %config(noreplace) %{_sysconfdir}/freerouter/rtr-hw.txt
%attr(0644,freerouter,freerouter) %config(noreplace) %{_sysconfdir}/freerouter/rtr-sw.txt
%{_javadir}/rtr.jar
%{_unitdir}/freerouter.service
%{_unitdir}/[email protected]
%files native
%doc freerouter-p4dpdk.service freerouter-p4dpdk-pkt.service
%doc freerouter-p4emu.service freerouter-p4mnl.service
%doc freerouter-p4udp.service freerouter-p4urng.service
%doc freerouter-p4xdp.service freerouter-p4xsk.service
%dir %{_sysconfdir}/freerouter/interfaces
%config(noreplace) %{_sysconfdir}/sysctl.d/80-freerouter.conf
%config(noreplace) %{_sysconfdir}/freerouter/interfaces/cpu_port
%config(noreplace) %{_sysconfdir}/systemd/network/*
%{_bindir}/*.bin
%{_libdir}/*.so
%{_datadir}/freerouter/
%{_unitdir}/[email protected]
%files doc
%doc cfg