Exemplo n.º 1
0
static void
isdn_net_ciscohdlck_slarp_send_request(isdn_net_local *mlp)
{
	isdn_net_dev *idev;
	struct sk_buff *skb;
	unsigned char *p;

	if (list_empty(&mlp->online)) {
		isdn_BUG();
		return;
	}
	idev = list_entry(mlp->online.next, isdn_net_dev, online);

	skb = isdn_net_ciscohdlck_alloc_skb(idev, 4 + 14);
	if (!skb)
		return;

	p = skb_put(skb, 4 + 14);

	/* cisco header */
	p += put_u8 (p, CISCO_ADDR_UNICAST);
	p += put_u8 (p, CISCO_CTRL);
	p += put_u16(p, CISCO_TYPE_SLARP);

	/* slarp request */
	p += put_u32(p, CISCO_SLARP_REQUEST);
	p += put_u32(p, 0); // address
	p += put_u32(p, 0); // netmask
	p += put_u16(p, 0); // unused

	isdn_net_write_super(idev, skb);
}
Exemplo n.º 2
0
void dwabc_bsd_first_gen(isdn_net_local *lp)
{
	if(lp != NULL && lp->p_encap == ISDN_NET_ENCAP_RAWIP && 
		(lp->dw_abc_flags & ISDN_DW_ABC_FLAG_BSD_COMPRESS)) { 
		
		struct sk_buff *skb = NULL;
		char *p = NULL;
		char *ep = NULL;

		if((skb =(struct sk_buff *)dev_alloc_skb(128)) == NULL) {

			printk(KERN_INFO "%s: dwabc: alloc-skb failed for 128 bytes\n",lp->name);
			return;
		}

		skb_reserve(skb,64);
		p = skb_put(skb,DWBSD_PKT_FIRST_LEN);
		ep = p + DWBSD_PKT_FIRST_LEN;

		*(p++) = DWBSD_PKT_SWITCH;
		*(p++) = DWBSD_VERSION;
		for(;p < ep;p++)	*(p++) = 0;

		isdn_net_write_super(lp, skb);

		if(dev->net_verbose > 2)
			printk(KERN_INFO "%s: dwabc: sending comm-header version 0x%x\n",lp->name,DWBSD_VERSION);
	}
}
Exemplo n.º 3
0
static void
isdn_net_ciscohdlck_slarp_send_reply(isdn_net_dev *idev)
{
	isdn_net_local *mlp = idev->mlp;
	struct sk_buff *skb;
	unsigned char *p;
	struct in_device *in_dev = NULL;
	u32 addr = 0;		/* local ipv4 address */
	u32 mask = 0;		/* local netmask */

	if ((in_dev = mlp->dev.ip_ptr) != NULL) {
		/* take primary(first) address of interface */
		struct in_ifaddr *ifa = in_dev->ifa_list;
		if (ifa != NULL) {
			addr = ifa->ifa_local;
			mask = ifa->ifa_mask;
		}
	}

	skb = isdn_net_ciscohdlck_alloc_skb(idev, 4 + 14);
	if (!skb)
		return;

	p = skb_put(skb, 4 + 14);

	/* cisco header */
	p += put_u8 (p, CISCO_ADDR_UNICAST);
	p += put_u8 (p, CISCO_CTRL);
	p += put_u16(p, CISCO_TYPE_SLARP);

	/* slarp reply, send own ip/netmask; if values are nonsense remote
	 * should think we are unable to provide it with an address via SLARP */
	p += put_u32(p, CISCO_SLARP_REPLY);
	p += put_u32(p, addr);	// address
	p += put_u32(p, mask);	// netmask
	p += put_u16(p, 0);	// unused

	isdn_net_write_super(idev, skb);
}
Exemplo n.º 4
0
/* called via cisco_timer.function */
static void
isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
{
	isdn_net_local *mlp = (isdn_net_local *) data;
 	isdn_net_dev *idev;
	struct inl_cisco *cisco = mlp->inl_priv;
	struct sk_buff *skb;
	unsigned char *p;
	unsigned long last_cisco_myseq = cisco->myseq;
	int myseq_diff = 0;

	if (list_empty(&mlp->online)) {
		isdn_BUG();
		return;
	}
	idev = list_entry(mlp->online.next, isdn_net_dev, online);
	cisco->myseq++;

	myseq_diff = cisco->myseq - cisco->mineseen;
	if (cisco->line_state && (myseq_diff >= 3 || myseq_diff <= -3)) {
		/* line up -> down */
		cisco->line_state = 0;
		printk (KERN_WARNING
				"UPDOWN: Line protocol on Interface %s,"
				" changed state to down\n", idev->name);
		/* should stop routing higher-level data accross */
	} else if (!cisco->line_state &&
		myseq_diff >= 0 && myseq_diff <= 2) {
		/* line down -> up */
		cisco->line_state = 1;
		printk (KERN_WARNING
				"UPDOWN: Line protocol on Interface %s,"
				" changed state to up\n", idev->name);
		/* restart routing higher-level data accross */
	}

	if (cisco->debserint)
		printk (KERN_DEBUG "%s: HDLC "
			"myseq %u, mineseen %u%c, yourseen %u, %s\n",
			idev->name, cisco->myseq, cisco->mineseen,
			(last_cisco_myseq == cisco->mineseen) ? '*' : 040,
			cisco->yourseq,
			(cisco->line_state) ? "line up" : "line down");

	skb = isdn_net_ciscohdlck_alloc_skb(idev, 4 + 14);
	if (!skb)
		return;

	p = skb_put(skb, 4 + 14);

	/* cisco header */
	p += put_u8 (p, CISCO_ADDR_UNICAST);
	p += put_u8 (p, CISCO_CTRL);
	p += put_u16(p, CISCO_TYPE_SLARP);

	/* slarp keepalive */
	p += put_u32(p, CISCO_SLARP_KEEPALIVE);
	p += put_u32(p, cisco->myseq);
	p += put_u32(p, cisco->yourseq);
	p += put_u16(p, 0xffff); // reliablity, always 0xffff

	isdn_net_write_super(idev, skb);

	mod_timer(&cisco->timer, jiffies + cisco->keepalive_period * HZ);
}