Bug 54354

Summary: Bug in inetd connection rate control
Product: Base System Reporter: Jose Marcio Martins da Cruz <Jose-Marcio.Martins>
Component: binAssignee: dwmalone
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.8-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Jose Marcio Martins da Cruz 2003-07-11 06:40:15 UTC
Hello,

There seems to have a bug at inetd.c source file.

This pb regards connection rate control feature.

Line 2341 shall probably be :

  if ((cnt * 60) / (CHTSIZE * CHTGRAN) > sep->se_maxcpm) {
  ...

instead of 

  if (cnt * (CHTSIZE * CHTGRAN) / 60 > sep->se_maxcpm) {
    char pname[INET6_ADDRSTRLEN];

    getnameinfo((struct sockaddr *)&rss,
                ((struct sockaddr *)&rss)->sa_len,
		pname, sizeof(pname), NULL, 0,
		NI_NUMERICHOST|NI_WITHSCOPEID);
    r = -1;
    syslog(LOG_ERR,
	    "%s from %s exceeded counts/min (limit %d/min)",
	    sep->se_service, pname,
	    sep->se_maxcpm);
  }


as the connection rate is the number of connections ***DIVIDED*** by the
size of the measurement window.

As long as you don't change original CHTSIZE and CHTGRAN values (6 and
10), this bug has no effect.

This problem was remarked by Claus Assmann (ca@sendmail.org) and Jose
Marcio Martins da Cruz (Jose-Marcio.Martins@ensmp.fr).

Version information of the source file is : 

__FBSDID("$FreeBSD: src/usr.sbin/inetd/inetd.c,v 1.119 2003/02/23 16:54:19 dwmalone Exp $");

Best regards,

Jose-Marcio


-- 
 ---------------------------------------------------------------
 Jose Marcio MARTINS DA CRUZ           Tel. :(33) 01.40.51.93.41
 Ecole des Mines de Paris              http://j-chkmail.ensmp.fr
 60, bd Saint Michel                http://www.ensmp.fr/~martins
 75272 - PARIS CEDEX 06      mailto:Jose-Marcio.Martins@ensmp.fr
Comment 1 Gregory Neil Shapiro freebsd_committer freebsd_triage 2003-07-11 06:41:58 UTC
Responsible Changed
From-To: freebsd-bugs->dwmalone

Give PR to the inetd maintainer. 
Note that I entered this PR on behalf of Jose Marcio Martins da Cruz.
Comment 2 dwmalone freebsd_committer freebsd_triage 2003-07-27 14:58:13 UTC
State Changed
From-To: open->closed

Fixed in -current and -stable. Thanks for the patch.