Subject: Update of ULE decaps support in Linux 2.6.18

From: Christian Praehauser <[email-masked]>
Date: Mon, 30 Oct 2006 17:31:34 +0100

Dear IPDVB mailing list.

As some of you might have noticed, there have been some changes to the code which handles ULE decapsulation in Linux version 2.6.18.
This also corrects some of the issues that have already been discussed on this mailing list (e.g. incorrect handling of multicast packets).
See below for the details.

Currently, we're thinking about a re-design of the DVB networking support in Linux (with focus on ULE). This will make it possible to 
implement ULE Extensions as Linux modules, which are loaded by the decaps logic on-demand.
If you're interested in this and want to make suggestions or contributions, please feel free to contact us.

Kind regards,
Christian.

====
Details for dvb_net_ule_rfc4326.patch

Description
-----------
Fixed bugs in the Unidirectional Lightweight Encapsulation (ULE) code. Also checked compliency with RFC 4326 (ULE).

Changes in dvb_net.c
--------------------
* Fixed check of SNDU length.
Explanation:
The SNDU length was not checked correctly, thus leaving the possibility for a kernel panic if receiving malformed SNDUs.
Solution:
Now, the SNDU length is considered invalid if it is less then 5. The reasoning for this is that an SNDU must always carry at least one byte 
of payload and the CRC32 (4 Bytes).

* Added check of return value from functions which handle mandatory extension headers (e.g. ule_test_sndu)

* Fixed handling of optional extension headers.
Explanation:
When processing optional extension headers, the length of the extension header was not calculated correctly.
Also the next header type field was assumed to be after the optional extension header. In fact, it is a part of it (always the last two bytes).
Solution:
The length calc. and next header type field access for optional ext. headers have been fixed.

* Added handling of extension header padding (optional extension header with type 1)

* Fixed check of destination address in presence of extension headers.
Explanation:
The destination address was assumed to be after any extension headers. Thus, the extension headers were processed before comparing the 
destination address with the actual address of the receiver. After that, the total length of the ext. headers was removed from the buffer 
(skb) also including the destination address.
Solution:
Now, the destination address (if present) is checked before processing any extension headers. The destination address is saved in a local 
buffer because it may be required for constructing the ethernet header.

* Fixed/Improved filtering on destination address (if present in ULE SNDU)
(1) Now, everything is passed up the stack if in promiscious mode.
(2) The address of the receiver device and the broadcast address (FF:FF:FF:FF:FF:FF) are always accepted.
(3) If in multicast mode, all addresses in the multicast address list are accepted (in addition to 2).
(4) If in all-multicast mode, all multicast addresses are accepted (in addition to 2).

* Reduced timeout value for TS cells to 10 ms.

* Fixed arguments for setting TS feed properties.
The documentation for DVB-API v3 and what is actually present in the Linux kernel seem to be out of sync.
The set() function for TS feeds differs in the DVB API version 3 document and the Linux kernel version:
int set(dmx ts feed t* feed, u16 pid, size_t callback length, size_t circular buffer size, int descramble, struct timespec timeout);
Actually implemented in the 2.6.15 Kernel:
int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type, enum dmx_ts_pes pes_type, size_t circular_buffer_size, struct 
timespec timeout);
====

-- 
Christian Praehauser <[email-masked]>
Department of Computer Sciences
University of Salzburg

---

From: Gorry Fairhurst <[email-masked]>
Date: Mon, 30 Oct 2006 16:58:38 +0000

Thanks for the posting. I like the idea of using KLM for extensions - to 
me that seems a very attractive long-term solution to providing many of 
the extensions that have been discussed on the WG.

Best wishes,

Gorry

(P.S. there is an agenda slot at the meeting next week that can be used 
to talk about implementation status - if you'd like to make a few slides 
and present, you'd be welcome, or if you are not attending suggest a 
speaker (or the Chair to present for you).)

Christian Praehauser wrote:

> Dear IPDVB mailing list.
> 
> As some of you might have noticed, there have been some changes to the 
> code which handles ULE decapsulation in Linux version 2.6.18.
> This also corrects some of the issues that have already been discussed 
> on this mailing list (e.g. incorrect handling of multicast packets).
> Currently, we're thinking about a re-design of the DVB networking 
> support in Linux (with focus on ULE). This will make it possible to 
> If you're interested in this and want to make suggestions or 
> contributions, please feel free to contact us.
> 
> Kind regards,
> Christian.
> 
> ====
> Fixed bugs in the Unidirectional Lightweight Encapsulation (ULE) code. 
> Also checked compliency with RFC 4326 (ULE).
> 
> Changes in dvb_net.c
> --------------------
> The SNDU length was not checked correctly, thus leaving the possibility 
> for a kernel panic if receiving malformed SNDUs.
> Solution:
> Now, the SNDU length is considered invalid if it is less then 5. The 
> reasoning for this is that an SNDU must always carry at least one byte 
> Also the next header type field was assumed to be after the optional 
> extension header. In fact, it is a part of it (always the last two bytes).
> Solution:
> The destination address was assumed to be after any extension headers. 
> Thus, the extension headers were processed before comparing the 
> destination address with the actual address of the receiver. After that, 
> the total length of the ext. headers was removed from the buffer (skb) 
> also including the destination address.
> Solution:
> Now, the destination address (if present) is checked before processing 
> any extension headers. The destination address is saved in a local 
> int set(dmx ts feed t* feed, u16 pid, size_t callback length, size_t 
> circular buffer size, int descramble, struct timespec timeout);
> int dmx_ts_feed_set(struct dmx_ts_feed *ts_feed, u16 pid, int ts_type, 
> enum dmx_ts_pes pes_type, size_t circular_buffer_size, struct timespec 
> timeout);
> ====
>