typedef struct session {
TAILQ_ENTRY(session) link;
+ char *peer_ipstr;
int delsys;
int stream;
int frontend;
*
*/
static struct session *
-rtsp_new_session(int delsys, uint32_t nsession, int session)
+rtsp_new_session(const char *ipstr, int delsys, uint32_t nsession, int session)
{
struct session *rs = calloc(1, sizeof(*rs));
if (rs == NULL)
return NULL;
+ rs->peer_ipstr = strdup(ipstr);
rs->nsession = nsession ?: session_number;
snprintf(rs->session, sizeof(rs->session), "%08X", session_number);
if (!nsession) {
struct session *rs, *first = NULL;
TAILQ_FOREACH(rs, &rtsp_sessions, link) {
- if (hc->hc_session && !strcmp(rs->session, hc->hc_session)) {
+ if (hc->hc_session &&
+ strcmp(rs->session, hc->hc_session) == 0 &&
+ strcmp(rs->peer_ipstr, hc->hc_peer_ipstr) == 0) {
if (stream == rs->stream)
return rs;
if (first == NULL)
if (cmd) {
if (!rs) {
- rs = rtsp_new_session(msys, 0, -1);
+ rs = rtsp_new_session(hc->hc_peer_ipstr, msys, 0, -1);
if (delsys == DVB_SYS_NONE) goto end;
if (msys == DVB_SYS_NONE) goto end;
if (!(*valid)) goto end;
} else if (stream != rs->stream) {
- rs = rtsp_new_session(msys, rs->nsession, stream);
+ rs = rtsp_new_session(hc->hc_peer_ipstr, msys, rs->nsession, stream);
if (delsys == DVB_SYS_NONE) goto end;
if (msys == DVB_SYS_NONE) goto end;
if (!(*valid)) goto end;
if (stream > 0 && rs->stream != stream)
continue;
}
+ if (satip_server_conf.satip_anonymize &&
+ strcmp(hc->hc_peer_ipstr, rs->peer_ipstr))
+ continue;
if (first) {
rtsp_describe_header(hc->hc_session ? rs : NULL, &q);
first = 0;
mtimer_disarm(&rs->timer);
pthread_mutex_unlock(&global_lock);
mpegts_pid_done(&rs->pids);
+ free(rs->peer_ipstr);
free(rs);
}
.off = offsetof(struct satip_server_conf, satip_rtsp),
.group = 1,
},
+ {
+ .type = PT_BOOL,
+ .id = "satip_anonymize",
+ .name = N_("Anonymize"),
+ .desc = N_("Show only information for sessions which "
+ "are initiated from an IP address of the requester."),
+ .off = offsetof(struct satip_server_conf, satip_anonymize),
+ .group = 1,
+ },
{
.type = PT_INT,
.id = "satip_weight",