netconsole.c (99f823f98fb981b55c663a3783c3d2293958ece4) | netconsole.c (4940fc889e1e63667a15243028ddcd84d471cd8e) |
---|---|
1/* 2 * linux/drivers/net/netconsole.c 3 * 4 * Copyright (C) 2001 Ingo Molnar <mingo@redhat.com> 5 * 6 * This file contains the implementation of an IRQ-safe, crash-safe 7 * kernel console implementation that outputs kernel messages to the 8 * network. --- 415 unchanged lines hidden (view full) --- 424 return strnlen(buf, count); 425} 426 427static ssize_t store_remote_mac(struct netconsole_target *nt, 428 const char *buf, 429 size_t count) 430{ 431 u8 remote_mac[ETH_ALEN]; | 1/* 2 * linux/drivers/net/netconsole.c 3 * 4 * Copyright (C) 2001 Ingo Molnar <mingo@redhat.com> 5 * 6 * This file contains the implementation of an IRQ-safe, crash-safe 7 * kernel console implementation that outputs kernel messages to the 8 * network. --- 415 unchanged lines hidden (view full) --- 424 return strnlen(buf, count); 425} 426 427static ssize_t store_remote_mac(struct netconsole_target *nt, 428 const char *buf, 429 size_t count) 430{ 431 u8 remote_mac[ETH_ALEN]; |
432 char *p = (char *) buf; 433 int i; | |
434 435 if (nt->enabled) { 436 printk(KERN_ERR "netconsole: target (%s) is enabled, " 437 "disable to update parameters\n", 438 config_item_name(&nt->item)); 439 return -EINVAL; 440 } 441 | 432 433 if (nt->enabled) { 434 printk(KERN_ERR "netconsole: target (%s) is enabled, " 435 "disable to update parameters\n", 436 config_item_name(&nt->item)); 437 return -EINVAL; 438 } 439 |
442 for (i = 0; i < ETH_ALEN - 1; i++) { 443 remote_mac[i] = simple_strtoul(p, &p, 16); 444 if (*p != ':') 445 goto invalid; 446 p++; 447 } 448 remote_mac[ETH_ALEN - 1] = simple_strtoul(p, &p, 16); 449 if (*p && (*p != '\n')) 450 goto invalid; 451 | 440 if (!mac_pton(buf, remote_mac)) 441 return -EINVAL; 442 if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n') 443 return -EINVAL; |
452 memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN); 453 454 return strnlen(buf, count); | 444 memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN); 445 446 return strnlen(buf, count); |
455 456invalid: 457 printk(KERN_ERR "netconsole: invalid input\n"); 458 return -EINVAL; | |
459} 460 461/* 462 * Attribute definitions for netconsole_target. 463 */ 464 465#define NETCONSOLE_TARGET_ATTR_RO(_name) \ 466static struct netconsole_target_attr netconsole_target_##_name = \ --- 341 unchanged lines hidden --- | 447} 448 449/* 450 * Attribute definitions for netconsole_target. 451 */ 452 453#define NETCONSOLE_TARGET_ATTR_RO(_name) \ 454static struct netconsole_target_attr netconsole_target_##_name = \ --- 341 unchanged lines hidden --- |