Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiling CLI version on ARM #18

Open
jemcek opened this issue Jul 18, 2019 · 1 comment
Open

compiling CLI version on ARM #18

jemcek opened this issue Jul 18, 2019 · 1 comment

Comments

@jemcek
Copy link
Owner

jemcek commented Jul 18, 2019

compiling CLI version on ARM platforms fails:

/tmp/ccR7C9OY.s: Assembler messages:
/tmp/ccR7C9OY.s:1126: Error: unknown mnemonic movl' -- movl (x0),x2'
/tmp/ccR7C9OY.s:1127: Error: unknown mnemonic subl' -- subl $4,x1'
...

this is because the the function ip_fast_csum() has some assembler code.

This function is only used in IDS testing mode, so temporarily, just delete everything inside this function and it will probably compile.

@jemcek
Copy link
Owner Author

jemcek commented Jul 18, 2019


this diff could be used instead, need to check

564,592d563
< 	unsigned short *addr = (unsigned short*)iph;
< 	register int sum = 0;
< 	u_short answer = 0;
< 	register u_short *w = addr;
< 	register int nleft = ihl;//len;
< 
< 	/*
< 	 *          * Our algorithm is simple, using a 32 bit accumulator (sum), we add
< 	 *          * sequential 16 bit words to it, and at the end, fold back all the
< 	 *          * carry bits from the top 16 bits into the lower 16 bits.
< 	 *          */
< 	while (nleft > 1)  {
< 		sum += *w++;
< 	        nleft -= 2;
< 	}
< 
< 	/* mop up an odd byte, if necessary */
< 	if (nleft == 1) {
< 		*(u_char *)(&answer) = *(u_char *)w ;
< 		sum += answer;
< 	}
< 
< 	/* add back carry outs from top 16 bits to low 16 bits */
< 	sum = (sum >> 16) + (sum & 0xffff);     /* add hi 16 to low 16 */
< 	sum += (sum >> 16);                     /* add carry */
< 	answer = ~sum;                          /* truncate to 16 bits */
< 	return(answer);
< 	
< 	/*
611c582
< 	    "2:"*/
---
> 	    "2:"
615c586
< 	/*    : "=r" (sum), "=r" (iph), "=r" (ihl)
---
> 	    : "=r" (sum), "=r" (iph), "=r" (ihl)
618c589
< 	return (__sum16)sum;*/
---
> 	return (__sum16)sum;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant