File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,9 @@ type Config struct {
169
169
170
170
// An implementation of the Logger interface
171
171
Logger Logger
172
+
173
+ // if a new IP starts sending data on an existing socket id, allow it
174
+ AllowPeerIpChange bool
172
175
}
173
176
174
177
// DefaultConfig is the default configuration for a SRT connection
@@ -209,6 +212,7 @@ var defaultConfig Config = Config{
209
212
TooLatePacketDrop : true ,
210
213
TransmissionType : "live" ,
211
214
TSBPDMode : true ,
215
+ AllowPeerIpChange : false ,
212
216
}
213
217
214
218
// DefaultConfig returns the default configuration for Dial and Listen.
Original file line number Diff line number Diff line change @@ -407,6 +407,14 @@ func (ln *listener) reader(ctx context.Context) {
407
407
break
408
408
}
409
409
410
+ if ! ln .config .AllowPeerIpChange {
411
+ if p .Header ().Addr .String () != conn .RemoteAddr ().String () {
412
+ // ignore the packet, it's not from the expected peer
413
+ // https://haivision.github.io/srt-rfc/draft-sharabayko-srt.html#name-security-considerations
414
+ break
415
+ }
416
+ }
417
+
410
418
conn .push (p )
411
419
}
412
420
}
You can’t perform that action at this time.
0 commit comments