[asterisk-bugs] [JIRA] (DAHLIN-381) Bypassed HDLC handler for outgoing packets

Alexei A Smekalkine (JIRA) noreply at issues.asterisk.org
Sun Aug 30 12:13:43 CDT 2020


    [ https://issues.asterisk.org/jira/browse/DAHLIN-381?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=251855#comment-251855 ] 

Alexei A Smekalkine commented on DAHLIN-381:
--------------------------------------------

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.

> Bypassed HDLC handler for outgoing packets
> ------------------------------------------
>
>                 Key: DAHLIN-381
>                 URL: https://issues.asterisk.org/jira/browse/DAHLIN-381
>             Project: DAHDI-Linux
>          Issue Type: Bug
>      Security Level: None
>          Components: dahdi (the module)
>    Affects Versions: 2.11.1, 3.0.0, 3.1.0
>            Reporter: Alexei A Smekalkine
>            Assignee: Keith Morgan
>              Labels: patch
>         Attachments: 0001-dahdi-base-netdev-send-frame-via-protocol-handlers-f.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list