Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UUID generation with SSDP disabled #1119

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
066396b
Handle CWs out of cycle (#1055)
lars18th Feb 20, 2023
62625a8
Use bind address for the services configuration
lars18th Feb 22, 2023
58b58f1
Use int for sorting pids, as each sid is 16 bit
Mar 15, 2023
44150f7
Ignore EINTR when reading from socket #1074
Mar 11, 2023
e8f1a9f
Revert default number of channels
Mar 15, 2023
cae8c47
Use unsigned int for copy32 and friends to avoid overflow in debug mode
Mar 16, 2023
c23dcc5
Don't print empty channel names
Jalle19 Mar 6, 2023
c78211c
Add spaces between PIDs so the browser can break long lines
Jalle19 Mar 6, 2023
6bd1cc5
Handle charset as unsigned
Mar 30, 2023
73a5630
Add LICENSE file
Jalle19 Mar 31, 2023
ad7a566
Reduce the size of the CAPMT to include only video and audio channels…
Apr 14, 2023
f3bb91e
Match CA if no CAID are added for dvbapi
Apr 15, 2023
ad01e5c
Don't build AXE builds with PMT=0
Jalle19 May 17, 2023
479b724
Remove non-working check (size is always 8)
Jalle19 May 17, 2023
c35a895
Factor out "-o" parsing to parse_dvbapi_opt()
Jalle19 May 17, 2023
1246944
Add tests for parse_dvbapi_opt(), fix two bugs in it
Jalle19 May 17, 2023
b42da8f
Fix building with --enable-axe --disable-dvbca
Jalle19 May 29, 2023
d968ac2
Add a build step to verify that building for AXE works without libssl…
Jalle19 May 29, 2023
b233de6
Fix high cpu usage when CAM not plugged in for enigma #1096
May 31, 2023
6de04fb
Resolve warning in stream.c
lars18th May 31, 2023
297bd9f
Fix warning in stream.c
lars18th May 31, 2023
e277737
Fix warning in pmt.c
lars18th May 31, 2023
cea601f
Clear warning of unused code in pmt.c
lars18th Jun 1, 2023
964dd4a
Clear warnings in utils.c
lars18th Jun 1, 2023
d787645
Fix incorrect BW value with some clients
lars18th Jun 1, 2023
8d33e93
--static should create a static binary #1107
Jun 7, 2023
9299c94
Fix UUID generation with SSDP disabled
lars18th Jun 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
run: |
make clean
./configure --disable-dvbapi --enable-static --host=sh4-linux --disable-dvbaes --disable-dvbca --enable-axe
make PMT=0
zip -9 -r /minisatip_axe.zip minisatip html

- name: Build MIPS
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ jobs:
make clean
./configure --enable-linuxdvb --enable-dvbca --enable-dvbcsa --enable-netcv --enable-satipc --enable-dvbapi --enable-axe
make

- name: Build with --enable-axe, without libssl-dev
run: |
apt-get -y remove --purge libssl-dev
make clean
./configure --enable-axe --enable-dvbapi --enable-dvbcsa --disable-dvbca --disable-dvbaes --disable-netcv
make
104 changes: 104 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

137 changes: 75 additions & 62 deletions html/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@
}
}

function formatPids(pids) {
return pids.replaceAll(',', ', ');
}

function getTable(state, oldstate) {

if (!state)
Expand Down Expand Up @@ -508,75 +512,84 @@
// STREAMS
myTable += "<td class='dt-left'>";
if (state['has_pmt']) {
myTable += "<b>" + state['ad_channel'][i] + "</b><br>";
if (state['ad_channel'][i]) {
myTable += "<b>" + state['ad_channel'][i] + "</b><br>";
}

var st_pmt = state['ad_pmt'][i];
if (st_pmt != "")
myTable += "<small>PMT: " + st_pmt + "</small><br />";
}
for (var j = 0; j < max_streams; j++) {
if (state['st_enabled'][j] == 1 && state['st_adapter'][j] == i) {
var st_rh = state['st_rhost'][j] + ":" + state['st_rport'][j] + " (" + state['st_proto'][j] + ")";
if (state['ad_master'][i] == j)
st_rh = "<b>" + st_rh + "</b>";
if (state['st_play'][j] == 0)
st_rh = "<i>" + st_rh + "</i>";
myTable += "<hr>" + st_rh + "<br />";
if (state['st_useragent'][j] != "")
myTable += "<small>Client: " + state['st_useragent'][j] + "</small><br />";
}
if (state['st_enabled'][j] == 1 && state['st_adapter'][j] == i) {
var st_p = state['st_pids'][j];
if (state['ad_master'][i] == j)
st_p = "" + st_p + "";
if (state['st_play'][j] == 0)
st_p = "<i>" + st_p + "</i>";
myTable += "<small>Pids: " + st_p + "</small><br />";

// Create VLC stream URL
// Example: rtsp://@satip/?src=1&freq=12382&pol=H&msys=DVBS2&sr=27500&pids=0,5375,5378,116,5375,32
var hostArray = window.location.host.split(':');
params = ""
switch (ad_sys) {
// DVB-C
case 1: params += "&sr=" + state['ad_sr'][i]
break
// DVB-T
case 3: params += "&bw=" + state['ad_bw'][i] + "&gi=" + state['ad_gi'][i]
break
// DVB-S2 Multi-stream
case 6: if (state['ad_plp'][i] > 0) {
params += "&isi=" + state['ad_plp'][i] + "&plsc=" + state['ad_plsc'][i] + "&plsm=gold"
}
// DVB-S/DVB-S2
case 5: {
params += "&src=" + state['ad_pos'][i] + "&pol=" + pol[state['ad_pol'][i]].replace('(', '').replace(')', '')
break
}
// DVB-C2
case 19: {
params += "&plp=" + state['ad_plp'][i] + "&c2tft=" + pol[state['ad_c2tft'][i]] + "&ds=" + pol[state['ad_ds'][i]] + "&sr=" + state['ad_sr'][i]
break;
}
// DVB-T2
case 16: {
params += "&plp=" + state['ad_plp'][i] + "&t2id=" + pol[state['ad_t2id'][i]] + "&t2id=" + pol[state['ad_sm'][i]]
break;
}

if (ad_type == 4) {
// Show PIDs on the adapter level for CI adapters
myTable += "<small>Pids: " + formatPids(state['ad_pids'][i]) + "</small><br />";
} else {
for (var j = 0; j < max_streams; j++) {
if (state['st_enabled'][j] == 1 && state['st_adapter'][j] == i) {
var st_rh = state['st_rhost'][j] + ":" + state['st_rport'][j] + " (" + state['st_proto'][j] + ")";
if (state['ad_master'][i] == j)
st_rh = "<b>" + st_rh + "</b>";
if (state['st_play'][j] == 0)
st_rh = "<i>" + st_rh + "</i>";
myTable += "<hr>" + st_rh + "<br />";
if (state['st_useragent'][j] != "")
myTable += "<small>Client: " + state['st_useragent'][j] + "</small><br />";
}
if (state['st_enabled'][j] == 1 && state['st_adapter'][j] == i) {
var st_p = state['st_pids'][j];
if (state['ad_master'][i] == j)
st_p = "" + st_p + "";
if (state['st_play'][j] == 0)
st_p = "<i>" + st_p + "</i>";
myTable += "<small>Pids: " + formatPids(st_p) + "</small><br />";

// Create VLC stream URL
// Example: rtsp://@satip/?src=1&freq=12382&pol=H&msys=DVBS2&sr=27500&pids=0,5375,5378,116,5375,32
var hostArray = window.location.host.split(':');
params = ""
switch (ad_sys) {
// DVB-C
case 1: params += "&sr=" + state['ad_sr'][i]
break
// DVB-T
case 3: params += "&bw=" + state['ad_bw'][i] + "&gi=" + state['ad_gi'][i]
break
// DVB-S2 Multi-stream
case 6: if (state['ad_plp'][i] > 0) {
params += "&isi=" + state['ad_plp'][i] + "&plsc=" + state['ad_plsc'][i] + "&plsm=gold"
}
// DVB-S/DVB-S2
case 5: {
params += "&src=" + state['ad_pos'][i] + "&sr=" + state['ad_sr'][i] + "&pol=" + pol[state['ad_pol'][i]].replace('(', '').replace(')', '')
break
}
// DVB-C2
case 19: {
params += "&plp=" + state['ad_plp'][i] + "&c2tft=" + pol[state['ad_c2tft'][i]] + "&ds=" + pol[state['ad_ds'][i]] + "&sr=" + state['ad_sr'][i]
break;
}
// DVB-T2
case 16: {
params += "&plp=" + state['ad_plp'][i] + "&t2id=" + pol[state['ad_t2id'][i]] + "&t2id=" + pol[state['ad_sm'][i]]
break;
}
}

var fe = ""
if (state['ad_fe'][i] != 0) {
fe = "&fe=" + state['ad_fe'][i]
var fe = ""
if (state['ad_fe'][i] != 0) {
fe = "&fe=" + state['ad_fe'][i]
}
myTable += "<small><a href=" + '"' + "rtsp://@" + state['rtsp_host'] + "/?freq=" + state['ad_freq'][i] + fe + params
+ "&msys=" + sys[state['ad_sys'][i]].toUpperCase() + mtype[state['ad_mtype'][i]] + "&pids=" + st_p + '"' + ">RTSP Link</a></small><br />";
myTable += "<small><a href=" + '"' + "http://" + hostArray[0] + ":" + hostArray[1] + "/?freq=" + state['ad_freq'][i] + fe + params
+ "&msys=" + sys[state['ad_sys'][i]].toUpperCase() + mtype[state['ad_mtype'][i]] + "&pids=" + st_p + '"' + ">HTTP Link</a></small><br />";

if (state['st_overflow'][j] > 0)
myTable += "<small>Dropped: " + (state['st_overflow'][j] / 1048576.0).toFixed(2) + " MB</small><br />";
if (state['st_buffered'][j] > 0)
myTable += "<small>Buffered: " + (state['st_buffered'][j] / 1048576.0).toFixed(2) + " MB</small><br />";
}
myTable += "<small><a href=" + '"' + "rtsp://@" + state['rtsp_host'] + "/?freq=" + state['ad_freq'][i] + fe + params
+ "&msys=" + sys[state['ad_sys'][i]].toUpperCase() + mtype[state['ad_mtype'][i]] + "&pids=" + st_p + '"' + ">RTSP Link</a></small><br />";
myTable += "<small><a href=" + '"' + "http://" + hostArray[0] + ":" + hostArray[1] + "/?freq=" + state['ad_freq'][i] + fe + params
+ "&msys=" + sys[state['ad_sys'][i]].toUpperCase() + mtype[state['ad_mtype'][i]] + "&pids=" + st_p + '"' + ">HTTP Link</a></small><br />";

if (state['st_overflow'][j] > 0)
myTable += "<small>Dropped: " + (state['st_overflow'][j] / 1048576.0).toFixed(2) + " MB</small><br />";
if (state['st_buffered'][j] > 0)
myTable += "<small>Buffered: " + (state['st_buffered'][j] / 1048576.0).toFixed(2) + " MB</small><br />";
}
}
myTable += "</td>";
Expand Down
6 changes: 4 additions & 2 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ SOURCES=\
stream.c \
adapter.c \
httpc.c \
opts.c \
utils.c \
api/symbols.c \
api/variables.c \
Expand Down Expand Up @@ -135,9 +136,10 @@ CFLAGS-$(DEBUG) += -fsanitize=address -fno-omit-frame-pointer -fsanitize=leak -f


ifeq ($(STATIC),1)
LDFLAGS+=$(addsuffix .a,$(addprefix -l:lib,$(LIBS)))
CFLAGS+=-static
LDFLAGS+=$(addsuffix .a,$(addprefix -l:lib,$(LIBS)))
else
LDFLAGS+=$(addprefix -l,$(LIBS))
LDFLAGS+=$(addprefix -l,$(LIBS))
endif

SOURCES+=$(SOURCES-1)
Expand Down
2 changes: 1 addition & 1 deletion src/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,7 @@ void mark_pid_deleted(int aid, int sid, int _pid, SPid *p) {
if (sort) {
for (j = 0; j < MAX_STREAMS_PER_PID - 1; j++)
if (p->sid[j + 1] > p->sid[j]) {
unsigned char t = p->sid[j];
int16_t t = p->sid[j];
p->sid[j] = p->sid[j + 1];
p->sid[j + 1] = t;
}
Expand Down
1 change: 0 additions & 1 deletion src/axe.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

#include "adapter.h"
#include "ca.h"
#include "dvb.h"
#include "minisatip.h"
#include "utils.h"
Expand Down
52 changes: 46 additions & 6 deletions src/ca.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,34 @@ void disable_cws_for_all_pmts(ca_device_t *d) {
}
}

int CAPMT_add_PMT(uint8_t *capmt, int len, SPMT *pmt, int cmd_id,
int added_only, int ca_id) {
int i = 0, pos = 0;
for (i = 0; i < pmt->stream_pids; i++) {
if (added_only && !find_pid(pmt->adapter, pmt->stream_pid[i].pid)) {
LOGM("%s: skipping pmt %d (ad %d) pid %d from CAPMT", __FUNCTION__,
pmt->id, pmt->adapter, pmt->stream_pid[i].pid);
continue;
}
if (!pmt->stream_pid[i].is_audio && !pmt->stream_pid[i].is_video)
continue;
capmt[pos++] = pmt->stream_pid[i].type;
copy16(capmt, pos, pmt->stream_pid[i].pid);
pos += 2;
int pi_len_pos = pos, pi_len = 0;
pos += 2;

// append the stream descriptors
if (pmt->caids) {
capmt[pos++] = cmd_id;
pi_len = pmt_add_ca_descriptor(pmt, capmt + pos, ca_id);
pos += pi_len;
}
copy16(capmt, pi_len_pos, pi_len + 1);
}
return pos;
}

int create_capmt(SCAPMT *ca, int listmgmt, uint8_t *capmt, int capmt_len,
int cmd_id, int added_only) {
int pos = 0;
Expand All @@ -297,10 +325,11 @@ int create_capmt(SCAPMT *ca, int listmgmt, uint8_t *capmt, int capmt_len,
capmt[pos++] = 0; // PI LEN 2 bytes, set 0
capmt[pos++] = 0;

pos += CAPMT_add_PMT(capmt + pos, capmt_len - pos, pmt, cmd_id, added_only);
pos += CAPMT_add_PMT(capmt + pos, capmt_len - pos, pmt, cmd_id, added_only,
dvbca_id);
if (other) {
pos += CAPMT_add_PMT(capmt + pos, capmt_len - pos, other, cmd_id,
added_only);
added_only, dvbca_id);
}

return pos;
Expand Down Expand Up @@ -1698,10 +1727,10 @@ static int CIPLUS_APP_LANG_handler(ca_session_t *session, int tag,
// if (data_length)
// hexdump(data, data_length);

uint8_t data_reply_lang[3]; // ISO 639 Part 2
data_reply_lang[0] = 0x65; /* e */
data_reply_lang[1] = 0x6e; /* n */
data_reply_lang[2] = 0x67; /* g */
uint8_t data_reply_lang[3]; // ISO 639 Part 2
data_reply_lang[0] = 0x65; /* e */
data_reply_lang[1] = 0x6e; /* n */
data_reply_lang[2] = 0x67; /* g */

uint8_t data_reply_country[3]; // ISO 3166-1 alpha 3
data_reply_country[0] = 0x55; /* U */
Expand Down Expand Up @@ -2674,6 +2703,17 @@ int ca_read_enigma(int socket, void *buf, int len, sockets *ss, int *rb) {
*rb = 0;
if (rl > 0) {
*rb = rl;
if (ss->events & ~POLLPRI) {
ss->events |= POLLPRI;
}
return 1;
}
if (ss->revents == POLLPRI) {
ca_device_t *d = ca_devices[ss->sid];
if (d->state != CA_STATE_INACTIVE) {
d->state = CA_STATE_INACTIVE;
}
ss->events = POLLIN;
}
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ca.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "aes.h"
#include "pmt.h"
#define MAX_CA_PMT 4
#define DEFAULT_CA_PMT 1
#define DEFAULT_CA_PMT 4
#define MAX_SESSIONS 64
#define PMT_INVALID -1
#define PMT_ID_IS_VALID(x) (x > PMT_INVALID)
Expand Down
7 changes: 6 additions & 1 deletion src/dvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ int detect_dvb_parameters(char *s, transponder *tp) {
tp->gi = map_int(arg[i] + 3, fe_gi);
if (strncmp("tmode=", arg[i], 6) == 0)
tp->tmode = map_int(arg[i] + 6, fe_tmode);
if (strncmp("bw=", arg[i], 3) == 0)
if (strncmp("bw=", arg[i], 3) == 0) {
tp->bw = map_float(arg[i] + 3, 1000000);
if (tp->bw < 0 || tp->bw > 100000000) // Fix clients that send bw=8000 !
tp->bw = map_float(arg[i] + 3, 1000);
if (tp->bw < 0 || tp->bw > 100000000) // Fix clients that send bw=8000000 !
tp->bw = map_float(arg[i] + 3, 1);
}
if (strncmp("specinv=", arg[i], 8) == 0)
tp->inversion = map_int(arg[i] + 8, NULL);
if (strncmp("c2tft=", arg[i], 6) == 0)
Expand Down
3 changes: 2 additions & 1 deletion src/dvbapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,8 @@ int dvbapi_send_pmt(SKey *k, int cmd_id) {
copy16(buf, 23, 0x8701); // ca_device_descriptor (caX)
buf[25] = demux;

len = 26 + pmt_add_ca_descriptor(pmt, buf + 26); // CA description
len =
26 + pmt_add_ca_descriptor(pmt, buf + 26, dvbapi_ca); // CA description

// Pids associated with the PMT
copy16(buf, 10, len - 12);
Expand Down
Loading