mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-29 18:18:54 +00:00
nic bridge: connect to backend NIC on startup
After announcing the NIC service, the bridge connects to the driver to ensure to see any incoming traffic in case the client itself only reacts on connects from LAN (e.g., the netperf server). Also, some styling issues were fixed.
This commit is contained in:
parent
f1dcaa746d
commit
3056c718c8
@ -139,9 +139,9 @@ Session_component::Session_component(Genode::Allocator *allocator,
|
|||||||
set_ipv4_address(ip);
|
set_ipv4_address(ip);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PDBG("\nmac=%02x.%02x.%02x.%02x.%02x.%02x ip=%d.%d.%d.%d",
|
PLOG("vmac=%02x:%02x:%02x:%02x:%02x:%02x ip=%d.%d.%d.%d",
|
||||||
vmac.addr[0], vmac.addr[1], vmac.addr[2],
|
vmac.addr[0], vmac.addr[1], vmac.addr[2],
|
||||||
vmac.addr[3], vmac.addr[4], vmac.addr[5],
|
vmac.addr[3], vmac.addr[4], vmac.addr[5],
|
||||||
ip.addr[0], ip.addr[1], ip.addr[2], ip.addr[3]);
|
ip.addr[0], ip.addr[1], ip.addr[2], ip.addr[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -183,11 +183,11 @@ namespace Net {
|
|||||||
Session_policy policy(label);
|
Session_policy policy(label);
|
||||||
policy.attribute("ip_addr").value(ip_addr, sizeof(ip_addr));
|
policy.attribute("ip_addr").value(ip_addr, sizeof(ip_addr));
|
||||||
|
|
||||||
if (verbose) PDBG("policy: %s ip_addr = %s", label.string(), ip_addr);
|
if (verbose) PLOG("policy: %s ip_addr = %s", label.string(), ip_addr);
|
||||||
} catch (Xml_node::Nonexistent_attribute) {
|
} catch (Xml_node::Nonexistent_attribute) {
|
||||||
if (verbose) PDBG("Missing \"ip_addr\" attribute in policy definition");
|
if (verbose) PLOG("Missing \"ip_addr\" attribute in policy definition");
|
||||||
} catch (Session_policy::No_policy_defined) {
|
} catch (Session_policy::No_policy_defined) {
|
||||||
if (verbose) PDBG("Invalid session request, no matching policy");;
|
if (verbose) PLOG("Invalid session request, no matching policy");;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ram_quota =
|
size_t ram_quota =
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
/* local includes */
|
/* local includes */
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
#include "nic.h"
|
||||||
#include "env.h"
|
#include "env.h"
|
||||||
|
|
||||||
|
|
||||||
@ -45,6 +46,12 @@ int main(int, char **)
|
|||||||
/* announce NIC service */
|
/* announce NIC service */
|
||||||
env()->parent()->announce(ep.manage(&nic_root));
|
env()->parent()->announce(ep.manage(&nic_root));
|
||||||
|
|
||||||
|
/* connect to NIC backend to actually see incoming traffic */
|
||||||
|
Net::Ethernet_frame::Mac_address mac(Net::Env::nic()->mac());
|
||||||
|
printf("--- NIC bridge started (mac=%02x:%02x:%02x:%02x:%02x:%02x) ---\n",
|
||||||
|
mac.addr[0], mac.addr[1], mac.addr[2],
|
||||||
|
mac.addr[3], mac.addr[4], mac.addr[5]);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Signal s = Net::Env::receiver()->wait_for_signal();
|
Signal s = Net::Env::receiver()->wait_for_signal();
|
||||||
static_cast<Signal_dispatcher_base *>(s.context())->dispatch(s.num());
|
static_cast<Signal_dispatcher_base *>(s.context())->dispatch(s.num());
|
||||||
|
Loading…
Reference in New Issue
Block a user