Netdev List
 help / color / mirror / Atom feed
From: andrew hendry <andrew.hendry@gmail.com>
To: netdev@vger.kernel.org, linux-kernel <linux-kernel@vger.kernel.org>
Subject: tuntap with tun_no_pi and X25 question
Date: Wed, 24 Feb 2010 22:52:27 +1100	[thread overview]
Message-ID: <d45a3acc1002240352r43e546c7x4a40aa7d8e187369@mail.gmail.com> (raw)

Setting up tun using X25, I can read X25 from the tun but cannot write
to it, hitting this -EINVAL on write.

/* Get packet from user space buffer */
static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
                                       const struct iovec *iv, size_t count,
                                       int noblock)
{

....
       case TUN_TUN_DEV:
                if (tun->flags & TUN_NO_PI) {
                        switch (skb->data[0] & 0xf0) {
                        case 0x40:
                                pi.proto = htons(ETH_P_IP);
                                break;
                        case 0x60:
                                pi.proto = htons(ETH_P_IPV6);
                                break;
                        default:
                                tun->dev->stats.rx_dropped++;
                                kfree_skb(skb);
                                return -EINVAL;
                        }
                }
....

The 0x40 and 0x60 comes from the first byte of the IP which has the
version there?
With X.25 the first byte changes depending on the call sequence, so it
cant be detected and set in the same way.

Is there a way to for a combination of TUNSETIFF with IFF_TUN |
IFF_NO_PI and TUNSETLINK with ARPHRD_X25 to work?
Probably all the non IP type protocols in if_arp.h have the same issue
with IFF_NO_PI?

thanks,
Andrew

             reply	other threads:[~2010-02-24 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 11:52 andrew hendry [this message]
2010-02-24 12:51 ` tuntap with tun_no_pi and X25 question Rémi Denis-Courmont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d45a3acc1002240352r43e546c7x4a40aa7d8e187369@mail.gmail.com \
    --to=andrew.hendry@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox