Line 247... |
Line 247... |
skb_reserve(newskb,LL_RESERVED_SPACE(sd->dev));
|
skb_reserve(newskb,LL_RESERVED_SPACE(sd->dev));
|
skb_reset_network_header(newskb);
|
skb_reset_network_header(newskb);
|
newskb->dev = sd->dev;
|
newskb->dev = sd->dev;
|
newskb->protocol = htons(MY_PROTO_ID);
|
newskb->protocol = htons(MY_PROTO_ID);
|
//Build the MAC header for the new packet
|
//Build the MAC header for the new packet
|
// Tu http://lxr.linux.no/linux+*/net/ipv4/arp.c#L586 jest pokazane jak zbudować pakiet!
|
// Here http://lxr.free-electrons.com/source/net/ipv4/arp.c?v=3.17#L608 it is shown how to build a packet!
|
if (dev_hard_header(newskb,sd->dev,MY_PROTO_ID,&sd->mac,sd->dev->dev_addr,MY_ACK_LEN+ETH_HLEN) < 0)
|
if (dev_hard_header(newskb,sd->dev,MY_PROTO_ID,&sd->mac,sd->dev->dev_addr,MY_ACK_LEN+ETH_HLEN) < 0)
|
{
|
{
|
|
mutex_unlock(&sd->usercmd_lock);
|
kfree_skb(newskb);
|
kfree_skb(newskb);
|
return -EINVAL;
|
return -EINVAL;
|
}
|
}
|
//Put the protocol version id to the packet
|
//Put the protocol version id to the packet
|
put_skb_u16(newskb,MY_PROTO_VER);
|
put_skb_u16(newskb,MY_PROTO_VER);
|
Line 303... |
Line 304... |
skb_reserve(newskb,LL_RESERVED_SPACE(sd->dev));
|
skb_reserve(newskb,LL_RESERVED_SPACE(sd->dev));
|
skb_reset_network_header(newskb);
|
skb_reset_network_header(newskb);
|
newskb->dev = sd->dev;
|
newskb->dev = sd->dev;
|
newskb->protocol = htons(MY_PROTO_ID);
|
newskb->protocol = htons(MY_PROTO_ID);
|
//Build the MAC header for the new packet
|
//Build the MAC header for the new packet
|
// Tu http://lxr.linux.no/linux+*/net/ipv4/arp.c#L586 jest pokazane jak zbudować pakiet!
|
// Here http://lxr.free-electrons.com/source/net/ipv4/arp.c?v=3.17#L608 it is shown how to build a packet!
|
if (dev_hard_header(newskb,sd->dev,MY_PROTO_ID,&sd->mac,sd->dev->dev_addr,MY_ACK_LEN+ETH_HLEN) < 0)
|
if (dev_hard_header(newskb,sd->dev,MY_PROTO_ID,&sd->mac,sd->dev->dev_addr,MY_ACK_LEN+ETH_HLEN) < 0)
|
{
|
{
|
|
mutex_unlock(&sd->usercmd_lock);
|
kfree_skb(newskb);
|
kfree_skb(newskb);
|
return -EINVAL;
|
return -EINVAL;
|
}
|
}
|
//Put the protocol version id to the packet
|
//Put the protocol version id to the packet
|
put_skb_u16(newskb,MY_PROTO_VER);
|
put_skb_u16(newskb,MY_PROTO_VER);
|
Line 692... |
Line 694... |
skb_reserve(newskb,LL_RESERVED_SPACE(dev));
|
skb_reserve(newskb,LL_RESERVED_SPACE(dev));
|
skb_reset_network_header(newskb);
|
skb_reset_network_header(newskb);
|
newskb->dev = dev;
|
newskb->dev = dev;
|
newskb->protocol = htons(MY_PROTO_ID);
|
newskb->protocol = htons(MY_PROTO_ID);
|
//Build the MAC header for the new packet
|
//Build the MAC header for the new packet
|
// Here is shown how to build a packet: http://lxr.linux.no/linux+*/net/ipv4/arp.c#L586
|
// Here http://lxr.free-electrons.com/source/net/ipv4/arp.c?v=3.17#L608 it is shown how to build a packet!
|
if (dev_hard_header(newskb,dev,MY_PROTO_ID,&rcv_hdr->h_source,&rcv_hdr->h_dest,MY_ACK_LEN+ETH_HLEN) < 0)
|
if (dev_hard_header(newskb,dev,MY_PROTO_ID,&rcv_hdr->h_source,&rcv_hdr->h_dest,MY_ACK_LEN+ETH_HLEN) < 0)
|
goto error;
|
goto error;
|
//Put the protocol version id to the packet
|
//Put the protocol version id to the packet
|
put_skb_u16(newskb,MY_PROTO_VER);
|
put_skb_u16(newskb,MY_PROTO_VER);
|
//Put the "restart" command to the packet, which should force it to stop transmission
|
//Put the "restart" command to the packet, which should force it to stop transmission
|
Line 885... |
Line 887... |
skb_reserve(newskb,LL_RESERVED_SPACE(dev));
|
skb_reserve(newskb,LL_RESERVED_SPACE(dev));
|
skb_reset_network_header(newskb);
|
skb_reset_network_header(newskb);
|
newskb->dev = dev;
|
newskb->dev = dev;
|
newskb->protocol = htons(MY_PROTO_ID);
|
newskb->protocol = htons(MY_PROTO_ID);
|
//Build the MAC header for the new packet
|
//Build the MAC header for the new packet
|
// Tu http://lxr.linux.no/linux+*/net/ipv4/arp.c#L586 jest pokazane jak zbudować pakiet!
|
// Here http://lxr.free-electrons.com/source/net/ipv4/arp.c?v=3.17#L608 it is shown how to build a packet!
|
if (dev_hard_header(newskb,dev,MY_PROTO_ID,&rcv_hdr->h_source,&rcv_hdr->h_dest,MY_ACK_LEN+ETH_HLEN) < 0)
|
if (dev_hard_header(newskb,dev,MY_PROTO_ID,&rcv_hdr->h_source,&rcv_hdr->h_dest,MY_ACK_LEN+ETH_HLEN) < 0)
|
goto error;
|
goto error;
|
//Put the protocol version id to the packet
|
//Put the protocol version id to the packet
|
put_skb_u16(newskb,MY_PROTO_VER);
|
put_skb_u16(newskb,MY_PROTO_VER);
|
//Put the "ACKNOWLEDGE" type
|
//Put the "ACKNOWLEDGE" type
|