本文整理汇总了C++中skb_set_transport_header函数的典型用法代码示例。如果您正苦于以下问题:C++ skb_set_transport_header函数的具体用法?C++ skb_set_transport_header怎么用?C++ skb_set_transport_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了skb_set_transport_header函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: efx_tso_check_protocol
/*
* Verify that our various assumptions about sk_buffs and the conditions
* under which TSO will be attempted hold true. Return the protocol number.
*/
static __be16 efx_tso_check_protocol(struct sk_buff *skb)
{
__be16 protocol = skb->protocol;
EFX_BUG_ON_PARANOID(((struct ethhdr *)skb->data)->h_proto !=
protocol);
if (protocol == htons(ETH_P_8021Q)) {
/* Find the encapsulated protocol; reset network header
* and transport header based on that. */
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
protocol = veh->h_vlan_encapsulated_proto;
skb_set_network_header(skb, sizeof(*veh));
if (protocol == htons(ETH_P_IP))
skb_set_transport_header(skb, sizeof(*veh) +
4 * ip_hdr(skb)->ihl);
else if (protocol == htons(ETH_P_IPV6))
skb_set_transport_header(skb, sizeof(*veh) +
sizeof(struct ipv6hdr));
}
if (protocol == htons(ETH_P_IP)) {
EFX_BUG_ON_PARANOID(ip_hdr(skb)->protocol != IPPROTO_TCP);
} else {
EFX_BUG_ON_PARANOID(protocol != htons(ETH_P_IPV6));
EFX_BUG_ON_PARANOID(ipv6_hdr(skb)->nexthdr != NEXTHDR_TCP);
}
EFX_BUG_ON_PARANOID((PTR_DIFF(tcp_hdr(skb), skb->data)
+ (tcp_hdr(skb)->doff << 2u)) >
skb_headlen(skb));
return protocol;
}
开发者ID:ANFS,项目名称:ANFS-kernel,代码行数:36,代码来源:tx.c
示例2: ipsec_ocf_ipcomp_copy_expand
/*
* We need to grow the skb to accommodate the expanssion of the ipcomp packet.
*
* The following comment comes from the skb_decompress() which does the
* same...
*
* We have no way of knowing the exact length of the resulting
* decompressed output before we have actually done the decompression.
* For now, we guess that the packet will not be bigger than the
* attached ipsec device's mtu or 16260, whichever is biggest.
* This may be wrong, since the sender's mtu may be bigger yet.
* XXX This must be dealt with later XXX
*/
static int ipsec_ocf_ipcomp_copy_expand(struct ipsec_rcv_state *irs)
{
struct sk_buff *nskb;
unsigned grow_to, grow_by;
ptrdiff_t ptr_delta;
if (!irs->skb)
return IPSEC_RCV_IPCOMPFAILED;
if (irs->skb->dev) {
grow_to = irs->skb->dev->mtu <
16260 ? 16260 : irs->skb->dev->mtu;
} else {
int tot_len;
if (lsw_ip_hdr_version(irs) == 6)
tot_len = ntohs(lsw_ip6_hdr(irs)->payload_len) +
sizeof(struct ipv6hdr);
else
tot_len = ntohs(lsw_ip4_hdr(irs)->tot_len);
grow_to = 65520 - tot_len;
}
grow_by = grow_to - irs->skb->len;
grow_by -= skb_headroom(irs->skb);
grow_by -= skb_tailroom(irs->skb);
/* it's big enough */
if (!grow_by)
return IPSEC_RCV_OK;
nskb = skb_copy_expand(irs->skb, skb_headroom(irs->skb),
skb_tailroom(irs->skb) + grow_by, GFP_ATOMIC);
if (!nskb)
return IPSEC_RCV_ERRMEMALLOC;
memcpy(nskb->head, irs->skb->head, skb_headroom(irs->skb));
skb_set_network_header(nskb,
ipsec_skb_offset(irs->skb,
skb_network_header(irs->skb)));
skb_set_transport_header(nskb,
ipsec_skb_offset(irs->skb,
skb_transport_header(
irs->skb)));
/* update all irs pointers */
ptr_delta = nskb->data - irs->skb->data;
irs->authenticator = (void*)((char*)irs->authenticator + ptr_delta);
irs->iph = (void*)((char*)irs->iph + ptr_delta);
/* flip in the large one */
irs->pre_ipcomp_skb = irs->skb;
irs->skb = nskb;
/* move the tail up to the end to let OCF know how big the buffer is */
if (grow_by > (irs->skb->end - irs->skb->tail))
grow_by = irs->skb->end - irs->skb->tail;
skb_put(irs->skb, grow_by);
return IPSEC_RCV_OK;
}
开发者ID:mndambuki,项目名称:libreSwan,代码行数:73,代码来源:ipsec_ocf.c
示例3: skb_from_pkt
int skb_from_pkt(void *pkt, u32 pkt_len, struct sk_buff **skb)
{
*skb = alloc_skb(LL_MAX_HEADER + pkt_len, GFP_ATOMIC);
if (!*skb) {
log_err("Could not allocate a skb.");
return -ENOMEM;
}
skb_reserve(*skb, LL_MAX_HEADER); /* Reserve space for Link Layer data. */
skb_put(*skb, pkt_len); /* L3 + L4 + payload. */
skb_set_mac_header(*skb, 0);
skb_set_network_header(*skb, 0);
skb_set_transport_header(*skb, net_hdr_size(pkt));
(*skb)->ip_summed = CHECKSUM_UNNECESSARY;
switch (get_l3_proto(pkt)) {
case 6:
(*skb)->protocol = htons(ETH_P_IPV6);
break;
case 4:
(*skb)->protocol = htons(ETH_P_IP);
break;
default:
log_err("Invalid mode: %u.", get_l3_proto(pkt));
kfree_skb(*skb);
return -EINVAL;
}
/* Copy packet content to skb. */
memcpy(skb_network_header(*skb), pkt, pkt_len);
return 0;
}
开发者ID:pandax381,项目名称:NAT64,代码行数:34,代码来源:skb_ops.c
示例4: create_skb
/**
* Joins out.l3_hdr, out.l4_hdr and out.payload into a single packet, placing the result in
* out.packet.
*/
static bool create_skb(struct packet_out *out)
{
struct sk_buff *new_skb;
new_skb = alloc_skb(config.packet_head_room // user's reserved.
+ LL_MAX_HEADER // kernel's reserved + layer 2.
+ out->l3_hdr_len // layer 3.
+ out->l4_hdr_len // layer 4.
+ out->payload_len // packet data.
+ config.packet_tail_room, // user's reserved+.
GFP_ATOMIC);
if (!new_skb) {
log_warning(" New packet allocation failed.");
return false;
}
out->packet = new_skb;
skb_reserve(new_skb, config.packet_head_room + LL_MAX_HEADER);
skb_put(new_skb, out->l3_hdr_len + out->l4_hdr_len + out->payload_len);
skb_reset_mac_header(new_skb);
skb_reset_network_header(new_skb);
skb_set_transport_header(new_skb, out->l3_hdr_len);
memcpy(skb_network_header(new_skb), out->l3_hdr, out->l3_hdr_len);
memcpy(skb_transport_header(new_skb), out->l4_hdr, out->l4_hdr_len);
memcpy(skb_transport_header(new_skb) + out->l4_hdr_len, out->payload, out->payload_len);
return true;
}
开发者ID:tbe,项目名称:NAT64,代码行数:34,代码来源:nf_nat64_translate_packet.c
示例5: ipoptstrip_tg
static unsigned int ipoptstrip_tg(struct sk_buff *skb,
const struct xt_action_param *par) {
struct ip_options *opt = &(IPCB(skb)->opt);
unsigned char *opt_ptr, *opt_end_ptr;
struct iphdr *iphdr;
const struct xt_ipoptstrip_tg_info *info;
__wsum csum32;
if (opt->optlen > 0) {
iphdr = ip_hdr(skb);
info = par->targinfo;
#ifdef DEBUG
printk("flags: %x\n", info->flags);
printk("Packet with IP options (%i bytes) from: %pI4 to: %pI4\n",
opt->optlen, &iphdr->saddr, &iphdr->daddr);
print_skb_header_offsets(skb);
#endif
if (! XT_IPOPTSTRIP_IS_SET(info->flags, XT_IPOPTSTRIP_KEEP_DST)) {
opt_ptr = (unsigned char*) &iphdr[1];
opt_end_ptr = opt_ptr + opt->optlen;
for (; opt_ptr < opt_end_ptr; opt_ptr++) {
switch (*opt_ptr) {
case IPOPT_LSRR:
case IPOPT_SSRR:
/* Re-write destination field with last address */
memcpy(&iphdr->daddr, (opt_ptr+(opt_ptr[1]))-4, 4);
break;
}
}
}
/* Alter header and total lengths */
iphdr->ihl = IPV4_HL; // 5 32-bit words in IPv4 header with no options
iphdr->tot_len -= cpu_to_be16(opt->optlen);
/* Move transport header pointer to after network header */
skb_set_transport_header(skb, IPV4_LEN);
/* Move remaining data up the buffer */
memmove(skb_transport_header(skb), skb_transport_header(skb) + opt->optlen,
skb->tail - (skb->transport_header + opt->optlen));
/* Remove un-needed buffer space */
skb_trim(skb, (skb->len - opt->optlen));
/* Re-calculate IP header checksum */
csum32 = csum_partial(iphdr, sizeof(struct iphdr), 0);
iphdr->check = csum_fold(csum32);
#ifdef DEBUG
print_skb_header_offsets(skb);
#endif
}
return XT_CONTINUE;
}
开发者ID:duncanje,项目名称:xt_IPOPTSTRIP,代码行数:60,代码来源:xt_IPOPTSTRIP.c
示例6: ipv6_mc_check_exthdrs
static int ipv6_mc_check_exthdrs(struct sk_buff *skb)
{
const struct ipv6hdr *ip6h;
int offset;
u8 nexthdr;
__be16 frag_off;
ip6h = ipv6_hdr(skb);
if (ip6h->nexthdr != IPPROTO_HOPOPTS)
return -ENOMSG;
nexthdr = ip6h->nexthdr;
offset = skb_network_offset(skb) + sizeof(*ip6h);
offset = ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off);
if (offset < 0)
return -EINVAL;
if (nexthdr != IPPROTO_ICMPV6)
return -ENOMSG;
skb_set_transport_header(skb, offset);
return 0;
}
开发者ID:Anjali05,项目名称:linux,代码行数:26,代码来源:mcast_snoop.c
示例7: ipsec_xmit_ipip_setup
enum ipsec_xmit_value ipsec_xmit_ipip_setup(struct ipsec_xmit_state *ixs)
{
lsw_ip4_hdr(ixs)->version = 4;
switch (sysctl_ipsec_tos) {
case 0:
lsw_ip4_hdr(ixs)->tos = ip_hdr(ixs->skb)->tos;
break;
case 1:
lsw_ip4_hdr(ixs)->tos = 0;
break;
default:
break;
}
lsw_ip4_hdr(ixs)->ttl = SYSCTL_IPSEC_DEFAULT_TTL;
lsw_ip4_hdr(ixs)->frag_off = 0;
lsw_ip4_hdr(ixs)->saddr =
((struct sockaddr_in*)(ixs->ipsp->ips_addr_s))->sin_addr.s_addr;
lsw_ip4_hdr(ixs)->daddr =
((struct sockaddr_in*)(ixs->ipsp->ips_addr_d))->sin_addr.s_addr;
lsw_ip4_hdr(ixs)->protocol = IPPROTO_IPIP;
lsw_ip4_hdr(ixs)->ihl = sizeof(struct iphdr) >> 2;
#ifdef NET_21
printk("THIS CODE IS NEVER CALLED\n");
skb_set_transport_header(ixs->skb,
ipsec_skb_offset(ixs->skb, ip_hdr(ixs->skb)));
#endif /* NET_21 */
return IPSEC_XMIT_OK;
}
开发者ID:libreswan,项目名称:libreswan,代码行数:30,代码来源:ipsec_ipip.c
示例8: pkt_init_ipv6
verdict pkt_init_ipv6(struct xlation *state, struct sk_buff *skb)
{
struct pkt_metadata meta;
verdict result;
state->in.skb = skb;
/*
* DO NOT, UNDER ANY CIRCUMSTANCES, EXTRACT ANY BYTES FROM THE SKB'S
* DATA AREA DIRECTLY (ie. without using skb_hdr_ptr()) UNTIL YOU KNOW
* IT HAS ALREADY BEEN pskb_may_pull()ED. ASSUME THAT EVEN THE MAIN
* LAYER 3 HEADER CAN BE PAGED.
*
* Also, careful in this function and subfunctions. pskb_may_pull()
* might change pointers, so you generally don't want to store them.
*/
result = paranoid_validations(state, sizeof(struct ipv6hdr));
if (result != VERDICT_CONTINUE)
return result;
log_debug("Packet addresses: %pI6c->%pI6c",
&ipv6_hdr(skb)->saddr,
&ipv6_hdr(skb)->daddr);
if (skb->len != get_tot_len_ipv6(skb))
return inhdr6(state, "Packet size doesn't match the IPv6 header's payload length field.");
result = summarize_skb6(state, skb_network_offset(skb), &meta);
if (result != VERDICT_CONTINUE)
return result;
if (meta.l4_proto == L4PROTO_ICMP) {
/* Do not move this to summarize_skb6(), because it risks infinite recursion. */
result = handle_icmp6(state, &meta);
if (result != VERDICT_CONTINUE)
return result;
}
if (!pskb_may_pull(skb, meta.payload_offset))
return truncated(state, "headers");
state->in.l3_proto = L3PROTO_IPV6;
state->in.l4_proto = meta.l4_proto;
state->in.is_inner = 0;
state->in.is_hairpin = false;
state->in.hdr_frag = meta.has_frag_hdr
? skb_offset_to_ptr(skb, meta.frag_offset)
: NULL;
skb_set_transport_header(skb, meta.l4_offset);
state->in.payload = skb_offset_to_ptr(skb, meta.payload_offset);
state->in.original_pkt = &state->in;
return VERDICT_CONTINUE;
}
开发者ID:NICMx,项目名称:Jool,代码行数:55,代码来源:packet.c
示例9: mhost_local_deliver
int mhost_local_deliver(struct sk_buff *skb)
{
printk(KERN_INFO "mhost_local_deliver called\n");
/* update this pointer */
skb_set_transport_header(skb, 0);
/* logic here to determine appropriate L4 handler */
udp_mhost_rcv(skb);
return 0;
}
开发者ID:spencersevilla,项目名称:mnet,代码行数:12,代码来源:mhost_l3_wrapper.c
示例10: trailer_xmit
netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
struct sk_buff *nskb;
int padlen;
u8 *trailer;
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
/*
* We have to make sure that the trailer ends up as the very
* last 4 bytes of the packet. This means that we have to pad
* the packet to the minimum ethernet frame size, if necessary,
* before adding the trailer.
*/
padlen = 0;
if (skb->len < 60)
padlen = 60 - skb->len;
nskb = alloc_skb(NET_IP_ALIGN + skb->len + padlen + 4, GFP_ATOMIC);
if (nskb == NULL) {
kfree_skb(skb);
return NETDEV_TX_OK;
}
skb_reserve(nskb, NET_IP_ALIGN);
skb_reset_mac_header(nskb);
skb_set_network_header(nskb, skb_network_header(skb) - skb->head);
skb_set_transport_header(nskb, skb_transport_header(skb) - skb->head);
skb_copy_and_csum_dev(skb, skb_put(nskb, skb->len));
kfree_skb(skb);
if (padlen) {
u8 *pad = skb_put(nskb, padlen);
memset(pad, 0, padlen);
}
trailer = skb_put(nskb, 4);
trailer[0] = 0x80;
trailer[1] = 1 << p->port;
trailer[2] = 0x10;
trailer[3] = 0x00;
nskb->protocol = htons(ETH_P_TRAILER);
nskb->dev = p->parent->dst->master_netdev;
dev_queue_xmit(nskb);
return NETDEV_TX_OK;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:51,代码来源:tag_trailer.c
示例11: net_warn_ratelimited
static struct sk_buff *__xip_start_skb(struct sock *sk, struct xip_dst *xdst,
const struct xia_addr *src, int src_n, const struct xia_addr *dest,
int dest_n, u8 dest_last_node, int transhdrlen, int noblock)
{
struct net_device *dev = xdst->dst.dev;
struct sk_buff *skb;
u32 mtu, alloclen;
int hh_len, xh_len, rc;
if (!dev) {
net_warn_ratelimited("XIP %s: there is a bug somewhere, tried to send a datagram, but dst.dev is NULL\n",
__func__);
return ERR_PTR(-ENODEV);
}
mtu = dst_mtu(&xdst->dst);
if (mtu < XIP_MIN_MTU) {
net_warn_ratelimited("XIP %s: cannot send datagram out because mtu (= %u) of dev %s is less than minimum MTU (= %u)\n",
__func__, mtu, dev->name, XIP_MIN_MTU);
return ERR_PTR(-EMSGSIZE);
}
hh_len = LL_RESERVED_SPACE(dev);
alloclen = hh_len + mtu;
skb = sock_alloc_send_skb(sk, alloclen, noblock, &rc);
if (unlikely(!skb))
return ERR_PTR(rc);
/* Fill in the control structures. */
/* Reserve space for the link layer header */
skb_reserve(skb, hh_len);
/* Fill XIP header. */
skb_reset_network_header(skb);
xh_len = xip_hdr_size(dest_n, src_n);
skb_put(skb, xh_len);
xip_fill_in_hdr(skb, xdst, src->s_row, src_n,
dest->s_row, dest_n, dest_last_node);
skb_set_transport_header(skb, xh_len);
skb_put(skb, transhdrlen);
/* XXX Does we need to set skb_shinfo(skb)->tx_flags? */
skb->priority = sk->sk_priority;
skb->mark = sk->sk_mark;
xdst_hold(xdst);
skb_dst_set(skb, &xdst->dst);
return skb;
}
开发者ID:sachinparyani,项目名称:GSoC-Linux-XIA,代码行数:51,代码来源:output.c
示例12: ip_hdr
static struct sk_buff *tnl_skb_gso_segment(struct sk_buff *skb,
netdev_features_t features,
bool tx_path)
{
struct iphdr *iph = ip_hdr(skb);
int pkt_hlen = skb_inner_network_offset(skb); /* inner l2 + tunnel hdr. */
int mac_offset = skb_inner_mac_offset(skb);
struct sk_buff *skb1 = skb;
struct sk_buff *segs;
__be16 proto = skb->protocol;
char cb[sizeof(skb->cb)];
/* setup whole inner packet to get protocol. */
__skb_pull(skb, mac_offset);
skb->protocol = __skb_network_protocol(skb);
/* setup l3 packet to gso, to get around segmentation bug on older kernel.*/
__skb_pull(skb, (pkt_hlen - mac_offset));
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_reset_transport_header(skb);
/* From 3.9 kernel skb->cb is used by skb gso. Therefore
* make copy of it to restore it back. */
memcpy(cb, skb->cb, sizeof(cb));
segs = __skb_gso_segment(skb, 0, tx_path);
if (!segs || IS_ERR(segs))
goto free;
skb = segs;
while (skb) {
__skb_push(skb, pkt_hlen);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_set_transport_header(skb, sizeof(struct iphdr));
skb->mac_len = 0;
memcpy(ip_hdr(skb), iph, pkt_hlen);
memcpy(skb->cb, cb, sizeof(cb));
if (OVS_GSO_CB(skb)->fix_segment)
OVS_GSO_CB(skb)->fix_segment(skb);
skb->protocol = proto;
skb = skb->next;
}
free:
consume_skb(skb1);
return segs;
}
开发者ID:MohanaPriya26,项目名称:ovs-reviews,代码行数:50,代码来源:gso.c
示例13: create_skb
static int create_skb(int (*l3_hdr_fn)(void *, u16, u8, struct tuple *, bool, bool, u16, u8),
int l3_hdr_type, int l3_hdr_len, bool df, bool mf, u16 frag_offset, u8 ttl,
int (*l4_hdr_fn)(void *, int, u16, struct tuple *),
int l4_hdr_type, int l4_hdr_len, int l4_total_len,
int (*payload_fn)(void *, u16), u16 payload_len,
int (*l4_post_fn)(void *, u16, struct tuple *),
struct sk_buff **result, struct tuple *tuple)
{
struct sk_buff *skb;
int datagram_len = l4_hdr_len + payload_len;
int error;
skb = alloc_skb(LL_MAX_HEADER + l3_hdr_len + datagram_len, GFP_ATOMIC);
if (!skb) {
log_err("New packet allocation failed.");
return -ENOMEM;
}
skb->protocol = htons(l3_hdr_type);
skb_reserve(skb, LL_MAX_HEADER);
skb_put(skb, l3_hdr_len + l4_hdr_len + payload_len);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_set_transport_header(skb, l3_hdr_len);
error = l3_hdr_fn(skb_network_header(skb), datagram_len, l4_hdr_type, tuple, df, mf,
frag_offset, ttl);
if (error)
goto failure;
error = l4_hdr_fn(skb_transport_header(skb), l3_hdr_type, l4_total_len, tuple);
if (error)
goto failure;
error = payload_fn(skb_transport_header(skb) + l4_hdr_len, payload_len);
if (error)
goto failure;
error = l4_post_fn(skb_transport_header(skb), datagram_len, tuple);
if (error)
goto failure;
*result = skb;
return 0;
failure:
kfree_skb(skb);
return error;
}
开发者ID:pandax381,项目名称:NAT64,代码行数:49,代码来源:skb_generator.c
示例14: init_skbuff
static void init_skbuff(const struct ipq_packet_msg *ipq_msg, struct sk_buff *skb)
{
memcpy(skb->head, ipq_msg->payload, ipq_msg->data_len);
skb->len = skb->data_len = ipq_msg->data_len;
// Becasue the payload of ipq_msg l3 packet. so there is no mac header
skb_set_mac_header(skb, ~0U);
skb_set_network_header(skb, 0);
struct iphdr *iph = (struct iphdr*)skb_network_header(skb);
skb_set_transport_header(skb, iph->ihl<<2);
}
开发者ID:TrainingProject,项目名称:light_tcp_proxy,代码行数:15,代码来源:ltp_ipq_rcv.c
示例15: xfrm6_ro_output
/* Add route optimization header space.
*
* The IP header and mutable extension headers will be moved forward to make
* space for the route optimization header.
*
* On exit, skb->h will be set to the start of the encapsulation header to be
* filled in by x->type->output and skb->nh will be set to the nextheader field
* of the extension header directly preceding the encapsulation header, or in
* its absence, that of the top IP header. The value of skb->data will always
* point to the top IP header.
*/
static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
{
struct ipv6hdr *iph;
u8 *prevhdr;
int hdr_len;
skb_push(skb, x->props.header_len);
iph = ipv6_hdr(skb);
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
skb_set_network_header(skb,
(prevhdr - x->props.header_len) - skb->data);
skb_set_transport_header(skb, hdr_len);
memmove(skb->data, iph, hdr_len);
return 0;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:27,代码来源:xfrm6_mode_ro.c
示例16: prepare_frame_for_deferred_tx
/* Headroom is not adjusted. Caller should ensure that skb has sufficient
* headroom in case the frame is encrypted. */
static void prepare_frame_for_deferred_tx(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb)
{
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
skb_set_mac_header(skb, 0);
skb_set_network_header(skb, 0);
skb_set_transport_header(skb, 0);
/* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
skb->priority = 7;
info->control.vif = &sdata->vif;
info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
ieee80211_set_qos_hdr(sdata, skb);
}
开发者ID:Eijk,项目名称:tlwn722n-linux-install,代码行数:19,代码来源:mesh_hwmp.c
示例17: pkt_init_ipv4
verdict pkt_init_ipv4(struct xlation *state, struct sk_buff *skb)
{
struct pkt_metadata meta;
verdict result;
state->in.skb = skb;
/*
* DO NOT, UNDER ANY CIRCUMSTANCES, EXTRACT ANY BYTES FROM THE SKB'S
* DATA AREA DIRECTLY (ie. without using skb_hdr_ptr()) UNTIL YOU KNOW
* IT HAS ALREADY BEEN pskb_may_pull()ED. ASSUME THAT EVEN THE MAIN
* LAYER 3 HEADER CAN BE PAGED.
*
* Also, careful in this function and subfunctions. pskb_may_pull()
* might change pointers, so you generally don't want to store them.
*/
result = paranoid_validations(state, sizeof(struct iphdr));
if (result != VERDICT_CONTINUE)
return result;
log_debug("Packet addresses: %pI4->%pI4",
&ip_hdr(skb)->saddr,
&ip_hdr(skb)->daddr);
result = summarize_skb4(state, &meta);
if (result != VERDICT_CONTINUE)
return result;
if (!pskb_may_pull(skb, meta.payload_offset)) {
log_debug("Could not 'pull' the headers out of the skb.");
return truncated(state, "headers");
}
state->in.l3_proto = L3PROTO_IPV4;
state->in.l4_proto = meta.l4_proto;
state->in.is_inner = false;
state->in.is_hairpin = false;
state->in.hdr_frag = NULL;
skb_set_transport_header(skb, meta.l4_offset);
state->in.payload = skb_offset_to_ptr(skb, meta.payload_offset);
state->in.original_pkt = &state->in;
return VERDICT_CONTINUE;
}
开发者ID:NICMx,项目名称:Jool,代码行数:45,代码来源:packet.c
示例18: check_iphdr
static int check_iphdr(struct sk_buff *skb)
{
unsigned int nh_ofs = skb_network_offset(skb);
unsigned int ip_len;
int err;
err = check_header(skb, nh_ofs + sizeof(struct iphdr));
if (unlikely(err))
return err;
ip_len = ip_hdrlen(skb);
if (unlikely(ip_len < sizeof(struct iphdr) ||
skb->len < nh_ofs + ip_len))
return -EINVAL;
skb_set_transport_header(skb, nh_ofs + ip_len);
return 0;
}
开发者ID:JunPark,项目名称:openvswitch,代码行数:18,代码来源:flow.c
示例19: parse_ipv6hdr
static int parse_ipv6hdr(struct sk_buff *skb, struct sw_flow_key *key,
int *key_lenp)
{
unsigned int nh_ofs = skb_network_offset(skb);
unsigned int nh_len;
int payload_ofs;
struct ipv6hdr *nh;
uint8_t nexthdr;
__be16 frag_off;
int err;
*key_lenp = SW_FLOW_KEY_OFFSET(ipv6.label);
err = check_header(skb, nh_ofs + sizeof(*nh));
if (unlikely(err))
return err;
nh = ipv6_hdr(skb);
nexthdr = nh->nexthdr;
payload_ofs = (u8 *)(nh + 1) - skb->data;
key->ip.proto = NEXTHDR_NONE;
key->ip.tos = ipv6_get_dsfield(nh);
key->ip.ttl = nh->hop_limit;
key->ipv6.label = *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL);
key->ipv6.addr.src = nh->saddr;
key->ipv6.addr.dst = nh->daddr;
payload_ofs = ipv6_skip_exthdr(skb, payload_ofs, &nexthdr, &frag_off);
if (unlikely(payload_ofs < 0))
return -EINVAL;
if (frag_off) {
if (frag_off & htons(~0x7))
key->ip.frag = OVS_FRAG_TYPE_LATER;
else
key->ip.frag = OVS_FRAG_TYPE_FIRST;
}
nh_len = payload_ofs - nh_ofs;
skb_set_transport_header(skb, nh_ofs + nh_len);
key->ip.proto = nexthdr;
return nh_len;
}
开发者ID:JunPark,项目名称:openvswitch,代码行数:44,代码来源:flow.c
示例20: nat64_alloc_skb
static struct sk_buff*
nat64_alloc_skb(int tlen, int paylen)
{
struct sk_buff *skb;
skb = alloc_skb(LL_MAX_HEADER + tlen + paylen, GFP_ATOMIC);
if (!skb) {
return NULL;
}
skb_reserve(skb, LL_MAX_HEADER);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
skb_set_transport_header(skb, tlen);
skb_put(skb, tlen + paylen);
return skb;
}
开发者ID:credil,项目名称:ecdysis,代码行数:20,代码来源:nf_nat64_main.c
注:本文中的skb_set_transport_header函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论