Skip to content

There seems to be a bug in the ipv4 source selection logic #821

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

Open
prepaser opened this issue May 14, 2025 · 0 comments · May be fixed by #822
Open

There seems to be a bug in the ipv4 source selection logic #821

prepaser opened this issue May 14, 2025 · 0 comments · May be fixed by #822

Comments

@prepaser
Copy link

The main.c has the following code.

                /*
                 * SYN-COOKIE LOGIC
                 *  Figure out the source IP/port, and the SYN cookie
                 */
                if (src.ipv4_mask > 1 || src.port_mask > 1) {
                    uint64_t ck = syn_cookie_ipv4((unsigned)(i+repeats),
                                            (unsigned)((i+repeats)>>32),
                                            (unsigned)xXx, (unsigned)(xXx>>32),
                                            entropy);
                    port_me = src.port + (ck & src.port_mask);
                    ip_me = src.ipv4 + ((ck>>16) & src.ipv4_mask);
                } else {
                    ip_me = src.ipv4;
                    port_me = src.port;
                }

However, src.ipv4_mask is:

    src->ipv4_mask = ifsrc->ipv4.last - ifsrc->ipv4.first;

If the adapter-ip is two IPs, source range selection does not work. Only the first IP will work.

@prepaser prepaser linked a pull request May 14, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant