[Olsr-users] Compiler warning on 0.5.6 branch tip release candidate
Eric Malkowski
(spam-protected)
Mon Oct 5 19:20:21 CEST 2009
Markus-
I see you comitted changeset 1874 to OLSRD_0_5_6_BRANCH that should
correct the compiler warnings.
Thanks for incorporating that change.
So as of now I don't see any issues w/ 0.5.6-r6 with testing I've done.
-Eric
Eric Malkowski wrote:
> Guys-
>
> I got a single compiler warning when building linux/kernel_routes.c which I
> think is the new netlink notifier stuff that just went in that should probably
> be fixed before 0.5.6-r6 release IMHO:
>
> line 104 variable iface could be used uninitialized and the compiler is right:
>
> The code that says:
>
> iface = if_ifwithindex(ifi->ifi_index);
>
> Should probably be moved up to the start of the function.
> This is so the two OLSR_PRINTF calls that reference iface won't use iface
> unitialized.
>
> I don't know if iface can end up NULL when the above mentioned line that assigns
> it runs, but defensive code never hurts.
>
> The netlink_process_link() function might be better like this with iface getting
> assigned first and tests for NULL to avoid NULL pointer dereferences:
>
> static void netlink_process_link(struct nlmsghdr *h)
> {
> struct ifinfomsg *ifi = (struct ifinfomsg *) NLMSG_DATA(h);
> struct interface *iface;
>
> //all IFF flags:
> LOOPBACK,BROADCAST;POINTOPOINT;MULTICAST;NOARP;ALLMULTI;PROMISC;MASTER;SLAVE;DEBUG;DYNAMIC;AUTOMEDIA;PORTSEL;NOTRAILERS;UP;LOWER_UP;DORMANT
>
> iface = if_ifwithindex(ifi->ifi_index);
>
> /* check if interface is up and running? (a not running interface keeps its
> routes, so better not react like on ifdown!!??) */
> if (ifi->ifi_flags&IFF_UP) {
> if(iface != NULL)
> OLSR_PRINTF(3,"interface %s changed but is still up! ", iface->int_name);
> return; //we are currently only interested in interfaces that are/go down
> } else {
> if(iface != NULL)
> OLSR_PRINTF(1,"interface %s is down! ", iface->int_name);
> }
>
> //only for still configured interfaces (ifup has to be detected with regular
> interface polling)
> if ( iface != NULL ) {
> struct olsr_if *tmp_if;
> for (tmp_if = olsr_cnf->interfaces; tmp_if != NULL; tmp_if = tmp_if->next) {
> if (tmp_if->interf==iface) {
> OLSR_PRINTF(1,"-> removing %s from olsr config! ", iface->int_name);
> RemoveInterface(tmp_if,true);
> break;
> }
> }
> }
> }
>
>
More information about the Olsr-users
mailing list