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

Potential Bug in ofp_in_pcb.c #231

Open
HsuJv opened this issue Nov 13, 2019 · 1 comment
Open

Potential Bug in ofp_in_pcb.c #231

HsuJv opened this issue Nov 13, 2019 · 1 comment

Comments

@HsuJv
Copy link

HsuJv commented Nov 13, 2019

Hi team

In file ofp/src/ofp_in_pcb.c: ofp_in_pcbinfo_init

we've got

if (strcmp(name, "tcp") == 0) {  
        pcbinfo->ipi_hashbase = shm_tcp->ofp_hashtbl;  
        ofp_tcp_hashinit(hash_nelements, &pcbinfo->ipi_hashmask,  
            pcbinfo->ipi_hashbase);  
  
        pcbinfo->ipi_porthashbase = shm_tcp->ofp_porthashtbl;  
        ofp_tcp_hashinit(porthash_nelements, &pcbinfo->ipi_hashmask,  
                        pcbinfo->ipi_porthashbase);  
        pcb_size = global_param->pcb_tcp_max;  
}

Take a look at the second ofp_tcp_hashinit(porthash_nelements, &pcbinfo->ipi_hashmask,

why it is &pcbinfo->ipi_hashmask, rather than &pcbinfo->ipi_porthashmask, ?

Comparing with the UDP snippets here:

else {  
        pcbinfo->ipi_hashbase = ofp_hashinit(hash_nelements, 0,  
            &pcbinfo->ipi_hashmask);  
        pcbinfo->ipi_porthashbase = ofp_hashinit(porthash_nelements, 0,  
            &pcbinfo->ipi_porthashmask);  
} 
@JereLeppanen
Copy link
Contributor

Looks like a bug to me. This seems to leave pcbinfo->ipi_porthashmask uninitialized. Good catch.

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

2 participants