[BUG] Pat table lost PMT-pid

Florian Lohoff f at zz.de
Sun Jan 17 00:46:45 CET 2010


On Sat, Jan 16, 2010 at 10:44:53PM +0100, Ondřej Caletka wrote:
> Ondřej Caletka napsal(a):
>> So I think maybe the simplest solution would be to patch the getstream  
>> not to update PAT table with invalid PMT pids.
>>
> Here is the patch. Hope it will help fixing this random outages. I think  
> the problem is in Airstar 2 DVB-T card, or its driver, as it never  
> happened to other cards I use.

But the point is - we do the whole PAT reassembly ourselves instead of letting
kernel do it. We check the sections checksum prior to using it - so there is no
accidental way of breaking this IMHO.

> --- pat.c.old	2009-02-27 10:05:57.000000000 +0100
> +++ pat.c	2010-01-16 22:31:23.000000000 +0100
> @@ -217,6 +217,11 @@
>  	for(pl=g_list_first(current->program);pl;pl=g_list_next(pl)) {
>  		pcur=pl->data;
>  
> +        if (pcur->pid == 0) {
> +            logwrite(LOG_ERROR, "pat: Invalid PMT pid 0 for pnr %d", pcur->pnr);
> +            continue;
> +        }
> +
>  		/* Do we have a current PAT ? */
>  		if (!last) {
>  			pmt_pidfrompat(a, pcur->pnr, pcur->pid);

Thanks - took a while to get the code into my brain again - This solves an accidental
zero pmt pid in the PAT - i'd like to make shure we are not just papering over
a different bug ...

Is the PAT broken? Do we overrun the PAT section under certain conditions while parsing?

If you had time i'd like to see the output of this debug patch - it'll debug the whole psi
sections in case we stumple on a zero pmt pid (this is just compile tested)

diff --git a/pat.c b/pat.c
index a8d08f5..08b4782 100644
--- a/pat.c
+++ b/pat.c
@@ -181,6 +181,11 @@ struct pat_s *pat_parse(struct adapter_s *a) {
 					pat_pnrfrompat(s, pnr),
 					pat_pidfrompat(s, pnr));
 
+			if (!pat_pidfrompat(s, pnr)) {
+				logwrite(LOG_ERROR, "Broken PAT with pid == 0 for pnr %04x\n", pnr);
+				psi_dump(&a->pat.psi);
+			}
+
 			next->progcount++;
 		}
 	}
diff --git a/psi.c b/psi.c
index 76aab94..1ccc1ab 100644
--- a/psi.c
+++ b/psi.c
@@ -291,3 +291,16 @@ int psi_update_table(struct psi_s *psi, struct psisec_s *section) {
 
 	return 1;
 }
+
+void psi_dump(struct psi_s *psi) {
+	int		secnum, last;
+	struct psisec_s	*sec;
+	
+	last=psi_last_section_number(psi->section[0]);
+
+	for(secnum=0;secnum<=last;secnum++) {
+		logwrite(LOG_ERROR, "Section %d of %d\n", secnum, last);
+		sec=psi->section[secnum];
+		dump_hex(LOG_ERROR, "sec: ", sec->data, sec->valid);
+	}
+}
diff --git a/psi.h b/psi.h
index 14c46c3..b8d5b6c 100644
--- a/psi.h
+++ b/psi.h
@@ -153,5 +153,6 @@ struct psisec_s *psi_section_clone(struct psisec_s *section);
 unsigned int psi_segment_and_send(struct psisec_s *section, unsigned int pid, uint8_t cc,
 			void (*callback)(void *data, void *arg), void *arg);
 int psi_update_table(struct psi_s *psi, struct psisec_s *section);
+void psi_dump(struct psi_s *psi);
 
 #endif

Flo
-- 
Florian Lohoff                                                 f at zz.de
"Es ist ein grobes Missverständnis und eine Fehlwahrnehmung, dem Staat
im Internet Zensur- und Überwachungsabsichten zu unterstellen."
- - Bundesminister Dr. Wolfgang Schäuble -- 10. Juli in Berlin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
URL: <http://gt.owl.de/pipermail/getstream/attachments/20100117/234ef690/attachment.pgp>


More information about the Getstream mailing list