mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-22 17:40:34 +00:00
net: add ipv4 test
This commit is contained in:
4
build.mk
4
build.mk
@@ -19,7 +19,7 @@ CXXFLAGS += -pthread
|
||||
# Ubuntu fails without this, see https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1228201
|
||||
CXXFLAGS += -Wl,--no-as-needed
|
||||
|
||||
tests = test-reactor fileiotest virtiotest l3_test
|
||||
tests = test-reactor fileiotest virtiotest l3_test ip_test
|
||||
|
||||
link = $(CXX) $(CXXFLAGS) -o $@ $^
|
||||
|
||||
@@ -44,4 +44,6 @@ virtiotest: virtiotest.o virtio.o reactor.o net.o ip.o ethernet.o arp.o
|
||||
|
||||
l3_test: l3_test.o virtio.o reactor.o net.o ip.o ethernet.o arp.o
|
||||
|
||||
ip_test: ip_test.o virtio.o reactor.o net.o ip.o arp.o ethernet.o
|
||||
|
||||
-include *.d
|
||||
|
||||
24
ip_test.cc
Normal file
24
ip_test.cc
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Cloudius Systems, Ltd.
|
||||
*/
|
||||
|
||||
#include "arp.hh"
|
||||
#include "ip.hh"
|
||||
#include "net.hh"
|
||||
#include "reactor.hh"
|
||||
#include "virtio.hh"
|
||||
|
||||
using namespace net;
|
||||
|
||||
int main(int ac, char** av) {
|
||||
auto vnet = create_virtio_net_device("tap0");
|
||||
interface netif(std::move(vnet));
|
||||
netif.run();
|
||||
ipv4 inet(&netif);
|
||||
inet.set_host_address(ipv4_address(0xc0a87a02));
|
||||
the_reactor.run();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user