Commit 949d4e94 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/PPP: CCP flags handling

Let isdn_ppp_ccp.c take care of keeping state / flags by itself.
parent 4edfad00
......@@ -49,7 +49,7 @@ isdn_ppp_send_ccp(isdn_net_dev *net_dev, isdn_net_local *lp,
/* New CCP stuff */
static void
isdn_ppp_ccp_kick_up(void *priv, unsigned int flags);
isdn_ppp_ccp_kick_up(void *priv);
static void
isdn_ppp_ccp_xmit_reset(void *priv, int proto, unsigned char code,
......@@ -438,6 +438,7 @@ ipppd_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned lon
int r;
struct ipppd *is;
struct isdn_ppp_comp_data data;
unsigned int cfg;
is = (struct ipppd *) file->private_data;
idev = is->idev;
......@@ -488,7 +489,8 @@ ipppd_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned lon
case PPPIOCGFLAGS: /* get configuration flags */
if (!idev)
return -ENODEV;
if ((r = set_arg((void *) arg, &idev->pppcfg, sizeof(idev->pppcfg) )))
cfg = idev->pppcfg | ippp_ccp_get_flags(idev->ccp);
if ((r = set_arg((void *) arg, &cfg, sizeof(cfg) )))
return r;
break;
case PPPIOCSFLAGS: /* set configuration flags */
......@@ -498,8 +500,10 @@ ipppd_ioctl(struct inode *ino, struct file *file, unsigned int cmd, unsigned lon
return r;
}
if ((val & SC_ENABLE_IP) && !(idev->pppcfg & SC_ENABLE_IP)) {
idev->pppcfg = val;
/* OK .. we are ready to send buffers */
isdn_net_online(idev);
break;
}
idev->pppcfg = val;
break;
......@@ -1926,15 +1930,14 @@ isdn_ppp_hangup_slave(char *name)
/* Push an empty CCP Data Frame up to the daemon to wake it up and let it
generate a CCP Reset-Request or tear down CCP altogether */
static void isdn_ppp_ccp_kick_up(void *priv, unsigned int flags)
static void isdn_ppp_ccp_kick_up(void *priv)
{
isdn_net_dev *idev = priv;
idev->pppcfg |= flags;
isdn_ppp_fill_rq(NULL, 0, PPP_COMP, idev->ppp_slot);
}
static void isdn_ppp_ccp_lp_kick_up(void *priv, unsigned int flags)
static void isdn_ppp_ccp_lp_kick_up(void *priv)
{
isdn_net_local *lp = priv;
isdn_net_dev *idev;
......@@ -1944,7 +1947,6 @@ static void isdn_ppp_ccp_lp_kick_up(void *priv, unsigned int flags)
return;
}
idev = list_entry(lp->online.next, isdn_net_dev, online);
idev->pppcfg |= flags;
isdn_ppp_fill_rq(NULL, 0, PPP_COMP, idev->ppp_slot);
}
......
......@@ -185,7 +185,7 @@ ippp_ccp_alloc(int proto, void *priv,
void (*xmit_reset)(void *priv, int proto, unsigned char code,
unsigned char id, unsigned char *data,
int len),
void (*kick_up)(void *priv, unsigned int flags))
void (*kick_up)(void *priv))
{
struct ippp_ccp *ccp;
......@@ -230,6 +230,12 @@ ippp_ccp_set_mru(struct ippp_ccp *ccp, unsigned int mru)
return 0;
}
unsigned int
ippp_ccp_get_flags(struct ippp_ccp *ccp);
{
return idev->ccp->compflags & (SC_DC_ERROR|SC_DC_FERROR);
}
/*
* compress a frame
* returns original skb if we did not compress the frame
......@@ -322,8 +328,9 @@ ippp_ccp_decompress(struct ippp_ccp *ccp, struct sk_buff *skb_in, int *proto)
ippp_ccp_reset_xmit(ccp, &rsparm);
break;
case DECOMP_FATALERROR:
ccp->compflags |= SC_DC_FERROR;
/* Kick ipppd to recognize the error */
ccp->kick_up(ccp->priv, SC_DC_FERROR);
ccp->kick_up(ccp->priv);
break;
}
kfree_skb(skb);
......
......@@ -2,6 +2,19 @@
#include <linux/kernel.h>
#include <linux/isdn_ppp.h>
/* for ippp_ccp::flags */
#define SC_DECOMP_ON 0x01
#define SC_COMP_ON 0x02
#define SC_DECOMP_DISCARD 0x04
#define SC_COMP_DISCARD 0x08
/* SC_DC_ERROR/FERROR go in here as well, but are defined elsewhere
#define SC_DC_FERROR 0x00800000
#define SC_DC_ERROR 0x00400000
*/
struct ippp_ccp {
int proto;
struct isdn_ppp_compressor *compressor;
......@@ -15,7 +28,7 @@ struct ippp_ccp {
void *priv;
void (*xmit_reset)(void *priv, int proto, unsigned char code,
unsigned char id, unsigned char *data, int len);
void (*kick_up)(void *priv, unsigned int flags);
void (*kick_up)(void *priv);
};
struct ippp_ccp *
......@@ -23,7 +36,7 @@ ippp_ccp_alloc(int proto, void *priv,
void (*xmit_reset)(void *priv, int proto, unsigned char code,
unsigned char id, unsigned char *data,
int len),
void (*kick_up)(void *priv, unsigned int flags));
void (*kick_up)(void *priv));
void
ippp_ccp_free(struct ippp_ccp *ccp);
......@@ -31,6 +44,9 @@ ippp_ccp_free(struct ippp_ccp *ccp);
int
ippp_ccp_set_mru(struct ippp_ccp *ccp, unsigned int mru);
unsigned int
ippp_ccp_get_flags(struct ippp_ccp *ccp);
struct sk_buff *
ippp_ccp_compress(struct ippp_ccp *ccp, struct sk_buff *skb, int *proto);
......
......@@ -38,15 +38,6 @@ struct pppcallinfo
#define SC_OUT_SHORT_SEQ 0x00000800
#define SC_IN_SHORT_SEQ 0x00004000
#define SC_DECOMP_ON 0x01
#define SC_COMP_ON 0x02
#define SC_DECOMP_DISCARD 0x04
#define SC_COMP_DISCARD 0x08
#define SC_LINK_DECOMP_ON 0x10
#define SC_LINK_COMP_ON 0x20
#define SC_LINK_DECOMP_DISCARD 0x40
#define SC_LINK_COMP_DISCARD 0x80
#define ISDN_PPP_COMP_MAX_OPTIONS 16
#define IPPP_COMP_FLAG_XMIT 0x1
......
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