static struct netconsole_target *alloc_param_target(char *target_config)
{
	int err = -ENOMEM;
	struct netconsole_target *nt;

	nt = kzalloc(sizeof(*nt), GFP_KERNEL);
	if (!nt)
		goto fail;

	nt->np.name = "netconsole";
	strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
	nt->np.local_port = 6665;
	nt->np.remote_port = 6666;
	memset(nt->np.remote_mac, 0xff, ETH_ALEN);

	
	err = netpoll_parse_options(&nt->np, target_config);
	if (err)
		goto fail;

	err = netpoll_setup(&nt->np);
	if (err)
		goto fail;

	nt->enabled = 1;

	return nt;

fail:
	kfree(nt);
	return ERR_PTR(err);
}
Exemple #2
0
/*..........................................................................*/
void QF_onStartup(void)
{
#ifdef Q_SPY
	int rc;
	char *target_config = "@/,[email protected]/00:13:72:f7:14:73";

	np.name = "QSPY";
	strlcpy(np.dev_name, "eth0", IFNAMSIZ);
	np.local_port  = 6600;
	np.remote_port = 6601;
	memset(np.remote_mac, 0xff, ETH_ALEN);

	rc = netpoll_parse_options(&np, target_config);
	if (rc == 0) {
		rc = netpoll_setup(&np);
	}
	if (rc)
		np.dev = NULL;
	printk("rc: %d, %p\n", rc, np.dev);

	idle_running = 1;
	kthread_run(idleThread, NULL, "AO_Idle");
	complete(&idle_done);
#endif
}
/* Allocate new target (from boot/module param) and setup netpoll for it */
static struct brcm_netconsole_target *alloc_param_target(char *target_config)
{
	int err = -ENOMEM;
	struct brcm_netconsole_target *nt;
	u8 remote_mac[ETH_ALEN];

	/*
	 * Allocate and initialize with defaults.
	 * Note that these targets get their config_item fields zeroed-out.
	 */
	nt = kzalloc(sizeof(*nt), GFP_KERNEL);
	if (!nt) {
		pr_err("brcm_netconsole: failed to allocate memory\n");
		goto fail;
	}

	nt->np.name = "brcm_netconsole";
	strlcpy(nt->np.dev_name, "rndis0", IFNAMSIZ);
	nt->np.local_port = 5042;
	nt->np.remote_port = 5042;
	remote_mac[0] = 0xaa;
	remote_mac[1] = 0xbb;
	remote_mac[2] = 0xcc;
	remote_mac[3] = 0xdd;
	remote_mac[4] = 0xee;
	remote_mac[5] = 0xff;
	memcpy(nt->np.remote_mac, remote_mac, ETH_ALEN);
	nt->np.remote_ip = in_aton("255.255.255.255");
	nt->np.local_ip = in_aton("192.168.42.129");

	/* Parse parameters and setup netpoll */
#if 0				/* kevin */
	err = netpoll_parse_options(&nt->np, target_config);
	if (err)
		goto fail;
#endif

	err = netpoll_setup(&nt->np);
	if (err)
		goto fail;

	nt->enabled = 1;
	nt_enabled = TRUE;

	return nt;

fail:
	kfree(nt);
	return ERR_PTR(err);
}
Exemple #4
0
/* Allocate new target (from boot/module param) and setup netpoll for it */
static struct netpoll_target *alloc_param_target(struct netpoll_targets *nts,
						 char *target_config)
{
	int err = -ENOMEM;
	struct netpoll_target *nt;

	/*
	 * Allocate and initialize with defaults.
	 * Note that these targets get their config_item fields zeroed-out.
	 */
	nt = kzalloc(sizeof(*nt), GFP_KERNEL);
	if (!nt) {
		printk(KERN_ERR "%s: failed to allocate memory\n",
		       nts->subsys_name);
		goto fail;
	}

	nt->nts = nts;
	nt->np.name = nts->subsys_name;
	strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
	nt->np.local_port = nts->default_local_port;
	nt->np.remote_port = nts->default_remote_port;
	memset(nt->np.remote_mac, 0xff, ETH_ALEN);
	INIT_WORK(&nt->cleanup_work, deferred_netpoll_cleanup);

	/* Parse parameters and setup netpoll */
	err = netpoll_parse_options(&nt->np, target_config);
	if (err)
		goto fail;

	err = netpoll_setup(&nt->np);
	if (err)
		goto fail;

	nt->np_state = NETPOLL_ENABLED;

	return nt;

fail:
	kfree(nt);
	return ERR_PTR(err);
}
/* Allocate new target (from boot/module param) and setup netpoll for it */
static struct netconsole_target *alloc_param_target(char *target_config)
{
	int err = -ENOMEM;
	struct netconsole_target *nt;

	/*
	 * Allocate and initialize with defaults.
	 * Note that these targets get their config_item fields zeroed-out.
	 */
	nt = kzalloc(sizeof(*nt), GFP_KERNEL);
	if (!nt) {
		printk(KERN_ERR "netconsole: failed to allocate memory\n");
		goto fail;
	}

	nt->np.name = "netconsole";
	strlcpy(nt->np.dev_name, "eth0", IFNAMSIZ);
	nt->np.local_port = 6665;
	nt->np.remote_port = 6666;
	memset(nt->np.remote_mac, 0xff, ETH_ALEN);

	/* Parse parameters and setup netpoll */
	err = netpoll_parse_options(&nt->np, target_config);
	if (err)
		goto fail;

	err = netpoll_setup(&nt->np);
	if (err)
		goto fail;

	nt->enabled = 1;

	return nt;

fail:
	kfree(nt);
	return ERR_PTR(err);
}
Exemple #6
0
static int option_setup(char *opt)
{
	return !netpoll_parse_options(&np, opt);
}
Exemple #7
0
/* We must be passed configuration options. */
static int option_setup(char *opt)
{
	configured = !netpoll_parse_options(&np, opt);
	return 0;
}