Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/networking/ether-wake.c

    r3232 r3621  
    6363 *   doing so only works with adapters configured for unicast+broadcast Rx
    6464 *   filter.  That configuration consumes more power.
    65 */
     65 */
    6666
    6767//usage:#define ether_wake_trivial_usage
    68 //usage:       "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC"
     68//usage:       "[-b] [-i IFACE] [-p aa:bb:cc:dd[:ee:ff]/a.b.c.d] MAC"
    6969//usage:#define ether_wake_full_usage "\n\n"
    7070//usage:       "Send a magic packet to wake up sleeping machines.\n"
    7171//usage:       "MAC must be a station address (00:11:22:33:44:55) or\n"
    7272//usage:       "a hostname with a known 'ethers' entry.\n"
    73 //usage:     "\n    -b      Send wake-up packet to the broadcast address"
    74 //usage:     "\n    -i iface    Interface to use (default eth0)"
    75 //usage:     "\n    -p pass     Append four or six byte password PW to the packet"
     73//usage:     "\n    -b      Broadcast the packet"
     74//usage:     "\n    -i IFACE    Interface to use (default eth0)"
     75//usage:     "\n    -p PASSWORD Append four or six byte PASSWORD to the packet"
    7676
    7777#include "libbb.h"
     
    122122    if (eap) {
    123123        bb_debug_msg("The target station address is %s\n\n", ether_ntoa(eap));
    124 #if !defined(__UCLIBC_MAJOR__) \
    125  || __UCLIBC_MAJOR__ > 0 \
    126  || __UCLIBC_MINOR__ > 9 \
    127  || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 30)
     124#if !defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 30)
    128125    } else if (ether_hostton(hostid, eaddr) == 0) {
    129126        bb_debug_msg("Station address for hostname %s is %s\n\n", hostid, ether_ntoa(eaddr));
     
    134131}
    135132
    136 static int get_fill(unsigned char *pkt, struct ether_addr *eaddr, int broadcast)
     133#define PKT_HEADER_SIZE (20 + 16*6)
     134static int fill_pkt_header(unsigned char *pkt, struct ether_addr *eaddr, int broadcast)
    137135{
    138136    int i;
     
    157155    }
    158156
    159     return 20 + 16*6; /* length of packet */
     157    return PKT_HEADER_SIZE; /* length of packet */
    160158}
    161159
     
    199197    int s;  /* Raw socket */
    200198    int pktsize;
    201     unsigned char outpack[1000];
     199    unsigned char outpack[PKT_HEADER_SIZE + 6 /* max passwd size */ + 16 /* paranoia */];
    202200
    203201    struct ether_addr eaddr;
     
    221219
    222220    /* fill out the header of the packet */
    223     pktsize = get_fill(outpack, &eaddr, flags /* & 1 OPT_BROADCAST */);
     221    pktsize = fill_pkt_header(outpack, &eaddr, flags /* & 1 OPT_BROADCAST */);
    224222
    225223    bb_debug_dump_packet(outpack, pktsize);
Note: See TracChangeset for help on using the changeset viewer.