@@ -93,10 +93,12 @@ struct Args {
93
93
#[ clap( long) ]
94
94
listen_port : Option < u16 > ,
95
95
96
- /// Ereport port to bind to locally [default: 0 for client commands, 22223
97
- /// for server commands]
98
- #[ clap( long) ]
99
- ereport_port : Option < u16 > ,
96
+ /// Ereport port to bind to locally
97
+ // Note that, unlike `listen_port`, this always defaults to 0, because we
98
+ // don't need to act as a server with a known port for the ereport
99
+ // protocol.
100
+ #[ clap( long, default_value_t = 0 ) ]
101
+ ereport_port : u16 ,
100
102
101
103
/// Address to use to discover the SP. May be a specific SP's address to
102
104
/// bypass multicast discovery.
@@ -549,15 +551,6 @@ impl Command {
549
551
_ => 0 ,
550
552
}
551
553
}
552
-
553
- fn default_ereport_port ( & self ) -> u16 {
554
- match self {
555
- // Server commands; use standard MGS port
556
- Command :: ServeHostPhase2 { .. } => ereport:: MGS_PORT ,
557
- // Client commands: use port 0
558
- _ => 0 ,
559
- }
560
- }
561
554
}
562
555
563
556
fn parse_tlvc_key ( key : & str ) -> Result < [ u8 ; 4 ] > {
@@ -708,8 +701,6 @@ async fn main() -> Result<()> {
708
701
709
702
let listen_port =
710
703
args. listen_port . unwrap_or_else ( || args. command . default_listen_port ( ) ) ;
711
- let ereport_port =
712
- args. listen_port . unwrap_or_else ( || args. command . default_ereport_port ( ) ) ;
713
704
714
705
// For faux-mgs, we'll serve all images present in the directory the user
715
706
// requests, so don't cap the LRU cache size.
@@ -725,7 +716,7 @@ async fn main() -> Result<()> {
725
716
. context ( "SharedSocket:bind() failed" ) ?;
726
717
let ereport_socket = {
727
718
SharedSocket :: bind (
728
- ereport_port,
719
+ args . ereport_port ,
729
720
ereport:: EreportHandler :: default ( ) ,
730
721
log. new ( slog:: o!( "socket" => "ereport" ) ) ,
731
722
)
0 commit comments