svn commit: r211076 - projects/sv/sys/net

Attilio Rao attilio at freebsd.org
Sun Aug 8 16:17:29 UTC 2010


Yes, I'm still considering more options for it, like usage of fail(9)
as suggested by emaste.

Thanks,
Attilio


2010/8/8 Kostik Belousov <kostikbel at gmail.com>:
> On Sun, Aug 08, 2010 at 03:44:43PM +0000, Attilio Rao wrote:
>> Author: attilio
>> Date: Sun Aug  8 15:44:43 2010
>> New Revision: 211076
>> URL: http://svn.freebsd.org/changeset/base/211076
>>
>> Log:
>>   - Compile netdump.debug.force just when NETDUMP_DEBUG in included
>>   - Fix the usage of nd_force_crash which is not necessarilly to have
>>     a static storage
>>
>> Modified:
>>   projects/sv/sys/net/netdump_client.c
>>
>> Modified: projects/sv/sys/net/netdump_client.c
>> ==============================================================================
>> --- projects/sv/sys/net/netdump_client.c      Sun Aug  8 15:35:17 2010        (r211075)
>> +++ projects/sv/sys/net/netdump_client.c      Sun Aug  8 15:44:43 2010        (r211076)
>> @@ -146,7 +146,9 @@ static int         netdump_send_arp(void);
>>  static void   netdump_trigger(void *arg, int howto);
>>  static int    netdump_udp_output(struct mbuf *m);
>>
>> +#ifdef NETDUMP_DEBUG
>>  static int    sysctl_force_crash(SYSCTL_HANDLER_ARGS);
>> +#endif
>>  static int    sysctl_ip(SYSCTL_HANDLER_ARGS);
>>  static int    sysctl_nic(SYSCTL_HANDLER_ARGS);
>>
>> @@ -166,7 +168,6 @@ static int nd_enable = 0;  /* if we shou
>>  static struct in_addr nd_server = {INADDR_ANY}; /* server address */
>>  static struct in_addr nd_client = {INADDR_ANY}; /* client (our) address */
>>  struct ifnet *nd_nic = NULL;
>> -static int nd_force_crash=0;
>>  static int nd_polls=10000; /* Times to poll the NIC (0.5ms each poll) before
>>                           * assuming packetloss occurred: 5s by default */
>>  static int nd_retries=10; /* Times to retransmit lost packets */
>> @@ -292,16 +293,18 @@ sysctl_nic(SYSCTL_HANDLER_ARGS)
>>       return error;
>>  }
>>
>> +#ifdef NETDUMP_DEBUG
>>  static int
>>  sysctl_force_crash(SYSCTL_HANDLER_ARGS)
>>  {
>> -     int error;
>> +     int error, force_crash;
>>
>> -     error = sysctl_handle_int(oidp, &nd_force_crash, nd_force_crash, req);
>> +     force_crash = 0;
>> +     error = sysctl_handle_int(oidp, &force_crash, force_crash, req);
>>       if (error || req->newptr == NULL)
>>               return error;
>>
>> -     switch (nd_force_crash) {
>> +     switch (force_crash) {
>>               case 1:
>>                       printf("\nLivelocking system...\n");
>>                       for (;;);
>> @@ -329,6 +332,7 @@ sysctl_force_crash(SYSCTL_HANDLER_ARGS)
>>       }
>>       return 0;
>>  }
>> +#endif
>>
>>  SYSCTL_NODE(_net, OID_AUTO, dump, CTLFLAG_RW, 0, "netdump");
>>  SYSCTL_PROC(_net_dump, OID_AUTO, server, CTLTYPE_STRING|CTLFLAG_RW, &nd_server,
>> @@ -337,8 +341,6 @@ SYSCTL_PROC(_net_dump, OID_AUTO, client,
>>       0, sysctl_ip, "A", "dump client");
>>  SYSCTL_PROC(_net_dump, OID_AUTO, nic, CTLTYPE_STRING|CTLFLAG_RW, &nd_nic,
>>       IFNAMSIZ, sysctl_nic, "A", "NIC to dump on");
>> -SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW,
>> -     0, sizeof(nd_force_crash), sysctl_force_crash, "I", "force crashing");
>>  SYSCTL_INT(_net_dump, OID_AUTO, polls, CTLTYPE_INT|CTLFLAG_RW, &nd_polls, 0,
>>       "times to poll NIC per retry");
>>  SYSCTL_INT(_net_dump, OID_AUTO, retries, CTLTYPE_INT|CTLFLAG_RW, &nd_retries, 0,
>> @@ -346,6 +348,10 @@ SYSCTL_INT(_net_dump, OID_AUTO, retries,
>>  SYSCTL_INT(_net_dump, OID_AUTO, enable, CTLTYPE_INT|CTLFLAG_RW, &nd_enable,
>>       0, "enable network dump");
>>  TUNABLE_INT("net.dump.enable", &nd_enable);
>> +#ifdef NETDUMP_DEBUG
>> +SYSCTL_PROC(_net_dump, OID_AUTO, crash, CTLTYPE_INT|CTLFLAG_RW, 0, sizeof(int),
>> +    sysctl_force_crash, "I", "force crashing");
>> +#endif
>
> We have debug.kdb.panic and friends. Might be, it makes sense to move
> net.dump.crash there ? debug. looks as a more logical choice for most
> sysctls too.
>



-- 
Peace can only be achieved by understanding - A. Einstein


More information about the svn-src-projects mailing list