summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c6e3670)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
goodness -= goodness >> GOODNESS_SHIFT;
// xxx should be process1
goodness -= goodness >> GOODNESS_SHIFT;
// xxx should be process1
- match slip::processn(SlipNoConv, global.config.mtu, &data, |header|{
+ match process1(SlipNoConv, global.config.mtu, &data, |header|{
let saddr = ip_packet_addr::<false>(header)?;
let daddr = ip_packet_addr::<true>(header)?;
Ok((saddr,daddr))
let saddr = ip_packet_addr::<false>(header)?;
let daddr = ip_packet_addr::<true>(header)?;
Ok((saddr,daddr))
- }, |(data, (saddr, daddr))| {
- let global = &global;
- let may_route = &may_route;
- async move {
- if ! global.config.vnetwork.iter().any(|n| n.contains(&saddr)) {
- // pretent as if this came from route
- trace!(
- target: "hippotatd",
- "discard to={:?} came=ipif user=local from-outside-vnets-={:?}",
- daddr, saddr);
- return Ok(())
- }
-
- route_packet(
- &global, "ipif", None,
- data, daddr, may_route.clone()
- ).await;
+ }) {
+ Err(PE::Empty) => { },
- Ok(())
- }
- }, |pe| Ok(match pe {
- PE::Empty => { },
- other => throw!(other),
- })).await {
- Ok(()) => goodness += 1,
- Err(e) => {
goodness -= 1;
error!("[good={}] invalid data from local tx ipif {}",
goodness -= 1;
error!("[good={}] invalid data from local tx ipif {}",
if goodness < GOODNESS_MIN {
throw!(anyhow!("too many bad packets, too few good ones!"))
}
},
if goodness < GOODNESS_MIN {
throw!(anyhow!("too many bad packets, too few good ones!"))
}
},
+
+ Ok((ref data, (ref saddr, ref daddr)))
+ if ! global.config.vnetwork.iter().any(|n| n.contains(saddr)) => {
+ // pretent as if this came from route
+ trace!(
+ target: "hippotatd",
+ "discard to={:?} came=ipif user=local len={} outside-vnets: from={:?}",
+ daddr, saddr, data.len());
+ },
+
+ Ok((data, (saddr, daddr))) => {
+ goodness += 1;
+ route_packet(
+ &global, "ipif", None,
+ data, daddr, may_route.clone()
+ ).await;
+ }