Summary: | DAHLIN-00381: Bypassed HDLC handler for outgoing packets | ||
Reporter: | Alexei A Smekalkine (ikle) | Labels: | patch |
Date Opened: | 2020-08-30 11:29:31 | Date Closed: | |
Priority: | Major | Regression? | |
Status: | Triage/New | Components: | dahdi (the module) |
Versions: | 2.11.1 3.0.0 3.1.0 | Frequency of Occurrence | |
Related Issues: | |||
Environment: | Attachments: | ( 0) 0001-dahdi-base-netdev-send-frame-via-protocol-handlers-f.patch | |
Description: | The HDLC encapsulation module can add its own headers and trailers to the packet. For correct operation in this case, it is necessary to send a packet from DAHDI to the appropriate HDLC handler. The HDLC handler, in turn, should call the device driver procedure to transfer the packet.
An example of such a module is our [Cisco HDLC Ethernet encapsulation|https://github.com/ikle/ds/blob/master/linux/hdlc_cisco_eth.c#L80]. Thus, for correct processing of outgoing packets, we should use function hdlc_start_xmit from Linux HDLC stack as a ndo_start_xmit procedure. (Note that if the protocol handler does not provide a xmit procedure, then function hdlc_start_xmit will call the hardware driver directly.) In the case of DAHDI, the packet transfer procedure (device driver xmit procedure) is set in function dahdi_ioctl_chanconfig to dahdi_xmit: {code} dev_to_hdlc(chan->hdlcnetdev->netdev)->xmit = dahdi_xmit; {code} P.S. [The attached patch|^0001-dahdi-base-netdev-send-frame-via-protocol-handlers-f.patch] has beed tested on real hardware and used in production for more then two years. | ||
Comments: | By: Alexei A Smekalkine (ikle) 2020-08-30 12:13:36.017-0500 drivers/net/wan/hdlc.c: {code} netdev_tx_t hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); if (hdlc->proto->xmit) return hdlc->proto->xmit(skb, dev); return hdlc->xmit(skb, dev); /* call hardware driver directly */ } {code} # Use case #1: HDLC protocol handler does not provide xmit procedure. In such case hdlc_start_xmit will call hdlc->xmit = dahdi_xmit — nothing changed. # Use case #2: Cisco HDLC Ethernet encapsulation [provide xmit procedure|https://github.com/ikle/ds/blob/master/linux/hdlc_cisco_eth.c#L80]. In such case HDLC handler pad Ethernet packet to 60 bytes if required, add Cisco HDLC header, and call hdlc->xmit = dahdi_xmit with modified packet. By: Harald Welte (laforge) 2020-09-06 07:06:55.296-0500 I completely agree with the Alexei on the bug and the correctness of this patch |