• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ random_ether_addr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: wrn_endpoint_probe

int wrn_endpoint_probe(struct net_device *dev)
{
	struct wrn_ep *ep = netdev_priv(dev);
	int epnum, err;
	u32 val;

	epnum = ep->ep_number;

	/* Check whether the ep has been sinthetized or not */
	val = readl(&ep->ep_regs->IDCODE);
	if (val != WRN_EP_MAGIC) {
		pr_info(DRV_NAME "EP%i (%s) has not been sintethized\n",
			ep->ep_number, dev->name);
		return -ENODEV;
	}
	/* Errors different from -ENODEV are fatal to insmod */

	dev_alloc_name(dev, "wr%d");
	wrn_netops_init(dev); /* function in ./nic-core.c */
	wrn_ethtool_init(dev); /* function in ./ethtool.c */
	/* Napi is not supported on this device */

	ep->mii.dev = dev;		/* Support for ethtool */
	ep->mii.mdio_read = wrn_phy_read;
	ep->mii.mdio_write = wrn_phy_write;
	ep->mii.phy_id = 0;
	ep->mii.phy_id_mask = 0x1f;
	ep->mii.reg_num_mask = 0x1f;

	ep->mii.force_media = 0;
	ep->mii.advertising = ADVERTISE_1000XFULL;
	ep->mii.full_duplex = 1;

	/* Finally, register and succeed, or fail and undo */
	err = register_netdev(dev);
	if (err) {
		printk(KERN_ERR DRV_NAME "Can't register dev %s\n",
		       dev->name);
		__wrn_endpoint_shutdown(ep);
		/* ENODEV means "no more" for the caller, so avoid it */
		return err == -ENODEV ? -EIO : err;
	}

	/* randomize a MAC address, so lazy users can avoid ifconfig */
	random_ether_addr(dev->dev_addr);

	return 0;
}
开发者ID:bradomyn,项目名称:sflow_driver,代码行数:48,代码来源:endpoint.c


示例17: rmnet_vnd_setup

/* Called by kernel whenever a new rmnet<n> device is created. Sets MTU,
 * flags, ARP type, needed headroom, etc...
 */
void rmnet_vnd_setup(struct net_device *rmnet_dev)
{
	rmnet_dev->netdev_ops = &rmnet_vnd_ops;
	rmnet_dev->mtu = RMNET_DFLT_PACKET_SIZE;
	rmnet_dev->needed_headroom = RMNET_NEEDED_HEADROOM;
	random_ether_addr(rmnet_dev->dev_addr);
	rmnet_dev->tx_queue_len = RMNET_TX_QUEUE_LEN;

	/* Raw IP mode */
	rmnet_dev->header_ops = NULL;  /* No header */
	rmnet_dev->type = ARPHRD_RAWIP;
	rmnet_dev->hard_header_len = 0;
	rmnet_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);

	rmnet_dev->needs_free_netdev = true;
}
开发者ID:mkrufky,项目名称:linux,代码行数:19,代码来源:rmnet_vnd.c


示例18: dummy_setup

static void __init dummy_setup(struct net_device *dev)
{
    /* Initialize the device structure. */
    dev->get_stats = dummy_get_stats;
    dev->hard_start_xmit = dummy_xmit;
    dev->set_multicast_list = set_multicast_list;
    dev->set_mac_address = dummy_set_address;

    /* Fill in device structure with ethernet-generic values. */
    ether_setup(dev);
    dev->tx_queue_len = 0;
    dev->change_mtu = NULL;
    dev->flags |= IFF_NOARP;
    dev->flags &= ~IFF_MULTICAST;
    random_ether_addr(dev->dev_addr);
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:16,代码来源:dummy.c


示例19: ifb_setup

static void __init ifb_setup(struct net_device *dev)
{
	/* Initialize the device structure. */
	dev->get_stats = ifb_get_stats;
	dev->hard_start_xmit = ifb_xmit;
	dev->open = &ifb_open;
	dev->stop = &ifb_close;

	/* Fill in device structure with ethernet-generic values. */
	ether_setup(dev);
	dev->tx_queue_len = TX_Q_LIMIT;
	dev->change_mtu = NULL;
	dev->flags |= IFF_NOARP;
	dev->flags &= ~IFF_MULTICAST;
	SET_MODULE_OWNER(dev);
	random_ether_addr(dev->dev_addr);
}
开发者ID:ena30,项目名称:snake-os,代码行数:17,代码来源:ifb.c


示例20: seth_dev_create

static int __devinit seth_dev_create(unsigned int device_count)
{
	struct net_device* netdev;
	SEth* seth;
	int ret;

	netdev = alloc_netdev(sizeof(SEth), "veth%d", ether_setup);
	if (!netdev) {
		SETH_ERR ("alloc_netdev() failed.\n");
		return -ENOMEM;
	}
	seth = netdev_priv (netdev);
	seth->netdev = netdev;
	seth->tty_index = TTY_INDEX_BASE + device_count;

#ifdef HAVE_NET_DEVICE_OPS
	netdev->netdev_ops = &seth_ops;
#else
	netdev->open = seth_open;
	netdev->stop = seth_close;
	netdev->hard_start_xmit = seth_start_xmit;
	netdev->get_stats = seth_get_stats;
	netdev->set_multicast_list = seth_set_multicast_list;
	netdev->tx_timeout = seth_tx_timeout;
#endif
	netdev->watchdog_timeo = 3*HZ;
	netdev->irq = 0;
	netdev->dma = 0;

	netdev->flags &= ~IFF_MULTICAST;
	netdev->flags &= ~IFF_BROADCAST;
	netdev->flags |= IFF_NOARP;

	random_ether_addr(netdev->dev_addr);

	/* register new Ethernet interface */
	if ((ret = register_netdev (netdev))) {
		SETH_ERR ("register_netdev() failed (%d)\n", ret);
		free_netdev(netdev);
		return ret;
	}

	seth_devices[seth_devices_num++] = seth;

	return 0;
}
开发者ID:ItsAnilSingh,项目名称:android_kernel_samsung_logan2g,代码行数:46,代码来源:seth.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ random_get_bytes函数代码示例发布时间:2022-05-30
下一篇:
C++ random_distribution函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap