File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ package firecracker
16
16
import (
17
17
"context"
18
18
"fmt"
19
- "net"
20
19
"os"
21
20
)
22
21
@@ -260,15 +259,13 @@ func NewSetMetadataHandler(metadata interface{}) Handler {
260
259
}
261
260
}
262
261
263
- // NewConfigMmdsHandler is a named handler that puts the MMDS config into the
262
+ // ConfigMmdsHandler is a named handler that puts the MMDS config into the
264
263
// firecracker process.
265
- func NewConfigMmdsHandler (address net.IP ) Handler {
266
- return Handler {
267
- Name : ConfigMmdsHandlerName ,
268
- Fn : func (ctx context.Context , m * Machine ) error {
269
- return m .setMmdsConfig (ctx , address )
270
- },
271
- }
264
+ var ConfigMmdsHandler = Handler {
265
+ Name : ConfigMmdsHandlerName ,
266
+ Fn : func (ctx context.Context , m * Machine ) error {
267
+ return m .setMmdsConfig (ctx , m .Cfg .MmdsAddress )
268
+ },
272
269
}
273
270
274
271
var defaultFcInitHandlerList = HandlerList {}.Append (
Original file line number Diff line number Diff line change @@ -623,7 +623,7 @@ func TestHandlers(t *testing.T) {
623
623
Config : Config {},
624
624
},
625
625
{
626
- Handler : NewConfigMmdsHandler ( mmdsAddress ) ,
626
+ Handler : ConfigMmdsHandler ,
627
627
Client : fctesting.MockClient {
628
628
PutMmdsConfigFn : func (params * ops.PutMmdsConfigParams ) (* ops.PutMmdsConfigNoContent , error ) {
629
629
called = ConfigMmdsHandlerName
@@ -633,7 +633,9 @@ func TestHandlers(t *testing.T) {
633
633
return & ops.PutMmdsConfigNoContent {}, nil
634
634
},
635
635
},
636
- Config : Config {},
636
+ Config : Config {
637
+ MmdsAddress : mmdsAddress ,
638
+ },
637
639
},
638
640
}
639
641
Original file line number Diff line number Diff line change @@ -159,6 +159,11 @@ type Config struct {
159
159
// 2 : advanced filtering. This adds further checks on some of the
160
160
// parameters of the allowed syscalls.
161
161
SeccompLevel SeccompLevelValue
162
+
163
+ // MmdsAddress is IPv4 address used by guest applications when issuing requests to MMDS.
164
+ // It is possible to use a valid IPv4 link-local address (169.254.0.0/16).
165
+ // If not provided, the default address (169.254.169.254) will be used.
166
+ MmdsAddress net.IP
162
167
}
163
168
164
169
// Validate will ensure that the required fields are set and that
You can’t perform that action at this time.
0 commit comments