[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MaxSameIpSource, system load, and "ps" output (bug?)

> Hi all,
> due to my own carelessness, my home machine have to receive a large
> number of mails in the past couple of days, which caused some "bugs"
> to surface. There are three such "bugs" (or so I think, for now)
> that are related to ZMailer.
> First, MaxSameIpSource doesn't seem to work. Even though I set it to
> 2 (which, incidentally, means 8 simultaneous connections, according
> to the source code -- rather misleading imho), I still get about 30
> connections from a machine.

	Well, YMMV -- the idea is that for the first 3*Limit it
	will tell 'come back latter':

450-Too many simultaneous connections from same IP address (%d max %d)\r\n

	and then hung up, above that it just simply hungs up.

	It could be that the code in   smtpchild.c  does not work entirely
	right in all circumstances.  What would seem to be the problem you
	are seeing ?

	You could check your  smtpserver  log for these; there is a printout:

			"%d#\tconnection from %s ipcnt %d ident: %s\n",
			pid, SS.rhostname, sameipcount, SS.ident_username);

	what does the ipcnt tell in the logfile ?

> Second, -L (system load) parameter of smtpserver doesn't seem to work
> either. When the kernel started killing processes, the system load
> was well over 10, though I ran my smtpserver with -L 3.

	If you search for  'maxloadavg' variable, you see that it is
	essentially disabled.  ("#if 0" around its uses.)

	Another thing is, that the  loadaver()  routine 'supports' only
	some variants of SunOS, and Linux systems.   That function is
	highly system dependent; more so than about anything else, and
	therefore quite a difficult piece of code..

> The second problem might as well be something wrong with my system,
> something wrong with my syntax, or just pure bad luck (as my system
> is able to cope with the load, with system load well under 3, for
> the past few hours). However, the first problem looks real to me, at
> least at this point (as there still are more than 4 connections from
> the same IP source even though MaxSameIpSource is now 1).
> The third problem is more of a cosmetic problem. Assuming I understand
> the code correctly, the patch to fix the problem is (cut-and-paste
> from "screen" window):
> --- zmailer-2.99.50s11.dist/smtpserver/smtpserver.c     Thu Nov 12 15:59:53 1998
> +++ zmailer-2.99.50s11/smtpserver/smtpserver.c  Sun Mar 14 23:15:37 1999
> @@ -1730,7 +1730,7 @@
>      for (s = s + strlen(s); s < buf + cmdlen; ++s)
>          *s = '\0';
>      buf[cmdlen] = '\0';
> -    memcpy((char *) cmdline, buf, cmdlen);
> +    memcpy((char *) cmdline, buf, cmdlen + 1);
>      va_end(ap);
>  }

	Right, fixed.

> The particular code is trying to modify the command line as shown by
> "ps". However, it copied one less byte than it should, making junk
> appear in the ps output. Actually, it looks like it is overwriting
> environment variables; I don't know if this is indeed the case and/
> or whether there is a problem with that.

	It might adversely affect possibly started router subprocess.
	However it shouldn't overflow the range of input options into
	the environment variables (presuming the classical argv/environ)
	memory layout.

> I also have a question, related to the first problem. Since the 35+
> connections eventually crashed my machine, I wonder if there is some
> parameter or command line option that will limit the total number of
> smtpserver processes (no matter what IP it is connecting from). That
> might be a helpful option.

	E.g. "maxchilds", which presumes that each child serves
	exactly one connection ?

> The system in question is ZMailer 2.99.50s11 on Linux 2.2.2, libc5.
> Later,
> Ambrose Li

	/Matti Aarnio <mea@nic.funet.fi>