Bug 60768 - xinetd service echo-udp performs only once
Summary: xinetd service echo-udp performs only once
Keywords:
Status: CLOSED DUPLICATE of bug 56487
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: xinetd
Version: 7.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: Brock Organ
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-06 07:07 UTC by Wilhelm Engels
Modified: 2007-04-18 16:40 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-03-06 07:12:39 UTC
Embargoed:


Attachments (Terms of Use)

Description Wilhelm Engels 2002-03-06 07:07:15 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4) Gecko/20011126
Netscape6/6.2.1

Description of problem:
xinetd-2.3.3-1 performs the echo function if the dgram service is used only
once. any following tries to get a response from xinetd are not successful.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.install xinetd and change the disable line in /etc/xinetd.d/echo-udp,
restart xinetd
2.send something to the echo port, get the response
3.send again:
	

Actual Results:  the 2nd and all other sendto are not answered by the server


Expected Results:  the server should reply

Additional info:

1) a strace -p <xinetd pid> before and after shows one fd less is in the select mask
2) netstat -a|grep echo shows a receive queue for the port
3) if you change the wait entry from "yes" to "no" in the echo-udp init file,
the server works as expected
4) the xinetd version 2.3.4.-0.3 from http://people.redhat.com/teg/xinetd/works also
5) bug exist also in 7.1

Comment 1 Wilhelm Engels 2002-03-06 07:12:34 UTC
testprg

--- cut here --- 
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <netinet/in.h>

int main(int argc, char *argv[])
{
struct timeval time_out;                /* struct timeout on select */
struct sockaddr_in Sin;                 /* socket address send */
struct hostent *hp;                     /* struct to get internet address */
struct servent *sp;                     /* struct to get internet service */
fd_set echo_fds;                        /* area for select bits */
char ebuf[64];                          /* send / receive buffer */
int efd;                                /* socket for send */
size_t rlen;                            /* size of returned structed from echo */
int eret;                               /* return value, received */
char hostn[MAXHOSTNAMELEN];             /* for the hostname */

        strncpy(hostn, argv[1], MAXHOSTNAMELEN);

        if (!(hp = gethostbyname(hostn)))       /* get ip addr */
        {
                fprintf(stderr,
                        "%s: unknown host %s\n", argv[0], hostn);
                exit(2);
        }

        if (!(sp = getservbyname("echo", "udp")))
        {
                fprintf(stderr,
                        "%s: echo not in services\n", argv[0]);
                exit(3);
        }

        if ((efd = socket(PF_INET,SOCK_DGRAM,0)) < 0)
        {
                fprintf(stderr, "%s: open socket:%s\n",
                        argv[0],
                        strerror(errno));
                exit(4);
        }

        Sin.sin_family = PF_INET;       /* internet */

        (void) memcpy((char *) &Sin.sin_addr.s_addr,    /* put in remote host */
                (char *) hp->h_addr,
                sizeof(unsigned long));

        Sin.sin_port = (unsigned short) sp->s_port;     /* save port */

        strcpy(ebuf, "calping");        /* send message */

        eret=sendto(
                efd,            /* fileid of socket */
                ebuf,           /* buffer */
                (int) strlen(ebuf),
                0,
                (struct sockaddr *) &Sin,
                sizeof(Sin));

        if (-1 > eret)
        {
                fprintf(stderr, "%s:sendto:%s\n",
                        argv[0],
                        strerror(errno));
                exit(5);
        }

        time_out.tv_sec = 1L;   /* seconds to wait */
        time_out.tv_usec = 0L;  /* milliseconds */

        FD_ZERO(&echo_fds);     /* clear all bits */
        FD_SET(efd, &echo_fds);         /* file descriptor */

        if (!(eret = select(
                FD_SETSIZE,             /* check all fds */
                &echo_fds,              /* read check */
                0,                      /* no write check */
                0,                      /* no execptions */
                &time_out)))            /* time out periode */
        {
                fprintf(stderr, "%s:timeout select\n",
                        argv[0]);
                        exit(1);        /* got timeout */
        }

        if (0 > eret)                   /* error */
        {
                fprintf(stderr, "%s:error select:%s\n",
                        argv[0],
                        strerror(errno));
                exit(7);
        }
        rlen = sizeof(Sin);             /* available space */

        (void) recvfrom(
                efd,                    /* file id to read */
                ebuf,                   /* buffer */
                64,                     /* length of buffer */
                0,                      /* flags */
                (struct sockaddr *) &Sin,       /* sender address */
                &rlen);                         /* size of struct */
        fprintf(stderr, "%s:got response\n",
                argv[0]);
        exit(0);                        /* return other sys exist */

}

Comment 2 Trond Eivind Glomsrxd 2002-03-06 16:41:43 UTC

*** This bug has been marked as a duplicate of 56487 ***


Note You need to log in before you can comment on or make changes to this bug.