Commit c892e27c authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/PPP: Pass frame including header to MPPP

Just add the protocol number header to the frame and have MPPP deal with
the entire frame, separating these layers more cleanly.
parent 64caabb5
......@@ -9,17 +9,6 @@
* of the GNU General Public License, incorporated herein by reference.
*/
/*
* Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02
* guy@traverse.com.au
* Outgoing calls - looks for a 'V' in first char of dialed number
* Incoming calls - checks first character of eaz as follows:
* Numeric - accept DATA only - original functionality
* 'V' - accept VOICE (DOV) only
* 'B' - accept BOTH DATA and DOV types
*
*/
#include <linux/config.h>
#include <linux/isdn.h>
#include <net/arp.h>
......
......@@ -9,6 +9,17 @@
* of the GNU General Public License, incorporated herein by reference.
*/
/*
* Data Over Voice (DOV) support added - Guy Ellis 23-Mar-02
* guy@traverse.com.au
* Outgoing calls - looks for a 'V' in first char of dialed number
* Incoming calls - checks first character of eaz as follows:
* Numeric - accept DATA only - original functionality
* 'V' - accept VOICE (DOV) only
* 'B' - accept BOTH DATA and DOV types
*
*/
/* Locking works as follows:
*
* The configuration of isdn_net_devs works via ioctl on
......
......@@ -549,17 +549,11 @@ static int
isdn_ppp_if_get_unit(char *namebuf);
static void
isdn_ppp_dev_push_header(void *priv, struct sk_buff *skb, u16 proto);
static void
isdn_ppp_dev_xmit(void *priv, struct sk_buff *skb);
isdn_ppp_dev_xmit(void *priv, struct sk_buff *skb, u16 proto);
static struct sk_buff *
isdn_ppp_lp_alloc_skb(void *priv, int len, int gfp_mask);
static void
isdn_ppp_lp_push_header(void *priv, struct sk_buff *skb, u16 proto);
/* New CCP stuff */
static void
isdn_ppp_dev_kick_up(void *priv);
......@@ -585,22 +579,29 @@ isdn_ppp_frame_log(char *info, char *data, int len, int maxlen,int unit,int slot
}
}
static void
isdn_ppp_push_header(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
void
ippp_push_proto(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
{
unsigned char *p;
if (skb_headroom(skb) < 4) {
if (skb_headroom(skb) < 2) {
isdn_BUG();
return;
}
if ((idev->pppcfg & SC_COMP_PROT) && proto <= 0xff)
put_u8(skb_push(skb, 1), proto);
else
put_u16(skb_push(skb, 2), proto);
}
static void
ippp_push_ac(isdn_net_dev *idev, struct sk_buff *skb)
{
unsigned char *p;
if (skb_headroom(skb) < 2) {
isdn_BUG();
return;
}
if (idev->pppcfg & SC_COMP_AC)
return;
......@@ -721,7 +722,6 @@ isdn_ppp_bind(isdn_net_dev *idev)
idev->ccp->proto = PPP_COMPFRAG;
idev->ccp->priv = idev;
idev->ccp->alloc_skb = isdn_ppp_dev_alloc_skb;
idev->ccp->push_header = isdn_ppp_dev_push_header;
idev->ccp->xmit = isdn_ppp_dev_xmit;
idev->ccp->kick_up = isdn_ppp_dev_kick_up;
......@@ -1012,6 +1012,7 @@ isdn_ppp_start_xmit(struct sk_buff *skb, struct net_device *ndev)
if (ipppd->debug & 0x40)
isdn_ppp_frame_log("xmit1", skb->data, skb->len, 32, ipppd->unit, -1);
ippp_push_proto(idev, skb, proto);
ippp_mp_xmit(idev, skb, proto);
return 0;
......@@ -1026,11 +1027,11 @@ isdn_ppp_start_xmit(struct sk_buff *skb, struct net_device *ndev)
}
void
ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb)
{
struct ipppd *ipppd = idev->ipppd;
isdn_ppp_push_header(idev, skb, proto);
ippp_push_ac(idev, skb);
if (ipppd->debug & 0x40) {
isdn_ppp_frame_log("xmit3", skb->data, skb->len, 32, ipppd->unit, -1);
......@@ -1207,37 +1208,17 @@ isdn_ppp_lp_alloc_skb(void *priv, int len, int gfp_mask)
}
static void
isdn_ppp_dev_push_header(void *priv, struct sk_buff *skb, u16 proto)
{
isdn_net_dev *idev = priv;
isdn_ppp_push_header(idev, skb, proto);
}
static void
isdn_ppp_lp_push_header(void *priv, struct sk_buff *skb, u16 proto)
{
isdn_net_local *lp = priv;
isdn_net_dev *idev;
if (list_empty(&lp->online)) {
isdn_BUG();
return;
}
idev = list_entry(lp->online.next, isdn_net_dev, online);
isdn_ppp_push_header(idev, skb, proto);
}
static void
isdn_ppp_dev_xmit(void *priv, struct sk_buff *skb)
isdn_ppp_dev_xmit(void *priv, struct sk_buff *skb, u16 proto)
{
isdn_net_dev *idev = priv;
ippp_push_proto(idev, skb, proto);
ippp_push_ac(idev, skb);
isdn_net_write_super(idev, skb);
}
static void
isdn_ppp_lp_xmit(void *priv, struct sk_buff *skb)
isdn_ppp_lp_xmit(void *priv, struct sk_buff *skb, u16 proto)
{
isdn_net_local *lp = priv;
isdn_net_dev *idev;
......@@ -1247,6 +1228,8 @@ isdn_ppp_lp_xmit(void *priv, struct sk_buff *skb)
return;
}
idev = list_entry(lp->online.next, isdn_net_dev, online);
ippp_push_proto(idev, skb, proto);
ippp_push_ac(idev, skb);
isdn_net_write_super(idev, skb);
}
......@@ -1280,7 +1263,6 @@ isdn_ppp_open(isdn_net_local *lp)
lp->ccp->proto = PPP_COMP;
lp->ccp->priv = lp;
lp->ccp->alloc_skb = isdn_ppp_lp_alloc_skb;
lp->ccp->push_header = isdn_ppp_lp_push_header;
lp->ccp->xmit = isdn_ppp_lp_xmit;
lp->ccp->kick_up = isdn_ppp_lp_kick_up;
......
......@@ -26,7 +26,10 @@ int
isdn_ppp_strip_proto(struct sk_buff *skb, u16 *proto);
void
ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto);
ippp_push_proto(isdn_net_dev *idev, struct sk_buff *skb, u16 proto);
void
ippp_xmit(isdn_net_dev *idev, struct sk_buff *skb);
void
ippp_receive(isdn_net_dev *idev, struct sk_buff *skb, u16 proto);
......
......@@ -102,7 +102,6 @@ do_xmit_reset(struct ippp_ccp *ccp, unsigned char code, unsigned char id,
u16 proto = ccp->proto == PPP_COMP ? PPP_CCP : PPP_CCPFRAG;
skb = ccp->alloc_skb(ccp->priv, 4 + len, GFP_ATOMIC);
ccp->push_header(ccp->priv, skb, proto);
p = skb_put(skb, 4);
p += put_u8 (p, code);
......@@ -114,7 +113,7 @@ do_xmit_reset(struct ippp_ccp *ccp, unsigned char code, unsigned char id,
isdn_ppp_frame_log("ccp-xmit", skb->data, skb->len, 32, -1, -1);
ccp->xmit(ccp->priv, skb);
ccp->xmit(ccp->priv, skb, proto);
}
/* The timer callback function which is called when a ResetReq has timed out,
......
......@@ -36,9 +36,8 @@ struct ippp_ccp {
int mru;
int debug;
void *priv;
void (*xmit)(void *priv, struct sk_buff *skb);
void (*xmit)(void *priv, struct sk_buff *skb, u16 proto);
void (*kick_up)(void *priv);
void (*push_header)(void *priv, struct sk_buff *skb, u16);
struct sk_buff *(*alloc_skb)(void *priv, int len, int gfp_mask);
};
......
......@@ -95,7 +95,7 @@ ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
long txseq;
if (!(lp->mp_cfg & SC_MP_PROT)) {
return ippp_xmit(idev, skb, proto);
return ippp_xmit(idev, skb);
}
/* we could do something smarter than just sending
......@@ -105,22 +105,21 @@ ippp_mp_xmit(isdn_net_dev *idev, struct sk_buff *skb, u16 proto)
if (lp->mp_cfg & SC_OUT_SHORT_SEQ) {
/* sequence number: 12bit */
p = skb_push(skb, 3);
p = skb_push(skb, 2);
p[0] = MP_BEGIN_FRAG | MP_END_FRAG | ((txseq >> 8) & 0xf);
p[1] = txseq & 0xff;
p[2] = proto;
} else {
/* sequence number: 24bit */
p = skb_push(skb, 5);
p = skb_push(skb, 4);
p[0] = MP_BEGIN_FRAG | MP_END_FRAG;
p[1] = (txseq >> 16) & 0xff;
p[2] = (txseq >> 8) & 0xff;
p[3] = (txseq >> 0) & 0xff;
p[4] = proto;
}
proto = PPP_MP;
skb = ippp_ccp_compress(idev->ccp, skb, &proto);
ippp_xmit(idev, skb, proto);
ippp_push_proto(idev, skb, proto);
ippp_xmit(idev, skb);
}
static void mp_receive(isdn_net_dev *idev, struct sk_buff *skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment