FreeBSD networking question

V13 v13 at v13.gr
Fri Feb 1 00:16:29 EET 2008


On Friday 01 February 2008, ithilgore wrote:
>     b) Einai pio eukolo na akolou8hsei kaneis ena book ( tcp ip vol 2
> ---> bsd ) para na piasei monos tou thn network stack tou linux
> btw exw diabasei meros tou "linux network internals" alla einai pio polu
> reference kai asxoleitai mexri to L3 ( no tcp dhladh )

  Exontas koitaksei ton kodika poy afora to TCP sto linux, den mporo na 
katalabo ti dyskolia tha synantiseis ean exeis koitaksei kai katalabei ola ta 
parakato (L2 & L3). Einai arista documented kai 100% eyanagnostos 
(toylaxiston ta kommatia ta opoia exo koitaksei).  Mipos h aporia soy den 
exei na kanei toso me to implementation alla me toys epi meroys algorithmoys? 
Aloste, to implementation einai kata kanona efarmogi ton protypon kai ton 
algorithmon.

  PoC: Endeiktiko documentation apo to tcp.c:

        /*
         * POLLHUP is certainly not done right. But poll() doesn't
         * have a notion of HUP in just one direction, and for a
         * socket the read side is more interesting.
         *
         * Some poll() documentation says that POLLHUP is incompatible
         * with the POLLOUT/POLLWR flags, so somebody should check this
         * all. But careful, it tends to be safer to return too many
         * bits than too few, and you can easily break real applications
         * if you don't tell them that something has hung up!
         *
         * Check-me.
         *
         * Check number 1. POLLHUP is _UNMASKABLE_ event (see UNIX98 and
         * our fs/select.c). It means that after we received EOF,
         * poll always returns immediately, making impossible poll() on 
write()
         * in state CLOSE_WAIT. One solution is evident --- to set POLLHUP
         * if and only if shutdown has been made in both directions.
         * Actually, it is interesting to look how Solaris and DUX
         * solve this dilemma. I would prefer, if PULLHUP were maskable,
         * then we could set it on SND_SHUTDOWN. BTW examples given
         * in Stevens' books assume exactly this behaviour, it explains
         * why PULLHUP is incompatible with POLLOUT.    --ANK
         *
         * NOTE. Check for TCP_CLOSE is added. The goal is to prevent
         * blocking on fresh not-connected or disconnected socket. --ANK
         */
        if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE)
                mask |= POLLHUP;
        if (sk->sk_shutdown & RCV_SHUTDOWN)
                mask |= POLLIN | POLLRDNORM | POLLRDHUP;

... nai... ta parapano sxolia aforoyn tis 2 aytes grammes... meta exei alla...

> ithilgore
<<V13>>




More information about the Linux-greek-users mailing list