<div dir="ltr"><div>This patch is already included upstream in 4.2.8p1 (actually 4.2.7).<br><br>Is there any chance to consider this for the next patch on 4.2.6 or have 4.2.8p1 built?<br></div><div><br></div><div>--<br>On Mon, 12 Nov 2012 15:10:53 +0100 csszep <<a href="mailto:csszep@gmail.com">csszep@gmail.com</a>> wrote:<br>> Ok, i pached the source, with the following diff from<br>> <br>> <a href="http://bk.ntp.org/ntp-dev/?PAGE=patch&REV=4f977538lZC_iBKp-J-Xg1LFrR9foQ">http://bk.ntp.org/ntp-dev/?PAGE=patch&REV=4f977538lZC_iBKp-J-Xg1LFrR9foQ</a><br>> <br>> <br>> --- 1.340/ntpd/ntp_proto.c      2012-03-10 17:27:45 +00:00<br>> +++ 1.341/ntpd/ntp_proto.c     2012-04-25 03:53:27 +00:00<br>> @@ -394,18 +394,15 @@ receive(<br>>           * reveals a clogging attack.<br>>     */<br>>      sys_received++;<br>> - if (SRCPORT(&rbufp->recv_srcadr) < NTP_PORT) {<br>> +        if (0 == SRCPORT(&rbufp->recv_srcadr)) {<br>>                  sys_badlength++;<br>>                 return;                         /* bogus port */<br>>         }<br>>        restrict_mask = restrictions(&rbufp->recv_srcadr);<br>> -#ifdef DEBUG<br>> -   if (debug > 1)<br>> -               printf("receive: at %ld %s<-%s flags %x restrict %03x\n",<br>> +  DPRINTF(2, ("receive: at %ld %s<-%s flags %x restrict %03x\n",<br>>                  current_time, stoa(&rbufp->dstadr->sin),<br>>                     stoa(&rbufp->recv_srcadr),<br>> -             rbufp->dstadr->flags, restrict_mask);<br>> -#endif<br>> +             rbufp->dstadr->flags, restrict_mask));<br>>       pkt = &rbufp->recv_pkt;<br>>   hisversion = PKT_VERSION(pkt->li_vn_mode);<br>>    hisleap = PKT_LEAP(pkt->li_vn_mode);<br>> <br>> <br>> It tested it with a simple python ntp client:<br>> <br>> from socket import *<br>> import struct<br>> import sys<br>> import time<br>> <br>> TIME1970 = 2208988800L<br>> <br>> client = socket( AF_INET, SOCK_DGRAM )<br>> client.bind(('', 112))<br>> data = '\x1b' + 47 * '\0'<br>> client.sendto( data, ( sys.argv[1], 123 ))<br>> data, address = client.recvfrom( 1024 )<br>> if data:<br>>     print 'Response received from:', address<br>>     t = struct.unpack( '!12I', data )[10]<br>>     t -= TIME1970<br>>     print '\tTime=%s' % time.ctime(t)<br>> <br>> <br>> root@lab-test:~/ntppatch# python pythoncl 127.0.0.1<br>> Response received from: ('127.0.0.1', 123)<br>>         Time=Tue Oct 30 10:52:55 2012<br>> <br>> <br>> root@lab-test:~/ntppatch# ntpdc -n -c monlist<br>> remote address          port local address      count m ver rstr avgint  lstint<br>> ===============================================================================<br></div></div>