]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* |
2 | * This file is open source software, licensed to you under the terms | |
3 | * of the Apache License, Version 2.0 (the "License"). See the NOTICE file | |
4 | * distributed with this work for additional information regarding copyright | |
5 | * ownership. You may not use this file except in compliance with the License. | |
6 | * | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.apache.org/licenses/LICENSE-2.0 | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, | |
12 | * software distributed under the License is distributed on an | |
13 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
14 | * KIND, either express or implied. See the License for the | |
15 | * specific language governing permissions and limitations | |
16 | * under the License. | |
17 | */ | |
18 | /* | |
19 | * Copyright (C) 2014 Cloudius Systems, Ltd. | |
20 | */ | |
21 | ||
22 | #include <seastar/net/net.hh> | |
23 | #include <seastar/core/reactor.hh> | |
24 | #include <seastar/net/virtio.hh> | |
20effc67 | 25 | #include <seastar/net/native-stack.hh> |
11fdf7f2 TL |
26 | #include <iostream> |
27 | ||
28 | using namespace seastar; | |
29 | using namespace net; | |
30 | ||
31 | void dump_arp_packets(l3_protocol& proto) { | |
9f95a23c TL |
32 | // FIXME: ignored future |
33 | (void)proto.receive([] (packet p, ethernet_address from) { | |
11fdf7f2 TL |
34 | std::cout << "seen arp packet\n"; |
35 | return make_ready_future<>(); | |
36 | }, [] (forward_hash& out_hash_data, packet& p, size_t off) {return false;}); | |
37 | } | |
38 | ||
39 | int main(int ac, char** av) { | |
20effc67 | 40 | native_stack_options opts; |
11fdf7f2 | 41 | |
20effc67 | 42 | auto vnet = create_virtio_net_device(opts.virtio_opts, opts.lro); |
11fdf7f2 | 43 | interface netif(std::move(vnet)); |
f67539c2 | 44 | l3_protocol arp(&netif, eth_protocol_num::arp, []{ return std::optional<l3_protocol::l3packet>(); }); |
11fdf7f2 TL |
45 | dump_arp_packets(arp); |
46 | engine().run(); | |
47 | return 0; | |
48 | } | |
49 |