void ax25_transmit_buffer(ax25_cb *ax25, struct sk_buff *skb, int type)
{
    struct sk_buff *skbn;
    unsigned char *ptr;
    int headroom;

    if (ax25->ax25_dev == NULL) {
        ax25_disconnect(ax25, ENETUNREACH);
        return;
    }

    headroom = ax25_addr_size(ax25->digipeat);

    if (skb_headroom(skb) < headroom) {
        if ((skbn = skb_realloc_headroom(skb, headroom)) == NULL) {
            printk(KERN_CRIT "AX.25: ax25_transmit_buffer - out of memory\n");
            kfree_skb(skb);
            return;
        }

        if (skb->sk != NULL)
            skb_set_owner_w(skbn, skb->sk);

        kfree_skb(skb);
        skb = skbn;
    }

    ptr = skb_push(skb, headroom);

    ax25_addr_build(ptr, &ax25->source_addr, &ax25->dest_addr, ax25->digipeat, type, ax25->modulus);

    ax25_queue_xmit(skb, ax25->ax25_dev->dev);
}
Example #2
0
struct sk_buff *ax25_rt_build_path(struct sk_buff *skb, ax25_address *src,
	ax25_address *dest, ax25_digi *digi)
{
	struct sk_buff *skbn;
	unsigned char *bp;
	int len;

	len = digi->ndigi * AX25_ADDR_LEN;

	if (skb_headroom(skb) < len) {
		if ((skbn = skb_realloc_headroom(skb, len)) == NULL) {
			printk(KERN_CRIT "AX.25: ax25_dg_build_path - out of memory\n");
			return NULL;
		}

		if (skb->sk != NULL)
			skb_set_owner_w(skbn, skb->sk);

		consume_skb(skb);

		skb = skbn;
	}

	bp = skb_push(skb, len);

	ax25_addr_build(bp, src, dest, digi, AX25_COMMAND, AX25_MODULUS);

	return skb;
}