pseudo mtu awareness
This commit is contained in:
		
							parent
							
								
									b0646410b9
								
							
						
					
					
						commit
						37a1b0f3a0
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -150,6 +150,8 @@ async fn handle_message(ctx: &Context, from: SocketAddr, msg: &Message) { | |||
|             }; | ||||
| 
 | ||||
|             opts.insert(DhcpOption::Hostname(instance.name.clone())); | ||||
|             // TODO: hack for now. if this actually fixes the networkd issue, we'll need to figure out how to get the MTU
 | ||||
|             opts.insert(DhcpOption::InterfaceMtu(1500)); | ||||
| 
 | ||||
|             if !subnet.dns.is_empty() { | ||||
|                 opts.insert(DhcpOption::DomainNameServer(subnet.dns)); | ||||
|  | @ -211,8 +213,8 @@ async fn main() -> ExitCode { | |||
|     tracing::info!("nzrdhcp ready! Listening on {}", ctx.addr()); | ||||
| 
 | ||||
|     loop { | ||||
|         let mut buf = [0u8; 576]; | ||||
|         let (_, src) = match ctx.sock().recv_from(&mut buf).await { | ||||
|         let mut buf = [0u8; 1500]; | ||||
|         let (sz, src) = match ctx.sock().recv_from(&mut buf).await { | ||||
|             Ok(x) => x, | ||||
|             Err(err) => { | ||||
|                 tracing::error!("recv_from error: {err}"); | ||||
|  | @ -220,7 +222,7 @@ async fn main() -> ExitCode { | |||
|             } | ||||
|         }; | ||||
| 
 | ||||
|         let msg = match Message::decode(&mut Decoder::new(&buf)) { | ||||
|         let msg = match Message::decode(&mut Decoder::new(&buf[..sz])) { | ||||
|             Ok(msg) => msg, | ||||
|             Err(err) => { | ||||
|                 tracing::error!("Couldn't process message from {}: {}", src, err); | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue