Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 May 1998 17:23:33 +0300
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        questions@FreeBSD.ORG
Subject:   Inetd: bug or expected behaviour
Message-ID:  <19980518172333.A14723@ucb.crimea.ua>

next in thread | raw e-mail | index | archive | help
Hi!

Currently I'm running FreeBSD 2.2.6-STABLE (last world at May, 13).

Is the following a bug or expected behaviour?


The Problem:
===========

Recently I've switched from bootp to isc-dhcp2.
They both listen on udp port 67, and I had the
standard entry for bootpd in my inetd.conf:

bootps dgram udp wait root /usr/libexec/bootpd bootpd

When I've finished with DHCP configuration file (dhcpd.conf),
I (as usually) commented out the string for ``bootpd'' above
in inetd.conf, killed -HUP inetd, and tried to run dhcpd.

I was unable to run it with the following diagnostic:
``Unable to bind, address already in use''.

There was no bootpd process, and even when I killed inetd itself,
the dhcpd was unable to bind to the 67 port.


How-To-Repeat:
=============

1. Create a simple program which just does nothing (I called it test.sh)
   and put in in /tmp:

#!/bin/sh
while :; do sleep 1000; done

2. Add an entry for bootps in inetd.conf:
bootps	dgram	udp	wait	root	/tmp/test.sh	test.sh

(Substitute for ``bootps'' any UDP service you wish).

3. Restart inetd by killing -HUP it.

4. Send something to this port.
   I used the netcat (from the ports/net) for this purpose:

   echo xxxxxxxxxxxxxxx | nc -u localhost bootps

5. ``netstat -an -finet'' will show the string similar to this one:
   udp	618	0	0	*.68	*.*

   (Receive queue size is 618 bytes).

6. Comment the line for bootpd in /etc/inetd.conf, restart inetd.

7. Kill the test.sh process.

8. Try to bind to the port again.
   You'll get the ``Address already in use'' error;
   ``netstat -an'' still shows the line as above (step 5).


Workaround:
==========
Wait some time (what exact?) until the kernel purges the receive queue.

Thanks in advance,
-- 
Ruslan Ermilov          System Administrator
ru@ucb.crimea.ua        United Commercial Bank
+380-652-247647         Simferopol, Crimea
2426679                 ICQ Network, UIN

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980518172333.A14723>