bin/95082: ping.c won't handle large preload patterns

Peter pb at ludd.luth.se
Wed Mar 29 18:40:17 UTC 2006


>Number:         95082
>Category:       bin
>Synopsis:       ping.c won't handle large preload patterns
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 29 18:40:16 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Peter
>Release:        FreeBSD 6.0-Release i386
>Organization:
>Environment:
>Description:
With this patch one can use ping to wake up Wake-on-lan clients. Commands like this becomes possible:
ping -c 1 -s 204 -p FFFFFFFFFFFFFFFFFFFFFFFF112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566112233445566 Broadcast_IP

Mac address from unpowered machines can be fixed with (if you want to avoid broadcast):
arp -S 1.2.3.4 11:22:33:44:55:66


diff -c patch against 6.0-FreeBSD-RELEASE i386 sources.

>How-To-Repeat:

>Fix:
*** ping.c      Fri Aug 19 11:29:25 2005
--- ping.c      Wed Mar 29 19:02:11 2006
***************
*** 1650,1656 ****
        char *bp, *patp;
  {
        char *cp;
!       int pat[16];
        u_int ii, jj, kk;
  
        for (cp = patp; *cp; cp++) {
--- 1650,1656 ----
        char *bp, *patp;
  {
        char *cp;
!       int pat[1500];
        u_int ii, jj, kk;
  
        for (cp = patp; *cp; cp++) {
***************
*** 1659,1669 ****
                            "patterns must be specified as hex digits");
  
        }
!       ii = sscanf(patp,
!           "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x",
!           &pat[0], &pat[1], &pat[2], &pat[3], &pat[4], &pat[5], &pat[6],
!           &pat[7], &pat[8], &pat[9], &pat[10], &pat[11], &pat[12],
!           &pat[13], &pat[14], &pat[15]);
  
        if (ii > 0)
                for (kk = 0; kk <= maxpayload - (TIMEVAL_LEN + ii); kk += ii)
--- 1659,1668 ----
                            "patterns must be specified as hex digits");
  
        }
! 
!       for( ii=0;
!              ii<sizeof(pat)/sizeof(pat[0]) &&  *(patp+2*ii)!=NULL;  ii++)
!               sscanf( patp+2*ii,"%2x", &pat[ii] );
  
        if (ii > 0)
                for (kk = 0; kk <= maxpayload - (TIMEVAL_LEN + ii); kk += ii)

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list