janjanovicsk / Quagga-EIGRP

Quagga-EIGRP
GNU General Public License v2.0
33 stars 12 forks source link

Is it a bug? #2

Closed NanerLee closed 7 years ago

NanerLee commented 7 years ago

Hello! These days, I use the Eigrp protocol in dce-ns3, but it has some errors. I find the REPLY packet has wrong data. So I see the souce codes. And I find there a function -- eigrp_fsm_event_keep_state in the file named eifrp_fsm.c. In here, one line code is eigrp_send_reply(msg->adv_router, msg->entry);. But I find the declaration of eigrp_send_reply is eigrp_send_reply (struct eigrp_neighbor nbr, struct eigrp_prefix_entry pe). Obviously, the type of msg->entry is different from the type of pe.

If you want to convert the point, it will wrong. Because there is a pointer to struct eigrp_prefix_entry rather than a struct variable in struct eigrp_neighbor_entry. So what does it means? Is it a bug? If I have something wrong, please tell me. Thanks a lot!

Matthew54 commented 7 years ago

Hi!

It's been a while already, but I will try to explain this little hack. Things are maybe different but I believe that pointer is just a value, pointing to specific place in memory, and type of pointer implies how many bits/bytes will be read from that point. And because of first element in struct eigrp_neighbor_entry is struct eigrp_prefix_entry *, value of pointer msg->entry equals (point to same place in memory as) value of pointer msg->entry->prefix and the type change is possible.

If the assumption is not right and the method of saving struct to memory is different for some reason (not likely but nothing is immpossible :) ) than yes this could be a problem.

It would be really helpfull if you could provide us more information about what do you mean by "wrong data".

Hope this helps. Regards, Matej

NanerLee commented 7 years ago

@Matthew54 thanks for your reply. And I understand your means.But I think you are wrong. You ignore the diffrenence between point and data.

If the first element in struct eigrp_neighbor_entry is struct eigrp_prefix_entry(here is data), value of pointer msg->entry will equal value of pointer msg->entry->prefix. But if the first element is struct eigrp_prefix_entry(here is pointer), value of pointer msg->entry should be equal to value of pointer of msg->entry->prefix(the value of pointer that points to the pointer of msg->entry->prefix).

my English is poor, I hope you can understand my description.

Matthew54 commented 7 years ago

Yeah you got me there, it realy has been a while. In this case the pointer are the data. And that's not what we wanted. It realy is the bug than. Thanks for reporting, fixed in here.