当前位置: 首页>>代码示例>>C++>>正文


C++ random_ether_addr函数代码示例

本文整理汇总了C++中random_ether_addr函数的典型用法代码示例。如果您正苦于以下问题:C++ random_ether_addr函数的具体用法?C++ random_ether_addr怎么用?C++ random_ether_addr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了random_ether_addr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cellvision_mac_setup

void __init cellvision_mac_setup(void)
{
	u8 mac_base[6];
	int err;

	err = admboot_get_mac_base(CELLVISION_CONFIG_OFFSET,
				   CELLVISION_CONFIG_SIZE, mac_base);

	if ((err) || !is_valid_ether_addr(mac_base))
		random_ether_addr(mac_base);

	adm5120_setup_eth_macs(mac_base);
}
开发者ID:pzhaoyang,项目名称:OpenWRT,代码行数:13,代码来源:cellvision.c

示例2: pmugw_setup_mac

static __init void pmugw_setup_mac(void)
{
	u8 mac_base[6];
	int err;

	err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
				   PMUGW_CONFIG_SIZE, mac_base);

	if ((err) || !is_valid_ether_addr(mac_base))
		random_ether_addr(mac_base);

	adm5120_setup_eth_macs(mac_base);
}
开发者ID:Cribstone,项目名称:linino,代码行数:13,代码来源:pmugw.c

示例3: rmnet_setup

static void __init rmnet_setup(struct net_device *dev)
{
	dev->netdev_ops = &rmnet_ops;

	/* dev->watchdog_timeo = 20; ??? */
	dev->watchdog_timeo = (2 * HZ);

	ether_setup(dev);

	//dev->change_mtu = 0; /* ??? */

	random_ether_addr(dev->dev_addr);
}
开发者ID:JmzTaylor,项目名称:kernel_gb_marvelc,代码行数:13,代码来源:msm_rmnet.c

示例4: rmnet_setup

static void __init rmnet_setup(struct net_device *dev)
{
	
	dev->netdev_ops = &rmnet_ops_ether;
	ether_setup(dev);

	
	dev->mtu = RMNET_DATA_LEN;
	dev->needed_headroom = HEADROOM_FOR_SDIO + HEADROOM_FOR_QOS ;
	dev->needed_tailroom = TAILROOM;
	random_ether_addr(dev->dev_addr);

	dev->watchdog_timeo = 1000; 
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:14,代码来源:msm_rmnet_sdio.c

示例5: cpmac_get_mac

static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
{
	char name[5], *mac;

	sprintf(name, "mac%c", 'a' + instance);
	mac = prom_getenv(name);
	if (!mac && instance) {
		sprintf(name, "mac%c", 'a');
		mac = prom_getenv(name);
	}

	if (mac) {
		if (sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
					&dev_addr[0], &dev_addr[1],
					&dev_addr[2], &dev_addr[3],
					&dev_addr[4], &dev_addr[5]) != 6) {
			pr_warning("cannot parse mac address, "
					"using random address\n");
			random_ether_addr(dev_addr);
		}
	} else
		random_ether_addr(dev_addr);
}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:23,代码来源:platform.c

示例6: rmnet_setup

static void __init rmnet_setup(struct net_device *dev)
{
	/* Using Ethernet mode by default */
	dev->netdev_ops = &rmnet_ops_ether;
	ether_setup(dev);

	/* set this after calling ether_setup */
	dev->mtu = RMNET_DATA_LEN;
	dev->needed_headroom = HEADROOM_FOR_BAM + HEADROOM_FOR_QOS ;
	dev->needed_tailroom = TAILROOM;
	random_ether_addr(dev->dev_addr);

	dev->watchdog_timeo = 1000; /* 10 seconds? */
}
开发者ID:fantomlez,项目名称:android_kernel_acer_hemingway,代码行数:14,代码来源:msm_rmnet_bam.c

示例7: niit_dev_setup

static void niit_dev_setup(struct net_device *dev) {
	ether_setup(dev);
	memset(netdev_priv(dev), 0, sizeof(struct niit_tunnel));

//#ifdef HAVE_NET_DEVICE_OPS
#if !(defined CONFIG_COMPAT_NET_DEV_OPS) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30)
	dev->netdev_ops = &niit_netdev_ops;
#endif
	dev->destructor = free_netdev;
	dev->type = ARPHRD_ETHER;
	dev->mtu = ETH_DATA_LEN - sizeof(struct ipv6hdr);
	dev->flags = IFF_NOARP;
	random_ether_addr(dev->dev_addr);
}
开发者ID:SchallumPierre,项目名称:fabfi,代码行数:14,代码来源:niit.c

示例8: rmnet_usb_setup

static void rmnet_usb_setup(struct net_device *dev)
{
	/* Using Ethernet mode by default */
	dev->netdev_ops = &rmnet_usb_ops_ether;

	/* set this after calling ether_setup */
	dev->mtu = RMNET_DATA_LEN;

	/* for QOS header */
	dev->needed_headroom = RMNET_HEADROOM;

	random_ether_addr(dev->dev_addr);
	dev->watchdog_timeo = 1000; /* 10 seconds? */
}
开发者ID:AICP,项目名称:kernel_moto_shamu,代码行数:14,代码来源:rmnet_usb_data.c

示例9: dummy_setup

static void dummy_setup(struct net_device *dev)
{
	ether_setup(dev);

	/* Initialize the device structure. */
	dev->netdev_ops = &dummy_netdev_ops;
	dev->destructor = free_netdev;

	/* Fill in device structure with ethernet-generic values. */
	dev->tx_queue_len = 0;
	dev->flags |= IFF_NOARP;
	dev->flags &= ~IFF_MULTICAST;
	random_ether_addr(dev->dev_addr);
}
开发者ID:3null,项目名称:fastsocket,代码行数:14,代码来源:dummy.c

示例10: setup_etheraddr

static void setup_etheraddr(char *str, unsigned char *addr, char *name)
{
	char *end;
	int i;

	if(str == NULL)
		goto random;

	for(i=0;i<6;i++){
		addr[i] = simple_strtoul(str, &end, 16);
		if((end == str) ||
		   ((*end != ':') && (*end != ',') && (*end != '\0'))){
			printk(KERN_ERR
			       "setup_etheraddr: failed to parse '%s' "
			       "as an ethernet address\n", str);
			goto random;
		}
		str = end + 1;
	}
	if (is_multicast_ether_addr(addr)) {
		printk(KERN_ERR
		       "Attempt to assign a multicast ethernet address to a "
		       "device disallowed\n");
		goto random;
	}
	if (!is_valid_ether_addr(addr)) {
		printk(KERN_ERR
		       "Attempt to assign an invalid ethernet address to a "
		       "device disallowed\n");
		goto random;
	}
	if (!is_local_ether_addr(addr)) {
		printk(KERN_WARNING
		       "Warning: attempt to assign a globally valid ethernet "
		       "address to a device\n");
		printk(KERN_WARNING "You should better enable the 2nd "
		       "rightmost bit in the first byte of the MAC,\n");
		printk(KERN_WARNING "i.e. %02x:%02x:%02x:%02x:%02x:%02x\n",
		       addr[0] | 0x02, addr[1], addr[2], addr[3], addr[4],
		       addr[5]);
		goto random;
	}
	return;

random:
	printk(KERN_INFO
	       "Choosing a random ethernet address for device %s\n", name);
	random_ether_addr(addr);
}
开发者ID:jnfeinstein,项目名称:asuswrt-merlin,代码行数:49,代码来源:net_kern.c

示例11: eb214a_mac_setup

static void __init eb214a_mac_setup(void)
{
	u8 mac_base[6];
	u8 *cfg;
	int i;

	cfg = (u8 *) KSEG1ADDR(ADM5120_SRAM0_BASE + EB214A_CONFIG_OFFSET);
	for (i = 0; i < 6; i++)
		mac_base[i] = cfg[i];

	if (!is_valid_ether_addr(mac_base))
		random_ether_addr(mac_base);

	adm5120_setup_eth_macs(mac_base);
}
开发者ID:ETegro,项目名称:OpenSAN,代码行数:15,代码来源:eb-214a.c

示例12: ifb_setup

static void ifb_setup(struct net_device *dev)
{
	/* Initialize the device structure. */
	dev->destructor = free_netdev;
	dev->netdev_ops = &ifb_netdev_ops;

	/* Fill in device structure with ethernet-generic values. */
	ether_setup(dev);
	dev->tx_queue_len = TX_Q_LIMIT;

	dev->flags |= IFF_NOARP;
	dev->flags &= ~IFF_MULTICAST;
	dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
	random_ether_addr(dev->dev_addr);
}
开发者ID:lhllacp,项目名称:SourceInsight,代码行数:15,代码来源:ifb.c

示例13: virtnet_setup

static void virtnet_setup(struct net_device *dev)
{
	ether_setup(dev);//设置ether设备

	/* Initialize the device structure. */
	dev->netdev_ops = &dummy_netdev_ops;
	//dev->destructor = dummy_dev_free;

	/* Fill in device structure with ethernet-generic values. */
	//dev->tx_queue_len = 0;
	dev->flags |= IFF_NOARP;//不支持ARP协议
	//dev->flags &= ~IFF_MULTICAST;
	dev->features	|= NETIF_F_NO_CSUM ;
	random_ether_addr(dev->dev_addr);
}
开发者ID:jefby,项目名称:tiny6410_driver,代码行数:15,代码来源:virtnet.c

示例14: br_dev_setup

void br_dev_setup(struct net_device *dev)
{
	random_ether_addr(dev->dev_addr);
	ether_setup(dev);

	dev->netdev_ops = &br_netdev_ops;
	dev->destructor = free_netdev;
	SET_ETHTOOL_OPS(dev, &br_ethtool_ops);
	dev->tx_queue_len = 0;
	dev->priv_flags = IFF_EBRIDGE;

	dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
			NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX |
			NETIF_F_NETNS_LOCAL | NETIF_F_GSO;
}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:15,代码来源:br_device.c

示例15: ovs_dp_get_net

static struct vport *patch_create(const struct vport_parms *parms)
{
	struct vport *vport;
	struct patch_vport *patch_vport;
	const char *peer_name;
	struct patch_config *patchconf;
	struct net *net = ovs_dp_get_net(parms->dp);
	int err;

	vport = ovs_vport_alloc(sizeof(struct patch_vport),
				&ovs_patch_vport_ops, parms);
	if (IS_ERR(vport)) {
		err = PTR_ERR(vport);
		goto error;
	}

	patch_vport = patch_vport_priv(vport);

	strcpy(patch_vport->name, parms->name);

	patchconf = kmalloc(sizeof(struct patch_config), GFP_KERNEL);
	if (!patchconf) {
		err = -ENOMEM;
		goto error_free_vport;
	}

	err = patch_set_config(vport, parms->options, patchconf);
	if (err)
		goto error_free_patchconf;

	random_ether_addr(patchconf->eth_addr);

	rcu_assign_pointer(patch_vport->patchconf, patchconf);

	peer_name = patchconf->peer_name;
	hlist_add_head(&patch_vport->hash_node, hash_bucket(net, peer_name));
	rcu_assign_pointer(patch_vport->peer, ovs_vport_locate(net, peer_name));
	update_peers(net, patch_vport->name, vport);

	return vport;

error_free_patchconf:
	kfree(patchconf);
error_free_vport:
	ovs_vport_free(vport);
error:
	return ERR_PTR(err);
}
开发者ID:AlickHill,项目名称:Lantern,代码行数:48,代码来源:vport-patch.c


注:本文中的random_ether_addr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。