Browse code

lcr: fix build

> lcr_mod.c: In function 'find_gateway_by_ip_and_port':
> lcr_mod.c:930:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
> for (int i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
> ^
> lcr_mod.c:930:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
> ../../Makefile.rules:100: recipe for target 'lcr_mod.o' failed
> make[3]: *** [lcr_mod.o] Error 1

Victor Seva authored on 14/10/2021 13:16:52
Showing 1 changed files
... ...
@@ -925,9 +925,9 @@ static int comp_gws(const void *_g1, const void *_g2)
925 925
  * Compare a gateway using IP address and the src port
926 926
  */
927 927
 static struct gw_info * find_gateway_by_ip_and_port(struct gw_info * gw, struct gw_info * gws) {
928
-	int tmp = 0, gw_index = 0;
928
+	int tmp = 0, gw_index = 0, i;
929 929
 
930
-	for (int i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
930
+	for (i = 1; i <= gws[0].ip_addr.u.addr32[0]; i++) {
931 931
 		tmp = memcmp(gws[i].ip_addr.u.addr, gw->ip_addr.u.addr, gws[i].ip_addr.len);
932 932
 		if (gws[i].ip_addr.af == gw->ip_addr.af &&
933 933
 			gws[i].ip_addr.len == gw->ip_addr.len &&