[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] Bug? sys/sockets/inet4/if.c



Hi!

I've been playing with UDP packet sending in the current CVS kernel
version. The UDP broadcast packets are sent to the primary nif normally
there.

I've found a strange thing in $subj file (see the patch snippet below) in
if_open() function where there is no if_primary assignment (change) in
case the old if_primary nif is up. Moreover there was a default route
assignment always done to the if_lo interface. This is strange. Could
someone verify my thoughts where every just opened nif should become the
primary one (to get the broadcast UDP sent to that) and also the default
route should be changed to just newly opened nif as well.

I can commit it to the CVS of course, but I wanted to be checked by
someone else.

best regards

STanda


--- inet4/if.c  9 Jan 2002 23:10:14 -0000       1.5
+++ inet4/if.c  3 Nov 2003 09:33:10 -0000
@@ -382,10 +382,12 @@
        /*
         * Want a running primary interface
         */
-       if (!(if_primary->flags & IFF_UP))
                if_primary = nif;

-       route_add (if_lo, SIN (&ifa->addr)->sin_addr.s_addr, 0xffffffffL,
+       route_add (nif, SIN (&ifa->addr)->sin_addr.s_addr, 0xffffffffL,
                INADDR_ANY, RTF_STATIC|RTF_UP|RTF_HOST|RTF_LOCAL, 999, 0);

        return 0;