- netdev_dev = xzalloc(sizeof *netdev_dev);
- netdev_dev_init(&netdev_dev->netdev_dev, name, class);
- netdev_dev->hwaddr[0] = 0x55;
- netdev_dev->hwaddr[1] = 0xaa;
- netdev_dev->hwaddr[2] = n >> 24;
- netdev_dev->hwaddr[3] = n >> 16;
- netdev_dev->hwaddr[4] = n >> 8;
- netdev_dev->hwaddr[5] = n;
- netdev_dev->mtu = 1500;
- netdev_dev->flags = 0;
- netdev_dev->change_seq = 1;
- memset(&netdev_dev->remote_addr, 0, sizeof(netdev_dev->remote_addr));
- netdev_dev->got_remote_ip = false;
- netdev_dev->connected = false;
-
-
- netdev_dev->sockfd = inet_open_passive(SOCK_DGRAM, "", 0, &netdev_dev->local_addr, 0);
- if (netdev_dev->sockfd < 0) {
- error = netdev_dev->sockfd;
- goto error;
+static int
+netdev_tunnel_construct(struct netdev *netdev_)
+{
+ static atomic_uint next_n = ATOMIC_VAR_INIT(0);
+ struct netdev_tunnel *netdev = netdev_tunnel_cast(netdev_);
+ unsigned int n;
+
+ atomic_add(&next_n, 1, &n);
+
+ ovs_mutex_init(&netdev->mutex);
+ netdev->hwaddr[0] = 0xfe;
+ netdev->hwaddr[1] = 0xff;
+ netdev->hwaddr[2] = 0xff;
+ netdev->hwaddr[3] = n >> 16;
+ netdev->hwaddr[4] = n >> 8;
+ netdev->hwaddr[5] = n;
+ netdev->flags = 0;
+ netdev->change_seq = 1;
+ memset(&netdev->remote_addr, 0, sizeof(netdev->remote_addr));
+ netdev->valid_remote_ip = false;
+ netdev->valid_remote_port = false;
+ netdev->connected = false;
+
+
+ netdev->sockfd = inet_open_passive(SOCK_DGRAM, "", 0, &netdev->local_addr, 0);
+ if (netdev->sockfd < 0) {
+ return netdev->sockfd;