forked from Minki/linux
[SK_BUFF]: Introduce ipv6_hdr(), remove skb->nh.ipv6h
Now the skb->nh union has just one member, .raw, i.e. it is just like the skb->mac union, strange, no? I'm just leaving it like that till the transport layer is done with, when we'll rename skb->mac.raw to skb->mac_header (or ->mac_header_offset?), ditto for ->{h,nh}. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d0a92be05e
commit
0660e03f6b
@ -1304,8 +1304,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_start = (char*)&(skb->nh.ipv6h->daddr);
|
hash_start = (char *)&(ipv6_hdr(skb)->daddr);
|
||||||
hash_size = sizeof(skb->nh.ipv6h->daddr);
|
hash_size = sizeof(ipv6_hdr(skb)->daddr);
|
||||||
break;
|
break;
|
||||||
case ETH_P_IPX:
|
case ETH_P_IPX:
|
||||||
if (ipx_hdr(skb)->ipx_checksum !=
|
if (ipx_hdr(skb)->ipx_checksum !=
|
||||||
|
@ -2899,13 +2899,11 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
|
|||||||
cmd_length = E1000_TXD_CMD_IP;
|
cmd_length = E1000_TXD_CMD_IP;
|
||||||
ipcse = skb->h.raw - skb->data - 1;
|
ipcse = skb->h.raw - skb->data - 1;
|
||||||
} else if (skb->protocol == htons(ETH_P_IPV6)) {
|
} else if (skb->protocol == htons(ETH_P_IPV6)) {
|
||||||
skb->nh.ipv6h->payload_len = 0;
|
ipv6_hdr(skb)->payload_len = 0;
|
||||||
skb->h.th->check =
|
skb->h.th->check =
|
||||||
~csum_ipv6_magic(&skb->nh.ipv6h->saddr,
|
~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->daddr,
|
||||||
0,
|
0, IPPROTO_TCP, 0);
|
||||||
IPPROTO_TCP,
|
|
||||||
0);
|
|
||||||
ipcse = 0;
|
ipcse = 0;
|
||||||
}
|
}
|
||||||
ipcss = skb_network_offset(skb);
|
ipcss = skb_network_offset(skb);
|
||||||
|
@ -479,9 +479,11 @@ qeth_eddp_fill_context_tcp(struct qeth_eddp_context *ctx,
|
|||||||
skb->h.raw,
|
skb->h.raw,
|
||||||
skb->h.th->doff * 4);
|
skb->h.th->doff * 4);
|
||||||
else
|
else
|
||||||
eddp = qeth_eddp_create_eddp_data(qhdr, (u8 *)skb->nh.ipv6h,
|
eddp = qeth_eddp_create_eddp_data(qhdr,
|
||||||
sizeof(struct ipv6hdr),
|
skb_network_header(skb),
|
||||||
(u8 *)skb->h.th, skb->h.th->doff*4);
|
sizeof(struct ipv6hdr),
|
||||||
|
skb->h.raw,
|
||||||
|
skb->h.th->doff * 4);
|
||||||
|
|
||||||
if (eddp == NULL) {
|
if (eddp == NULL) {
|
||||||
QETH_DBF_TEXT(trace, 2, "eddpfcnm");
|
QETH_DBF_TEXT(trace, 2, "eddpfcnm");
|
||||||
|
@ -4053,7 +4053,8 @@ qeth_fill_header(struct qeth_card *card, struct qeth_hdr *hdr,
|
|||||||
skb->dst->neighbour->primary_key, 16);
|
skb->dst->neighbour->primary_key, 16);
|
||||||
} else {
|
} else {
|
||||||
/* fill in destination address used in ip header */
|
/* fill in destination address used in ip header */
|
||||||
memcpy(hdr->hdr.l3.dest_addr, &skb->nh.ipv6h->daddr, 16);
|
memcpy(hdr->hdr.l3.dest_addr,
|
||||||
|
&ipv6_hdr(skb)->daddr, 16);
|
||||||
}
|
}
|
||||||
} else { /* passthrough */
|
} else { /* passthrough */
|
||||||
if((skb->dev->type == ARPHRD_IEEE802_TR) &&
|
if((skb->dev->type == ARPHRD_IEEE802_TR) &&
|
||||||
|
@ -64,7 +64,7 @@ static inline void
|
|||||||
qeth_tso_set_tcpip_header(struct qeth_card *card, struct sk_buff *skb)
|
qeth_tso_set_tcpip_header(struct qeth_card *card, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct iphdr *iph = ip_hdr(skb);
|
struct iphdr *iph = ip_hdr(skb);
|
||||||
struct ipv6hdr *ip6h = skb->nh.ipv6h;
|
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||||
struct tcphdr *tcph = skb->h.th;
|
struct tcphdr *tcph = skb->h.th;
|
||||||
|
|
||||||
tcph->check = 0;
|
tcph->check = 0;
|
||||||
|
@ -223,6 +223,11 @@ enum {
|
|||||||
#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
|
#include <net/if_inet6.h> /* struct ipv6_mc_socklist */
|
||||||
#include <net/inet_sock.h>
|
#include <net/inet_sock.h>
|
||||||
|
|
||||||
|
static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
|
||||||
|
{
|
||||||
|
return (struct ipv6hdr *)skb_network_header(skb);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This structure contains results of exthdrs parsing
|
This structure contains results of exthdrs parsing
|
||||||
as offsets from skb->nh.
|
as offsets from skb->nh.
|
||||||
|
@ -247,7 +247,6 @@ struct sk_buff {
|
|||||||
} h;
|
} h;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct ipv6hdr *ipv6h;
|
|
||||||
unsigned char *raw;
|
unsigned char *raw;
|
||||||
} nh;
|
} nh;
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
|
|||||||
case __constant_htons(ETH_P_IPV6):
|
case __constant_htons(ETH_P_IPV6):
|
||||||
if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
|
if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
|
||||||
skb->tail)
|
skb->tail)
|
||||||
return IP6_ECN_set_ce(skb->nh.ipv6h);
|
return IP6_ECN_set_ce(ipv6_hdr(skb));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ static struct net_device *setup_pre_routing(struct sk_buff *skb)
|
|||||||
/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
|
/* We only check the length. A bridge shouldn't do any hop-by-hop stuff anyway */
|
||||||
static int check_hbh_len(struct sk_buff *skb)
|
static int check_hbh_len(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
unsigned char *raw = (u8 *) (skb->nh.ipv6h + 1);
|
unsigned char *raw = (u8 *)(ipv6_hdr(skb) + 1);
|
||||||
u32 pkt_len;
|
u32 pkt_len;
|
||||||
const unsigned char *nh = skb_network_header(skb);
|
const unsigned char *nh = skb_network_header(skb);
|
||||||
int off = raw - nh;
|
int off = raw - nh;
|
||||||
@ -400,7 +400,7 @@ static int check_hbh_len(struct sk_buff *skb)
|
|||||||
goto bad;
|
goto bad;
|
||||||
pkt_len = ntohl(*(__be32 *) (nh + off + 2));
|
pkt_len = ntohl(*(__be32 *) (nh + off + 2));
|
||||||
if (pkt_len <= IPV6_MAXPLEN ||
|
if (pkt_len <= IPV6_MAXPLEN ||
|
||||||
skb->nh.ipv6h->payload_len)
|
ipv6_hdr(skb)->payload_len)
|
||||||
goto bad;
|
goto bad;
|
||||||
if (pkt_len > skb->len - sizeof(struct ipv6hdr))
|
if (pkt_len > skb->len - sizeof(struct ipv6hdr))
|
||||||
goto bad;
|
goto bad;
|
||||||
@ -441,7 +441,7 @@ static unsigned int br_nf_pre_routing_ipv6(unsigned int hook,
|
|||||||
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
|
if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
|
||||||
goto inhdr_error;
|
goto inhdr_error;
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
if (hdr->version != 6)
|
if (hdr->version != 6)
|
||||||
goto inhdr_error;
|
goto inhdr_error;
|
||||||
|
@ -2736,7 +2736,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
|
|||||||
skb->protocol = protocol;
|
skb->protocol = protocol;
|
||||||
skb->dev = odev;
|
skb->dev = odev;
|
||||||
skb->pkt_type = PACKET_HOST;
|
skb->pkt_type = PACKET_HOST;
|
||||||
skb->nh.ipv6h = iph;
|
skb->nh.raw = (unsigned char *)iph;
|
||||||
skb->h.uh = udph;
|
skb->h.uh = udph;
|
||||||
|
|
||||||
if (pkt_dev->nfrags <= 0)
|
if (pkt_dev->nfrags <= 0)
|
||||||
|
@ -84,8 +84,8 @@ static inline __u32 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
|
|||||||
|
|
||||||
static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb)
|
static inline __u32 dccp_v6_init_sequence(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return secure_dccpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
|
return secure_dccpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
|
||||||
skb->nh.ipv6h->saddr.s6_addr32,
|
ipv6_hdr(skb)->saddr.s6_addr32,
|
||||||
dccp_hdr(skb)->dccph_dport,
|
dccp_hdr(skb)->dccph_dport,
|
||||||
dccp_hdr(skb)->dccph_sport );
|
dccp_hdr(skb)->dccph_sport );
|
||||||
|
|
||||||
@ -313,6 +313,7 @@ static void dccp_v6_reqsk_destructor(struct request_sock *req)
|
|||||||
static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
||||||
{
|
{
|
||||||
struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
|
struct dccp_hdr *rxdh = dccp_hdr(rxskb), *dh;
|
||||||
|
struct ipv6hdr *rxip6h;
|
||||||
const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) +
|
const u32 dccp_hdr_reset_len = sizeof(struct dccp_hdr) +
|
||||||
sizeof(struct dccp_hdr_ext) +
|
sizeof(struct dccp_hdr_ext) +
|
||||||
sizeof(struct dccp_hdr_reset);
|
sizeof(struct dccp_hdr_reset);
|
||||||
@ -352,12 +353,13 @@ static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
|
|||||||
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
|
dccp_hdr_set_ack(dccp_hdr_ack_bits(skb), DCCP_SKB_CB(rxskb)->dccpd_seq);
|
||||||
|
|
||||||
dccp_csum_outgoing(skb);
|
dccp_csum_outgoing(skb);
|
||||||
dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxskb->nh.ipv6h->saddr,
|
rxip6h = ipv6_hdr(rxskb);
|
||||||
&rxskb->nh.ipv6h->daddr);
|
dh->dccph_checksum = dccp_v6_csum_finish(skb, &rxip6h->saddr,
|
||||||
|
&rxip6h->daddr);
|
||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
ipv6_addr_copy(&fl.fl6_dst, &rxskb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&fl.fl6_dst, &rxip6h->saddr);
|
||||||
ipv6_addr_copy(&fl.fl6_src, &rxskb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&fl.fl6_src, &rxip6h->daddr);
|
||||||
|
|
||||||
fl.proto = IPPROTO_DCCP;
|
fl.proto = IPPROTO_DCCP;
|
||||||
fl.oif = inet6_iif(rxskb);
|
fl.oif = inet6_iif(rxskb);
|
||||||
@ -390,7 +392,7 @@ static struct request_sock_ops dccp6_request_sock_ops = {
|
|||||||
static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
|
static struct sock *dccp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
const struct dccp_hdr *dh = dccp_hdr(skb);
|
const struct dccp_hdr *dh = dccp_hdr(skb);
|
||||||
const struct ipv6hdr *iph = skb->nh.ipv6h;
|
const struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
struct sock *nsk;
|
struct sock *nsk;
|
||||||
struct request_sock **prev;
|
struct request_sock **prev;
|
||||||
/* Find possible connection requests. */
|
/* Find possible connection requests. */
|
||||||
@ -460,8 +462,8 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||||||
goto drop_and_free;
|
goto drop_and_free;
|
||||||
|
|
||||||
ireq6 = inet6_rsk(req);
|
ireq6 = inet6_rsk(req);
|
||||||
ipv6_addr_copy(&ireq6->rmt_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&ireq6->rmt_addr, &ipv6_hdr(skb)->saddr);
|
||||||
ipv6_addr_copy(&ireq6->loc_addr, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&ireq6->loc_addr, &ipv6_hdr(skb)->daddr);
|
||||||
ireq6->pktopts = NULL;
|
ireq6->pktopts = NULL;
|
||||||
|
|
||||||
if (ipv6_opt_accepted(sk, skb) ||
|
if (ipv6_opt_accepted(sk, skb) ||
|
||||||
@ -546,7 +548,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
|||||||
newnp->pktoptions = NULL;
|
newnp->pktoptions = NULL;
|
||||||
newnp->opt = NULL;
|
newnp->opt = NULL;
|
||||||
newnp->mcast_oif = inet6_iif(skb);
|
newnp->mcast_oif = inet6_iif(skb);
|
||||||
newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
|
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
|
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
|
||||||
@ -653,7 +655,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
|
|||||||
}
|
}
|
||||||
newnp->opt = NULL;
|
newnp->opt = NULL;
|
||||||
newnp->mcast_oif = inet6_iif(skb);
|
newnp->mcast_oif = inet6_iif(skb);
|
||||||
newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
|
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clone native IPv6 options from listening socket (if any)
|
* Clone native IPv6 options from listening socket (if any)
|
||||||
@ -826,8 +828,8 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
|
|||||||
goto discard_it;
|
goto discard_it;
|
||||||
|
|
||||||
/* Step 1: If header checksum is incorrect, drop packet and return. */
|
/* Step 1: If header checksum is incorrect, drop packet and return. */
|
||||||
if (dccp_v6_csum_finish(skb, &skb->nh.ipv6h->saddr,
|
if (dccp_v6_csum_finish(skb, &ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr)) {
|
&ipv6_hdr(skb)->daddr)) {
|
||||||
DCCP_WARN("dropped packet with invalid checksum\n");
|
DCCP_WARN("dropped packet with invalid checksum\n");
|
||||||
goto discard_it;
|
goto discard_it;
|
||||||
}
|
}
|
||||||
@ -844,9 +846,9 @@ static int dccp_v6_rcv(struct sk_buff **pskb)
|
|||||||
|
|
||||||
/* Step 2:
|
/* Step 2:
|
||||||
* Look up flow ID in table and get corresponding socket */
|
* Look up flow ID in table and get corresponding socket */
|
||||||
sk = __inet6_lookup(&dccp_hashinfo, &skb->nh.ipv6h->saddr,
|
sk = __inet6_lookup(&dccp_hashinfo, &ipv6_hdr(skb)->saddr,
|
||||||
dh->dccph_sport,
|
dh->dccph_sport,
|
||||||
&skb->nh.ipv6h->daddr, ntohs(dh->dccph_dport),
|
&ipv6_hdr(skb)->daddr, ntohs(dh->dccph_dport),
|
||||||
inet6_iif(skb));
|
inet6_iif(skb));
|
||||||
/*
|
/*
|
||||||
* Step 2:
|
* Step 2:
|
||||||
|
@ -535,7 +535,7 @@ static inline void ipgre_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
|
|||||||
if (skb->protocol == htons(ETH_P_IP)) {
|
if (skb->protocol == htons(ETH_P_IP)) {
|
||||||
IP_ECN_set_ce(ip_hdr(skb));
|
IP_ECN_set_ce(ip_hdr(skb));
|
||||||
} else if (skb->protocol == htons(ETH_P_IPV6)) {
|
} else if (skb->protocol == htons(ETH_P_IPV6)) {
|
||||||
IP6_ECN_set_ce(skb->nh.ipv6h);
|
IP6_ECN_set_ce(ipv6_hdr(skb));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
addr_type = ipv6_addr_type(addr6);
|
addr_type = ipv6_addr_type(addr6);
|
||||||
|
|
||||||
if (addr_type == IPV6_ADDR_ANY) {
|
if (addr_type == IPV6_ADDR_ANY) {
|
||||||
addr6 = &skb->nh.ipv6h->daddr;
|
addr6 = &ipv6_hdr(skb)->daddr;
|
||||||
addr_type = ipv6_addr_type(addr6);
|
addr_type = ipv6_addr_type(addr6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb)
|
|||||||
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
|
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (INET_ECN_is_ce(iph->tos))
|
if (INET_ECN_is_ce(iph->tos))
|
||||||
IP6_ECN_set_ce(skb->nh.ipv6h);
|
IP6_ECN_set_ce(ipv6_hdr(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add encapsulation header.
|
/* Add encapsulation header.
|
||||||
|
@ -325,6 +325,7 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct ipv6_auth_hdr *ah;
|
struct ipv6_auth_hdr *ah;
|
||||||
|
struct ipv6hdr *ip6h;
|
||||||
struct ah_data *ahp;
|
struct ah_data *ahp;
|
||||||
unsigned char *tmp_hdr = NULL;
|
unsigned char *tmp_hdr = NULL;
|
||||||
u16 hdr_len;
|
u16 hdr_len;
|
||||||
@ -357,13 +358,14 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC);
|
tmp_hdr = kmemdup(skb_network_header(skb), hdr_len, GFP_ATOMIC);
|
||||||
if (!tmp_hdr)
|
if (!tmp_hdr)
|
||||||
goto out;
|
goto out;
|
||||||
if (ipv6_clear_mutable_options(skb->nh.ipv6h, hdr_len, XFRM_POLICY_IN))
|
ip6h = ipv6_hdr(skb);
|
||||||
|
if (ipv6_clear_mutable_options(ip6h, hdr_len, XFRM_POLICY_IN))
|
||||||
goto free_out;
|
goto free_out;
|
||||||
skb->nh.ipv6h->priority = 0;
|
ip6h->priority = 0;
|
||||||
skb->nh.ipv6h->flow_lbl[0] = 0;
|
ip6h->flow_lbl[0] = 0;
|
||||||
skb->nh.ipv6h->flow_lbl[1] = 0;
|
ip6h->flow_lbl[1] = 0;
|
||||||
skb->nh.ipv6h->flow_lbl[2] = 0;
|
ip6h->flow_lbl[2] = 0;
|
||||||
skb->nh.ipv6h->hop_limit = 0;
|
ip6h->hop_limit = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
u8 auth_data[MAX_AH_AUTH_LEN];
|
u8 auth_data[MAX_AH_AUTH_LEN];
|
||||||
|
@ -254,7 +254,7 @@ void ipv6_local_error(struct sock *sk, int err, struct flowi *fl, u32 info)
|
|||||||
|
|
||||||
skb_put(skb, sizeof(struct ipv6hdr));
|
skb_put(skb, sizeof(struct ipv6hdr));
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
|
ipv6_addr_copy(&iph->daddr, &fl->fl6_dst);
|
||||||
|
|
||||||
serr = SKB_EXT_ERR(skb);
|
serr = SKB_EXT_ERR(skb);
|
||||||
@ -340,7 +340,7 @@ int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len)
|
|||||||
sin->sin6_flowinfo = 0;
|
sin->sin6_flowinfo = 0;
|
||||||
sin->sin6_scope_id = 0;
|
sin->sin6_scope_id = 0;
|
||||||
if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
|
if (serr->ee.ee_origin == SO_EE_ORIGIN_ICMP6) {
|
||||||
ipv6_addr_copy(&sin->sin6_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&sin->sin6_addr, &ipv6_hdr(skb)->saddr);
|
||||||
if (np->rxopt.all)
|
if (np->rxopt.all)
|
||||||
datagram_recv_ctl(sk, msg, skb);
|
datagram_recv_ctl(sk, msg, skb);
|
||||||
if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
if (ipv6_addr_type(&sin->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||||
@ -391,17 +391,17 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
|
|||||||
struct in6_pktinfo src_info;
|
struct in6_pktinfo src_info;
|
||||||
|
|
||||||
src_info.ipi6_ifindex = opt->iif;
|
src_info.ipi6_ifindex = opt->iif;
|
||||||
ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
|
||||||
put_cmsg(msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);
|
put_cmsg(msg, SOL_IPV6, IPV6_PKTINFO, sizeof(src_info), &src_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np->rxopt.bits.rxhlim) {
|
if (np->rxopt.bits.rxhlim) {
|
||||||
int hlim = skb->nh.ipv6h->hop_limit;
|
int hlim = ipv6_hdr(skb)->hop_limit;
|
||||||
put_cmsg(msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
|
put_cmsg(msg, SOL_IPV6, IPV6_HOPLIMIT, sizeof(hlim), &hlim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (np->rxopt.bits.rxtclass) {
|
if (np->rxopt.bits.rxtclass) {
|
||||||
int tclass = (ntohl(*(__be32 *)skb->nh.ipv6h) >> 20) & 0xff;
|
int tclass = (ntohl(*(__be32 *)ipv6_hdr(skb)) >> 20) & 0xff;
|
||||||
put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
|
put_cmsg(msg, SOL_IPV6, IPV6_TCLASS, sizeof(tclass), &tclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,7 +428,7 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
|
|||||||
* IPV6_RECVDSTOPTS is more generic. --yoshfuji
|
* IPV6_RECVDSTOPTS is more generic. --yoshfuji
|
||||||
*/
|
*/
|
||||||
unsigned int off = sizeof(struct ipv6hdr);
|
unsigned int off = sizeof(struct ipv6hdr);
|
||||||
u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
u8 nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
|
|
||||||
while (off <= opt->lastopt) {
|
while (off <= opt->lastopt) {
|
||||||
unsigned len;
|
unsigned len;
|
||||||
@ -466,11 +466,11 @@ int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, struct sk_buff *skb)
|
|||||||
struct in6_pktinfo src_info;
|
struct in6_pktinfo src_info;
|
||||||
|
|
||||||
src_info.ipi6_ifindex = opt->iif;
|
src_info.ipi6_ifindex = opt->iif;
|
||||||
ipv6_addr_copy(&src_info.ipi6_addr, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&src_info.ipi6_addr, &ipv6_hdr(skb)->daddr);
|
||||||
put_cmsg(msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);
|
put_cmsg(msg, SOL_IPV6, IPV6_2292PKTINFO, sizeof(src_info), &src_info);
|
||||||
}
|
}
|
||||||
if (np->rxopt.bits.rxohlim) {
|
if (np->rxopt.bits.rxohlim) {
|
||||||
int hlim = skb->nh.ipv6h->hop_limit;
|
int hlim = ipv6_hdr(skb)->hop_limit;
|
||||||
put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);
|
put_cmsg(msg, SOL_IPV6, IPV6_2292HOPLIMIT, sizeof(hlim), &hlim);
|
||||||
}
|
}
|
||||||
if (np->rxopt.bits.ohopopts && opt->hop) {
|
if (np->rxopt.bits.ohopopts && opt->hop) {
|
||||||
|
@ -191,7 +191,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb->ip_summed = CHECKSUM_NONE;
|
||||||
|
|
||||||
esph = (struct ipv6_esp_hdr*)skb->data;
|
esph = (struct ipv6_esp_hdr*)skb->data;
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
/* Get ivec. This can be wrong, check against another impls. */
|
/* Get ivec. This can be wrong, check against another impls. */
|
||||||
if (esp->conf.ivlen)
|
if (esp->conf.ivlen)
|
||||||
|
@ -125,7 +125,7 @@ static int ip6_tlvopt_unknown(struct sk_buff **skbp, int optoff)
|
|||||||
/* Actually, it is redundant check. icmp_send
|
/* Actually, it is redundant check. icmp_send
|
||||||
will recheck in any case.
|
will recheck in any case.
|
||||||
*/
|
*/
|
||||||
if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr))
|
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr))
|
||||||
break;
|
break;
|
||||||
case 2: /* send ICMP PARM PROB regardless and drop packet */
|
case 2: /* send ICMP PARM PROB regardless and drop packet */
|
||||||
icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
|
icmpv6_param_prob(skb, ICMPV6_UNK_OPTION, optoff);
|
||||||
@ -202,7 +202,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
|
|||||||
struct sk_buff *skb = *skbp;
|
struct sk_buff *skb = *skbp;
|
||||||
struct ipv6_destopt_hao *hao;
|
struct ipv6_destopt_hao *hao;
|
||||||
struct inet6_skb_parm *opt = IP6CB(skb);
|
struct inet6_skb_parm *opt = IP6CB(skb);
|
||||||
struct ipv6hdr *ipv6h = skb->nh.ipv6h;
|
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||||
struct in6_addr tmp_addr;
|
struct in6_addr tmp_addr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ static int ipv6_dest_hao(struct sk_buff **skbp, int optoff)
|
|||||||
*skbp = skb = skb2;
|
*skbp = skb = skb2;
|
||||||
hao = (struct ipv6_destopt_hao *)(skb_network_header(skb2) +
|
hao = (struct ipv6_destopt_hao *)(skb_network_header(skb2) +
|
||||||
optoff);
|
optoff);
|
||||||
ipv6h = skb2->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
if (skb->ip_summed == CHECKSUM_COMPLETE)
|
||||||
@ -414,7 +414,7 @@ static int ipv6_rthdr_rcv(struct sk_buff **skbp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr) ||
|
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr) ||
|
||||||
skb->pkt_type != PACKET_HOST) {
|
skb->pkt_type != PACKET_HOST) {
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
||||||
IPSTATS_MIB_INADDRERRORS);
|
IPSTATS_MIB_INADDRERRORS);
|
||||||
@ -522,7 +522,7 @@ looped_back:
|
|||||||
#ifdef CONFIG_IPV6_MIP6
|
#ifdef CONFIG_IPV6_MIP6
|
||||||
case IPV6_SRCRT_TYPE_2:
|
case IPV6_SRCRT_TYPE_2:
|
||||||
if (xfrm6_input_addr(skb, (xfrm_address_t *)addr,
|
if (xfrm6_input_addr(skb, (xfrm_address_t *)addr,
|
||||||
(xfrm_address_t *)&skb->nh.ipv6h->saddr,
|
(xfrm_address_t *)&ipv6_hdr(skb)->saddr,
|
||||||
IPPROTO_ROUTING) < 0) {
|
IPPROTO_ROUTING) < 0) {
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
||||||
IPSTATS_MIB_INADDRERRORS);
|
IPSTATS_MIB_INADDRERRORS);
|
||||||
@ -549,8 +549,8 @@ looped_back:
|
|||||||
}
|
}
|
||||||
|
|
||||||
ipv6_addr_copy(&daddr, addr);
|
ipv6_addr_copy(&daddr, addr);
|
||||||
ipv6_addr_copy(addr, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(addr, &ipv6_hdr(skb)->daddr);
|
||||||
ipv6_addr_copy(&skb->nh.ipv6h->daddr, &daddr);
|
ipv6_addr_copy(&ipv6_hdr(skb)->daddr, &daddr);
|
||||||
|
|
||||||
dst_release(xchg(&skb->dst, NULL));
|
dst_release(xchg(&skb->dst, NULL));
|
||||||
ip6_route_input(skb);
|
ip6_route_input(skb);
|
||||||
@ -561,7 +561,7 @@ looped_back:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skb->dst->dev->flags&IFF_LOOPBACK) {
|
if (skb->dst->dev->flags&IFF_LOOPBACK) {
|
||||||
if (skb->nh.ipv6h->hop_limit <= 1) {
|
if (ipv6_hdr(skb)->hop_limit <= 1) {
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
||||||
IPSTATS_MIB_INHDRERRORS);
|
IPSTATS_MIB_INHDRERRORS);
|
||||||
icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
|
icmpv6_send(skb, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
|
||||||
@ -569,7 +569,7 @@ looped_back:
|
|||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
skb->nh.ipv6h->hop_limit--;
|
ipv6_hdr(skb)->hop_limit--;
|
||||||
goto looped_back;
|
goto looped_back;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ static int ipv6_hop_jumbo(struct sk_buff **skbp, int optoff)
|
|||||||
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
|
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (skb->nh.ipv6h->payload_len) {
|
if (ipv6_hdr(skb)->payload_len) {
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INHDRERRORS);
|
||||||
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
|
icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -129,9 +129,9 @@ void icmpv6_param_prob(struct sk_buff *skb, int code, int pos)
|
|||||||
|
|
||||||
static int is_ineligible(struct sk_buff *skb)
|
static int is_ineligible(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
int ptr = (u8*)(skb->nh.ipv6h+1) - skb->data;
|
int ptr = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
|
||||||
int len = skb->len - ptr;
|
int len = skb->len - ptr;
|
||||||
__u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
__u8 nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return 1;
|
return 1;
|
||||||
@ -275,7 +275,7 @@ static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, st
|
|||||||
#ifdef CONFIG_IPV6_MIP6
|
#ifdef CONFIG_IPV6_MIP6
|
||||||
static void mip6_addr_swap(struct sk_buff *skb)
|
static void mip6_addr_swap(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
struct inet6_skb_parm *opt = IP6CB(skb);
|
struct inet6_skb_parm *opt = IP6CB(skb);
|
||||||
struct ipv6_destopt_hao *hao;
|
struct ipv6_destopt_hao *hao;
|
||||||
struct in6_addr tmp;
|
struct in6_addr tmp;
|
||||||
@ -303,7 +303,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
|
|||||||
struct net_device *dev)
|
struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct inet6_dev *idev = NULL;
|
struct inet6_dev *idev = NULL;
|
||||||
struct ipv6hdr *hdr = skb->nh.ipv6h;
|
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||||
struct sock *sk;
|
struct sock *sk;
|
||||||
struct ipv6_pinfo *np;
|
struct ipv6_pinfo *np;
|
||||||
struct in6_addr *saddr = NULL;
|
struct in6_addr *saddr = NULL;
|
||||||
@ -485,7 +485,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
|||||||
int hlimit;
|
int hlimit;
|
||||||
int tclass;
|
int tclass;
|
||||||
|
|
||||||
saddr = &skb->nh.ipv6h->daddr;
|
saddr = &ipv6_hdr(skb)->daddr;
|
||||||
|
|
||||||
if (!ipv6_unicast_destination(skb))
|
if (!ipv6_unicast_destination(skb))
|
||||||
saddr = NULL;
|
saddr = NULL;
|
||||||
@ -495,7 +495,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
|
|||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
fl.proto = IPPROTO_ICMPV6;
|
fl.proto = IPPROTO_ICMPV6;
|
||||||
ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
|
||||||
if (saddr)
|
if (saddr)
|
||||||
ipv6_addr_copy(&fl.fl6_src, saddr);
|
ipv6_addr_copy(&fl.fl6_src, saddr);
|
||||||
fl.oif = skb->dev->ifindex;
|
fl.oif = skb->dev->ifindex;
|
||||||
@ -583,8 +583,8 @@ static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info)
|
|||||||
if (!pskb_may_pull(skb, inner_offset+8))
|
if (!pskb_may_pull(skb, inner_offset+8))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
daddr = &skb->nh.ipv6h->daddr;
|
daddr = &ipv6_hdr(skb)->daddr;
|
||||||
|
|
||||||
/* BUGGG_FUTURE: we should try to parse exthdrs in this packet.
|
/* BUGGG_FUTURE: we should try to parse exthdrs in this packet.
|
||||||
Without this we will not able f.e. to make source routed
|
Without this we will not able f.e. to make source routed
|
||||||
@ -628,8 +628,8 @@ static int icmpv6_rcv(struct sk_buff **pskb)
|
|||||||
|
|
||||||
ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS);
|
ICMP6_INC_STATS_BH(idev, ICMP6_MIB_INMSGS);
|
||||||
|
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
daddr = &skb->nh.ipv6h->daddr;
|
daddr = &ipv6_hdr(skb)->daddr;
|
||||||
|
|
||||||
/* Perform checksum. */
|
/* Perform checksum. */
|
||||||
switch (skb->ip_summed) {
|
switch (skb->ip_summed) {
|
||||||
|
@ -96,7 +96,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
|
|||||||
if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
|
if (unlikely(!pskb_may_pull(skb, sizeof(*hdr))))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
if (hdr->version != 6)
|
if (hdr->version != 6)
|
||||||
goto err;
|
goto err;
|
||||||
@ -116,7 +116,7 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
|
|||||||
IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
|
IP6_INC_STATS_BH(idev, IPSTATS_MIB_INHDRERRORS);
|
||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->nexthdr == NEXTHDR_HOP) {
|
if (hdr->nexthdr == NEXTHDR_HOP) {
|
||||||
@ -183,7 +183,7 @@ resubmit:
|
|||||||
|
|
||||||
skb_postpull_rcsum(skb, skb_network_header(skb),
|
skb_postpull_rcsum(skb, skb_network_header(skb),
|
||||||
skb->h.raw - skb->nh.raw);
|
skb->h.raw - skb->nh.raw);
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
if (ipv6_addr_is_multicast(&hdr->daddr) &&
|
if (ipv6_addr_is_multicast(&hdr->daddr) &&
|
||||||
!ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
|
!ipv6_chk_mcast_addr(skb->dev, &hdr->daddr,
|
||||||
&hdr->saddr) &&
|
&hdr->saddr) &&
|
||||||
@ -234,7 +234,7 @@ int ip6_mc_input(struct sk_buff *skb)
|
|||||||
|
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_INMCASTPKTS);
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
|
deliver = likely(!(skb->dev->flags & (IFF_PROMISC|IFF_ALLMULTI))) ||
|
||||||
ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
|
ipv6_chk_mcast_addr(skb->dev, &hdr->daddr, NULL);
|
||||||
|
|
||||||
|
@ -107,13 +107,13 @@ static int ip6_output2(struct sk_buff *skb)
|
|||||||
skb->protocol = htons(ETH_P_IPV6);
|
skb->protocol = htons(ETH_P_IPV6);
|
||||||
skb->dev = dev;
|
skb->dev = dev;
|
||||||
|
|
||||||
if (ipv6_addr_is_multicast(&skb->nh.ipv6h->daddr)) {
|
if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
|
||||||
struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
|
struct ipv6_pinfo* np = skb->sk ? inet6_sk(skb->sk) : NULL;
|
||||||
struct inet6_dev *idev = ip6_dst_idev(skb->dst);
|
struct inet6_dev *idev = ip6_dst_idev(skb->dst);
|
||||||
|
|
||||||
if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
|
if (!(dev->flags & IFF_LOOPBACK) && (!np || np->mc_loop) &&
|
||||||
ipv6_chk_mcast_addr(dev, &skb->nh.ipv6h->daddr,
|
ipv6_chk_mcast_addr(dev, &ipv6_hdr(skb)->daddr,
|
||||||
&skb->nh.ipv6h->saddr)) {
|
&ipv6_hdr(skb)->saddr)) {
|
||||||
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
|
struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC);
|
||||||
|
|
||||||
/* Do not check for IFF_ALLMULTI; multicast routing
|
/* Do not check for IFF_ALLMULTI; multicast routing
|
||||||
@ -124,7 +124,7 @@ static int ip6_output2(struct sk_buff *skb)
|
|||||||
newskb->dev,
|
newskb->dev,
|
||||||
ip6_dev_loopback_xmit);
|
ip6_dev_loopback_xmit);
|
||||||
|
|
||||||
if (skb->nh.ipv6h->hop_limit == 0) {
|
if (ipv6_hdr(skb)->hop_limit == 0) {
|
||||||
IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS);
|
IP6_INC_STATS(idev, IPSTATS_MIB_OUTDISCARDS);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
return 0;
|
return 0;
|
||||||
@ -193,7 +193,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
|
|||||||
|
|
||||||
skb_push(skb, sizeof(struct ipv6hdr));
|
skb_push(skb, sizeof(struct ipv6hdr));
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fill in the IPv6 header
|
* Fill in the IPv6 header
|
||||||
@ -263,8 +263,8 @@ int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev,
|
|||||||
|
|
||||||
totlen = len + sizeof(struct ipv6hdr);
|
totlen = len + sizeof(struct ipv6hdr);
|
||||||
|
|
||||||
hdr = (struct ipv6hdr *) skb_put(skb, sizeof(struct ipv6hdr));
|
skb->nh.raw = skb_put(skb, sizeof(struct ipv6hdr));
|
||||||
skb->nh.ipv6h = hdr;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
*(__be32*)hdr = htonl(0x60000000);
|
*(__be32*)hdr = htonl(0x60000000);
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
|
|||||||
|
|
||||||
static int ip6_forward_proxy_check(struct sk_buff *skb)
|
static int ip6_forward_proxy_check(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *hdr = skb->nh.ipv6h;
|
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||||
u8 nexthdr = hdr->nexthdr;
|
u8 nexthdr = hdr->nexthdr;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
@ -366,7 +366,7 @@ static inline int ip6_forward_finish(struct sk_buff *skb)
|
|||||||
int ip6_forward(struct sk_buff *skb)
|
int ip6_forward(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct dst_entry *dst = skb->dst;
|
struct dst_entry *dst = skb->dst;
|
||||||
struct ipv6hdr *hdr = skb->nh.ipv6h;
|
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||||
struct inet6_skb_parm *opt = IP6CB(skb);
|
struct inet6_skb_parm *opt = IP6CB(skb);
|
||||||
|
|
||||||
if (ipv6_devconf.forwarding == 0)
|
if (ipv6_devconf.forwarding == 0)
|
||||||
@ -475,7 +475,7 @@ int ip6_forward(struct sk_buff *skb)
|
|||||||
goto drop;
|
goto drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
/* Mangling hops number delayed to point after skb COW */
|
/* Mangling hops number delayed to point after skb COW */
|
||||||
|
|
||||||
@ -527,10 +527,11 @@ static void ip6_copy_metadata(struct sk_buff *to, struct sk_buff *from)
|
|||||||
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
|
int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr)
|
||||||
{
|
{
|
||||||
u16 offset = sizeof(struct ipv6hdr);
|
u16 offset = sizeof(struct ipv6hdr);
|
||||||
struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
|
struct ipv6_opt_hdr *exthdr =
|
||||||
|
(struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
|
||||||
unsigned int packet_len = skb->tail - skb_network_header(skb);
|
unsigned int packet_len = skb->tail - skb_network_header(skb);
|
||||||
int found_rhdr = 0;
|
int found_rhdr = 0;
|
||||||
*nexthdr = &skb->nh.ipv6h->nexthdr;
|
*nexthdr = &ipv6_hdr(skb)->nexthdr;
|
||||||
|
|
||||||
while (offset + 1 <= packet_len) {
|
while (offset + 1 <= packet_len) {
|
||||||
|
|
||||||
@ -643,7 +644,8 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
|
|||||||
first_len = skb_pagelen(skb);
|
first_len = skb_pagelen(skb);
|
||||||
skb->data_len = first_len - skb_headlen(skb);
|
skb->data_len = first_len - skb_headlen(skb);
|
||||||
skb->len = first_len;
|
skb->len = first_len;
|
||||||
skb->nh.ipv6h->payload_len = htons(first_len - sizeof(struct ipv6hdr));
|
ipv6_hdr(skb)->payload_len = htons(first_len -
|
||||||
|
sizeof(struct ipv6hdr));
|
||||||
|
|
||||||
dst_hold(&rt->u.dst);
|
dst_hold(&rt->u.dst);
|
||||||
|
|
||||||
@ -665,7 +667,9 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
|
|||||||
if (frag->next != NULL)
|
if (frag->next != NULL)
|
||||||
fh->frag_off |= htons(IP6_MF);
|
fh->frag_off |= htons(IP6_MF);
|
||||||
fh->identification = frag_id;
|
fh->identification = frag_id;
|
||||||
frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
|
ipv6_hdr(frag)->payload_len =
|
||||||
|
htons(frag->len -
|
||||||
|
sizeof(struct ipv6hdr));
|
||||||
ip6_copy_metadata(frag, skb);
|
ip6_copy_metadata(frag, skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,7 +783,8 @@ slow_path:
|
|||||||
fh->frag_off = htons(offset);
|
fh->frag_off = htons(offset);
|
||||||
if (left > 0)
|
if (left > 0)
|
||||||
fh->frag_off |= htons(IP6_MF);
|
fh->frag_off |= htons(IP6_MF);
|
||||||
frag->nh.ipv6h->payload_len = htons(frag->len - sizeof(struct ipv6hdr));
|
ipv6_hdr(frag)->payload_len = htons(frag->len -
|
||||||
|
sizeof(struct ipv6hdr));
|
||||||
|
|
||||||
ptr += len;
|
ptr += len;
|
||||||
offset += len;
|
offset += len;
|
||||||
@ -1355,7 +1360,7 @@ int ip6_push_pending_frames(struct sock *sk)
|
|||||||
|
|
||||||
skb_push(skb, sizeof(struct ipv6hdr));
|
skb_push(skb, sizeof(struct ipv6hdr));
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
*(__be32*)hdr = fl->fl6_flowlabel |
|
*(__be32*)hdr = fl->fl6_flowlabel |
|
||||||
htonl(0x60000000 | ((int)np->cork.tclass << 20));
|
htonl(0x60000000 | ((int)np->cork.tclass << 20));
|
||||||
|
@ -602,7 +602,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
|
|||||||
skb_reset_network_header(skb2);
|
skb_reset_network_header(skb2);
|
||||||
|
|
||||||
/* Try to guess incoming interface */
|
/* Try to guess incoming interface */
|
||||||
rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
|
rt = rt6_lookup(&ipv6_hdr(skb2)->saddr, NULL, 0, 0);
|
||||||
|
|
||||||
if (rt && rt->rt6i_dev)
|
if (rt && rt->rt6i_dev)
|
||||||
skb2->dev = rt->rt6i_dev;
|
skb2->dev = rt->rt6i_dev;
|
||||||
@ -636,10 +636,10 @@ static void ip6ip6_dscp_ecn_decapsulate(struct ip6_tnl *t,
|
|||||||
struct sk_buff *skb)
|
struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
|
if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY)
|
||||||
ipv6_copy_dscp(ipv6h, skb->nh.ipv6h);
|
ipv6_copy_dscp(ipv6h, ipv6_hdr(skb));
|
||||||
|
|
||||||
if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
|
if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6h)))
|
||||||
IP6_ECN_set_ce(skb->nh.ipv6h);
|
IP6_ECN_set_ce(ipv6_hdr(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
|
static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
|
||||||
@ -679,10 +679,8 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
|
|||||||
struct ipv6hdr *ipv6h,
|
struct ipv6hdr *ipv6h,
|
||||||
struct sk_buff *skb))
|
struct sk_buff *skb))
|
||||||
{
|
{
|
||||||
struct ipv6hdr *ipv6h;
|
|
||||||
struct ip6_tnl *t;
|
struct ip6_tnl *t;
|
||||||
|
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||||
ipv6h = skb->nh.ipv6h;
|
|
||||||
|
|
||||||
read_lock(&ip6_tnl_lock);
|
read_lock(&ip6_tnl_lock);
|
||||||
|
|
||||||
@ -836,7 +834,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
|||||||
{
|
{
|
||||||
struct ip6_tnl *t = netdev_priv(dev);
|
struct ip6_tnl *t = netdev_priv(dev);
|
||||||
struct net_device_stats *stats = &t->stat;
|
struct net_device_stats *stats = &t->stat;
|
||||||
struct ipv6hdr *ipv6h = skb->nh.ipv6h;
|
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||||
struct ipv6_tel_txoption opt;
|
struct ipv6_tel_txoption opt;
|
||||||
struct dst_entry *dst;
|
struct dst_entry *dst;
|
||||||
struct net_device *tdev;
|
struct net_device *tdev;
|
||||||
@ -909,7 +907,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
skb_push(skb, sizeof(struct ipv6hdr));
|
skb_push(skb, sizeof(struct ipv6hdr));
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
ipv6h = skb->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb);
|
||||||
*(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
|
*(__be32*)ipv6h = fl->fl6_flowlabel | htonl(0x60000000);
|
||||||
dsfield = INET_ECN_encapsulate(0, dsfield);
|
dsfield = INET_ECN_encapsulate(0, dsfield);
|
||||||
ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
|
ipv6_change_dsfield(ipv6h, ~INET_ECN_MASK, dsfield);
|
||||||
@ -983,7 +981,7 @@ static inline int
|
|||||||
ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev)
|
||||||
{
|
{
|
||||||
struct ip6_tnl *t = netdev_priv(dev);
|
struct ip6_tnl *t = netdev_priv(dev);
|
||||||
struct ipv6hdr *ipv6h = skb->nh.ipv6h;
|
struct ipv6hdr *ipv6h = ipv6_hdr(skb);
|
||||||
int encap_limit = -1;
|
int encap_limit = -1;
|
||||||
__u16 offset;
|
__u16 offset;
|
||||||
struct flowi fl;
|
struct flowi fl;
|
||||||
|
@ -79,7 +79,7 @@ static int ipcomp6_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb->ip_summed = CHECKSUM_NONE;
|
||||||
|
|
||||||
/* Remove ipcomp header and decompress original payload */
|
/* Remove ipcomp header and decompress original payload */
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
ipch = (void *)skb->data;
|
ipch = (void *)skb->data;
|
||||||
skb->h.raw = skb->nh.raw + sizeof(*ipch);
|
skb->h.raw = skb->nh.raw + sizeof(*ipch);
|
||||||
__skb_pull(skb, sizeof(*ipch));
|
__skb_pull(skb, sizeof(*ipch));
|
||||||
|
@ -101,7 +101,7 @@ static int ipv6_gso_send_check(struct sk_buff *skb)
|
|||||||
if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
|
if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ipv6h = skb->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb);
|
||||||
__skb_pull(skb, sizeof(*ipv6h));
|
__skb_pull(skb, sizeof(*ipv6h));
|
||||||
err = -EPROTONOSUPPORT;
|
err = -EPROTONOSUPPORT;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
|
|||||||
if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
|
if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ipv6h = skb->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb);
|
||||||
__skb_pull(skb, sizeof(*ipv6h));
|
__skb_pull(skb, sizeof(*ipv6h));
|
||||||
segs = ERR_PTR(-EPROTONOSUPPORT);
|
segs = ERR_PTR(-EPROTONOSUPPORT);
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, int features)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (skb = segs; skb; skb = skb->next) {
|
for (skb = segs; skb; skb = skb->next) {
|
||||||
ipv6h = skb->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb);
|
||||||
ipv6h->payload_len = htons(skb->len - skb->mac_len -
|
ipv6h->payload_len = htons(skb->len - skb->mac_len -
|
||||||
sizeof(*ipv6h));
|
sizeof(*ipv6h));
|
||||||
}
|
}
|
||||||
|
@ -1167,11 +1167,11 @@ int igmp6_event_query(struct sk_buff *skb)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* compute payload length excluding extension headers */
|
/* compute payload length excluding extension headers */
|
||||||
len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
|
len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr);
|
||||||
len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h;
|
len -= skb->h.raw - skb->nh.raw;
|
||||||
|
|
||||||
/* Drop queries with not link local source */
|
/* Drop queries with not link local source */
|
||||||
if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL))
|
if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
idev = in6_dev_get(skb->dev);
|
idev = in6_dev_get(skb->dev);
|
||||||
@ -1303,7 +1303,7 @@ int igmp6_event_report(struct sk_buff *skb)
|
|||||||
hdr = (struct icmp6hdr*) skb->h.raw;
|
hdr = (struct icmp6hdr*) skb->h.raw;
|
||||||
|
|
||||||
/* Drop reports with not link local source */
|
/* Drop reports with not link local source */
|
||||||
addr_type = ipv6_addr_type(&skb->nh.ipv6h->saddr);
|
addr_type = ipv6_addr_type(&ipv6_hdr(skb)->saddr);
|
||||||
if (addr_type != IPV6_ADDR_ANY &&
|
if (addr_type != IPV6_ADDR_ANY &&
|
||||||
!(addr_type&IPV6_ADDR_LINKLOCAL))
|
!(addr_type&IPV6_ADDR_LINKLOCAL))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1441,7 +1441,7 @@ static inline int mld_dev_queue_xmit2(struct sk_buff *skb)
|
|||||||
unsigned char ha[MAX_ADDR_LEN];
|
unsigned char ha[MAX_ADDR_LEN];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
ndisc_mc_map(&skb->nh.ipv6h->daddr, ha, dev, 1);
|
ndisc_mc_map(&ipv6_hdr(skb)->daddr, ha, dev, 1);
|
||||||
err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
|
err = dev->hard_header(skb, dev, ETH_P_IPV6, ha, NULL, skb->len);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
@ -1459,15 +1459,14 @@ static inline int mld_dev_queue_xmit(struct sk_buff *skb)
|
|||||||
|
|
||||||
static void mld_sendpack(struct sk_buff *skb)
|
static void mld_sendpack(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *pip6 = skb->nh.ipv6h;
|
struct ipv6hdr *pip6 = ipv6_hdr(skb);
|
||||||
struct mld2_report *pmr = (struct mld2_report *)skb->h.raw;
|
struct mld2_report *pmr = (struct mld2_report *)skb->h.raw;
|
||||||
int payload_len, mldlen;
|
int payload_len, mldlen;
|
||||||
struct inet6_dev *idev = in6_dev_get(skb->dev);
|
struct inet6_dev *idev = in6_dev_get(skb->dev);
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
|
IP6_INC_STATS(idev, IPSTATS_MIB_OUTREQUESTS);
|
||||||
payload_len = skb->tail - (unsigned char *)skb->nh.ipv6h -
|
payload_len = skb->tail - skb_network_header(skb) - sizeof(*pip6);
|
||||||
sizeof(struct ipv6hdr);
|
|
||||||
mldlen = skb->tail - skb->h.raw;
|
mldlen = skb->tail - skb->h.raw;
|
||||||
pip6->payload_len = htons(payload_len);
|
pip6->payload_len = htons(payload_len);
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ static struct mip6_report_rate_limiter mip6_report_rl = {
|
|||||||
|
|
||||||
static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
|
static int mip6_destopt_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
|
struct ipv6_destopt_hdr *destopt = (struct ipv6_destopt_hdr *)skb->data;
|
||||||
|
|
||||||
if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
|
if (!ipv6_addr_equal(&iph->saddr, (struct in6_addr *)x->coaddr) &&
|
||||||
@ -223,16 +223,16 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
|
|||||||
|
|
||||||
skb_get_timestamp(skb, &stamp);
|
skb_get_timestamp(skb, &stamp);
|
||||||
|
|
||||||
if (!mip6_report_rl_allow(&stamp, &skb->nh.ipv6h->daddr,
|
if (!mip6_report_rl_allow(&stamp, &ipv6_hdr(skb)->daddr,
|
||||||
hao ? &hao->addr : &skb->nh.ipv6h->saddr,
|
hao ? &hao->addr : &ipv6_hdr(skb)->saddr,
|
||||||
opt->iif))
|
opt->iif))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
memset(&sel, 0, sizeof(sel));
|
memset(&sel, 0, sizeof(sel));
|
||||||
memcpy(&sel.daddr, (xfrm_address_t *)&skb->nh.ipv6h->daddr,
|
memcpy(&sel.daddr, (xfrm_address_t *)&ipv6_hdr(skb)->daddr,
|
||||||
sizeof(sel.daddr));
|
sizeof(sel.daddr));
|
||||||
sel.prefixlen_d = 128;
|
sel.prefixlen_d = 128;
|
||||||
memcpy(&sel.saddr, (xfrm_address_t *)&skb->nh.ipv6h->saddr,
|
memcpy(&sel.saddr, (xfrm_address_t *)&ipv6_hdr(skb)->saddr,
|
||||||
sizeof(sel.saddr));
|
sizeof(sel.saddr));
|
||||||
sel.prefixlen_s = 128;
|
sel.prefixlen_s = 128;
|
||||||
sel.family = AF_INET6;
|
sel.family = AF_INET6;
|
||||||
@ -256,12 +256,13 @@ static int mip6_destopt_offset(struct xfrm_state *x, struct sk_buff *skb,
|
|||||||
u8 **nexthdr)
|
u8 **nexthdr)
|
||||||
{
|
{
|
||||||
u16 offset = sizeof(struct ipv6hdr);
|
u16 offset = sizeof(struct ipv6hdr);
|
||||||
struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
|
struct ipv6_opt_hdr *exthdr =
|
||||||
|
(struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
|
||||||
const unsigned char *nh = skb_network_header(skb);
|
const unsigned char *nh = skb_network_header(skb);
|
||||||
unsigned int packet_len = skb->tail - nh;
|
unsigned int packet_len = skb->tail - nh;
|
||||||
int found_rhdr = 0;
|
int found_rhdr = 0;
|
||||||
|
|
||||||
*nexthdr = &skb->nh.ipv6h->nexthdr;
|
*nexthdr = &ipv6_hdr(skb)->nexthdr;
|
||||||
|
|
||||||
while (offset + 1 <= packet_len) {
|
while (offset + 1 <= packet_len) {
|
||||||
|
|
||||||
@ -387,12 +388,13 @@ static int mip6_rthdr_offset(struct xfrm_state *x, struct sk_buff *skb,
|
|||||||
u8 **nexthdr)
|
u8 **nexthdr)
|
||||||
{
|
{
|
||||||
u16 offset = sizeof(struct ipv6hdr);
|
u16 offset = sizeof(struct ipv6hdr);
|
||||||
struct ipv6_opt_hdr *exthdr = (struct ipv6_opt_hdr*)(skb->nh.ipv6h + 1);
|
struct ipv6_opt_hdr *exthdr =
|
||||||
|
(struct ipv6_opt_hdr *)(ipv6_hdr(skb) + 1);
|
||||||
const unsigned char *nh = skb_network_header(skb);
|
const unsigned char *nh = skb_network_header(skb);
|
||||||
unsigned int packet_len = skb->tail - nh;
|
unsigned int packet_len = skb->tail - nh;
|
||||||
int found_rhdr = 0;
|
int found_rhdr = 0;
|
||||||
|
|
||||||
*nexthdr = &skb->nh.ipv6h->nexthdr;
|
*nexthdr = &ipv6_hdr(skb)->nexthdr;
|
||||||
|
|
||||||
while (offset + 1 <= packet_len) {
|
while (offset + 1 <= packet_len) {
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
|
|||||||
dev->addr_len, dev->type);
|
dev->addr_len, dev->type);
|
||||||
|
|
||||||
/* checksum */
|
/* checksum */
|
||||||
msg->icmph.icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr,
|
msg->icmph.icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||||
daddr, len,
|
daddr, len,
|
||||||
IPPROTO_ICMPV6,
|
IPPROTO_ICMPV6,
|
||||||
csum_partial((__u8 *) msg,
|
csum_partial((__u8 *) msg,
|
||||||
@ -697,7 +697,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
|
|||||||
dev->addr_len, dev->type);
|
dev->addr_len, dev->type);
|
||||||
|
|
||||||
/* checksum */
|
/* checksum */
|
||||||
hdr->icmp6_cksum = csum_ipv6_magic(&skb->nh.ipv6h->saddr, daddr, len,
|
hdr->icmp6_cksum = csum_ipv6_magic(&ipv6_hdr(skb)->saddr, daddr, len,
|
||||||
IPPROTO_ICMPV6,
|
IPPROTO_ICMPV6,
|
||||||
csum_partial((__u8 *) hdr, len, 0));
|
csum_partial((__u8 *) hdr, len, 0));
|
||||||
|
|
||||||
@ -736,8 +736,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
|
|||||||
struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
|
struct in6_addr *target = (struct in6_addr *)&neigh->primary_key;
|
||||||
int probes = atomic_read(&neigh->probes);
|
int probes = atomic_read(&neigh->probes);
|
||||||
|
|
||||||
if (skb && ipv6_chk_addr(&skb->nh.ipv6h->saddr, dev, 1))
|
if (skb && ipv6_chk_addr(&ipv6_hdr(skb)->saddr, dev, 1))
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
|
|
||||||
if ((probes -= neigh->parms->ucast_probes) < 0) {
|
if ((probes -= neigh->parms->ucast_probes) < 0) {
|
||||||
if (!(neigh->nud_state & NUD_VALID)) {
|
if (!(neigh->nud_state & NUD_VALID)) {
|
||||||
@ -761,8 +761,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
|
|||||||
static void ndisc_recv_ns(struct sk_buff *skb)
|
static void ndisc_recv_ns(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
|
struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
|
||||||
struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
|
struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
|
||||||
struct in6_addr *daddr = &skb->nh.ipv6h->daddr;
|
struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
|
||||||
u8 *lladdr = NULL;
|
u8 *lladdr = NULL;
|
||||||
u32 ndoptlen = skb->tail - msg->opt;
|
u32 ndoptlen = skb->tail - msg->opt;
|
||||||
struct ndisc_options ndopts;
|
struct ndisc_options ndopts;
|
||||||
@ -939,8 +939,8 @@ out:
|
|||||||
static void ndisc_recv_na(struct sk_buff *skb)
|
static void ndisc_recv_na(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
|
struct nd_msg *msg = (struct nd_msg *)skb->h.raw;
|
||||||
struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
|
struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
|
||||||
struct in6_addr *daddr = &skb->nh.ipv6h->daddr;
|
struct in6_addr *daddr = &ipv6_hdr(skb)->daddr;
|
||||||
u8 *lladdr = NULL;
|
u8 *lladdr = NULL;
|
||||||
u32 ndoptlen = skb->tail - msg->opt;
|
u32 ndoptlen = skb->tail - msg->opt;
|
||||||
struct ndisc_options ndopts;
|
struct ndisc_options ndopts;
|
||||||
@ -1044,7 +1044,7 @@ static void ndisc_recv_rs(struct sk_buff *skb)
|
|||||||
unsigned long ndoptlen = skb->len - sizeof(*rs_msg);
|
unsigned long ndoptlen = skb->len - sizeof(*rs_msg);
|
||||||
struct neighbour *neigh;
|
struct neighbour *neigh;
|
||||||
struct inet6_dev *idev;
|
struct inet6_dev *idev;
|
||||||
struct in6_addr *saddr = &skb->nh.ipv6h->saddr;
|
struct in6_addr *saddr = &ipv6_hdr(skb)->saddr;
|
||||||
struct ndisc_options ndopts;
|
struct ndisc_options ndopts;
|
||||||
u8 *lladdr = NULL;
|
u8 *lladdr = NULL;
|
||||||
|
|
||||||
@ -1110,7 +1110,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
|
|||||||
|
|
||||||
optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg);
|
optlen = (skb->tail - skb->h.raw) - sizeof(struct ra_msg);
|
||||||
|
|
||||||
if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) {
|
if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
|
||||||
ND_PRINTK2(KERN_WARNING
|
ND_PRINTK2(KERN_WARNING
|
||||||
"ICMPv6 RA: source address is not link-local.\n");
|
"ICMPv6 RA: source address is not link-local.\n");
|
||||||
return;
|
return;
|
||||||
@ -1176,7 +1176,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
|
|||||||
pref = ICMPV6_ROUTER_PREF_MEDIUM;
|
pref = ICMPV6_ROUTER_PREF_MEDIUM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rt = rt6_get_dflt_router(&skb->nh.ipv6h->saddr, skb->dev);
|
rt = rt6_get_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev);
|
||||||
|
|
||||||
if (rt)
|
if (rt)
|
||||||
neigh = rt->rt6i_nexthop;
|
neigh = rt->rt6i_nexthop;
|
||||||
@ -1191,7 +1191,7 @@ static void ndisc_router_discovery(struct sk_buff *skb)
|
|||||||
ND_PRINTK3(KERN_DEBUG
|
ND_PRINTK3(KERN_DEBUG
|
||||||
"ICMPv6 RA: adding default router.\n");
|
"ICMPv6 RA: adding default router.\n");
|
||||||
|
|
||||||
rt = rt6_add_dflt_router(&skb->nh.ipv6h->saddr, skb->dev, pref);
|
rt = rt6_add_dflt_router(&ipv6_hdr(skb)->saddr, skb->dev, pref);
|
||||||
if (rt == NULL) {
|
if (rt == NULL) {
|
||||||
ND_PRINTK0(KERN_ERR
|
ND_PRINTK0(KERN_ERR
|
||||||
"ICMPv6 RA: %s() failed to add default route.\n",
|
"ICMPv6 RA: %s() failed to add default route.\n",
|
||||||
@ -1263,7 +1263,7 @@ skip_defrtr:
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (!neigh)
|
if (!neigh)
|
||||||
neigh = __neigh_lookup(&nd_tbl, &skb->nh.ipv6h->saddr,
|
neigh = __neigh_lookup(&nd_tbl, &ipv6_hdr(skb)->saddr,
|
||||||
skb->dev, 1);
|
skb->dev, 1);
|
||||||
if (neigh) {
|
if (neigh) {
|
||||||
u8 *lladdr = NULL;
|
u8 *lladdr = NULL;
|
||||||
@ -1292,7 +1292,7 @@ skip_defrtr:
|
|||||||
if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
|
if (((struct route_info *)p)->prefix_len > in6_dev->cnf.accept_ra_rt_info_max_plen)
|
||||||
continue;
|
continue;
|
||||||
rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
|
rt6_route_rcv(skb->dev, (u8*)p, (p->nd_opt_len) << 3,
|
||||||
&skb->nh.ipv6h->saddr);
|
&ipv6_hdr(skb)->saddr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1351,7 +1351,7 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
|
|||||||
int optlen;
|
int optlen;
|
||||||
u8 *lladdr = NULL;
|
u8 *lladdr = NULL;
|
||||||
|
|
||||||
if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr) & IPV6_ADDR_LINKLOCAL)) {
|
if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL)) {
|
||||||
ND_PRINTK2(KERN_WARNING
|
ND_PRINTK2(KERN_WARNING
|
||||||
"ICMPv6 Redirect: source address is not link-local.\n");
|
"ICMPv6 Redirect: source address is not link-local.\n");
|
||||||
return;
|
return;
|
||||||
@ -1416,8 +1416,8 @@ static void ndisc_redirect_rcv(struct sk_buff *skb)
|
|||||||
|
|
||||||
neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1);
|
neigh = __neigh_lookup(&nd_tbl, target, skb->dev, 1);
|
||||||
if (neigh) {
|
if (neigh) {
|
||||||
rt6_redirect(dest, &skb->nh.ipv6h->daddr,
|
rt6_redirect(dest, &ipv6_hdr(skb)->daddr,
|
||||||
&skb->nh.ipv6h->saddr, neigh, lladdr,
|
&ipv6_hdr(skb)->saddr, neigh, lladdr,
|
||||||
on_link);
|
on_link);
|
||||||
neigh_release(neigh);
|
neigh_release(neigh);
|
||||||
}
|
}
|
||||||
@ -1453,14 +1453,14 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipv6_addr_equal(&skb->nh.ipv6h->daddr, target) &&
|
if (!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, target) &&
|
||||||
!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
|
!(ipv6_addr_type(target) & IPV6_ADDR_LINKLOCAL)) {
|
||||||
ND_PRINTK2(KERN_WARNING
|
ND_PRINTK2(KERN_WARNING
|
||||||
"ICMPv6 Redirect: target address is not link-local.\n");
|
"ICMPv6 Redirect: target address is not link-local.\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &skb->nh.ipv6h->saddr,
|
ndisc_flow_init(&fl, NDISC_REDIRECT, &saddr_buf, &ipv6_hdr(skb)->saddr,
|
||||||
dev->ifindex);
|
dev->ifindex);
|
||||||
|
|
||||||
dst = ip6_route_output(NULL, &fl);
|
dst = ip6_route_output(NULL, &fl);
|
||||||
@ -1515,7 +1515,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
|||||||
hlen = 0;
|
hlen = 0;
|
||||||
|
|
||||||
skb_reserve(buff, LL_RESERVED_SPACE(dev));
|
skb_reserve(buff, LL_RESERVED_SPACE(dev));
|
||||||
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &skb->nh.ipv6h->saddr,
|
ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
|
||||||
IPPROTO_ICMPV6, len);
|
IPPROTO_ICMPV6, len);
|
||||||
|
|
||||||
icmph = (struct icmp6hdr *)skb_put(buff, len);
|
icmph = (struct icmp6hdr *)skb_put(buff, len);
|
||||||
@ -1531,7 +1531,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
|||||||
addrp = (struct in6_addr *)(icmph + 1);
|
addrp = (struct in6_addr *)(icmph + 1);
|
||||||
ipv6_addr_copy(addrp, target);
|
ipv6_addr_copy(addrp, target);
|
||||||
addrp++;
|
addrp++;
|
||||||
ipv6_addr_copy(addrp, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(addrp, &ipv6_hdr(skb)->daddr);
|
||||||
|
|
||||||
opt = (u8*) (addrp + 1);
|
opt = (u8*) (addrp + 1);
|
||||||
|
|
||||||
@ -1552,9 +1552,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
|
|||||||
*(opt++) = (rd_len >> 3);
|
*(opt++) = (rd_len >> 3);
|
||||||
opt += 6;
|
opt += 6;
|
||||||
|
|
||||||
memcpy(opt, skb->nh.ipv6h, rd_len - 8);
|
memcpy(opt, ipv6_hdr(skb), rd_len - 8);
|
||||||
|
|
||||||
icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &skb->nh.ipv6h->saddr,
|
icmph->icmp6_cksum = csum_ipv6_magic(&saddr_buf, &ipv6_hdr(skb)->saddr,
|
||||||
len, IPPROTO_ICMPV6,
|
len, IPPROTO_ICMPV6,
|
||||||
csum_partial((u8 *) icmph, len, 0));
|
csum_partial((u8 *) icmph, len, 0));
|
||||||
|
|
||||||
@ -1588,10 +1588,10 @@ int ndisc_rcv(struct sk_buff *skb)
|
|||||||
|
|
||||||
__skb_push(skb, skb->data-skb->h.raw);
|
__skb_push(skb, skb->data-skb->h.raw);
|
||||||
|
|
||||||
if (skb->nh.ipv6h->hop_limit != 255) {
|
if (ipv6_hdr(skb)->hop_limit != 255) {
|
||||||
ND_PRINTK2(KERN_WARNING
|
ND_PRINTK2(KERN_WARNING
|
||||||
"ICMPv6 NDISC: invalid hop-limit: %d\n",
|
"ICMPv6 NDISC: invalid hop-limit: %d\n",
|
||||||
skb->nh.ipv6h->hop_limit);
|
ipv6_hdr(skb)->hop_limit);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
int ip6_route_me_harder(struct sk_buff *skb)
|
int ip6_route_me_harder(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
struct dst_entry *dst;
|
struct dst_entry *dst;
|
||||||
struct flowi fl = {
|
struct flowi fl = {
|
||||||
.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
|
.oif = skb->sk ? skb->sk->sk_bound_dev_if : 0,
|
||||||
@ -61,7 +61,7 @@ static void nf_ip6_saveroute(const struct sk_buff *skb, struct nf_info *info)
|
|||||||
struct ip6_rt_info *rt_info = nf_info_reroute(info);
|
struct ip6_rt_info *rt_info = nf_info_reroute(info);
|
||||||
|
|
||||||
if (info->hook == NF_IP6_LOCAL_OUT) {
|
if (info->hook == NF_IP6_LOCAL_OUT) {
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
rt_info->daddr = iph->daddr;
|
rt_info->daddr = iph->daddr;
|
||||||
rt_info->saddr = iph->saddr;
|
rt_info->saddr = iph->saddr;
|
||||||
@ -73,7 +73,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
|
|||||||
struct ip6_rt_info *rt_info = nf_info_reroute(info);
|
struct ip6_rt_info *rt_info = nf_info_reroute(info);
|
||||||
|
|
||||||
if (info->hook == NF_IP6_LOCAL_OUT) {
|
if (info->hook == NF_IP6_LOCAL_OUT) {
|
||||||
struct ipv6hdr *iph = (*pskb)->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(*pskb);
|
||||||
if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
|
if (!ipv6_addr_equal(&iph->daddr, &rt_info->daddr) ||
|
||||||
!ipv6_addr_equal(&iph->saddr, &rt_info->saddr))
|
!ipv6_addr_equal(&iph->saddr, &rt_info->saddr))
|
||||||
return ip6_route_me_harder(*pskb);
|
return ip6_route_me_harder(*pskb);
|
||||||
@ -84,7 +84,7 @@ static int nf_ip6_reroute(struct sk_buff **pskb, const struct nf_info *info)
|
|||||||
__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
__sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
|
||||||
unsigned int dataoff, u_int8_t protocol)
|
unsigned int dataoff, u_int8_t protocol)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *ip6h = skb->nh.ipv6h;
|
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||||
__sum16 csum = 0;
|
__sum16 csum = 0;
|
||||||
|
|
||||||
switch (skb->ip_summed) {
|
switch (skb->ip_summed) {
|
||||||
|
@ -115,7 +115,7 @@ ip6_packet_match(const struct sk_buff *skb,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
const struct ipv6hdr *ipv6 = skb->nh.ipv6h;
|
const struct ipv6hdr *ipv6 = ipv6_hdr(skb);
|
||||||
|
|
||||||
#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg))
|
#define FWINV(bool,invflg) ((bool) ^ !!(ip6info->invflags & invflg))
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ ip6t_do_table(struct sk_buff **pskb,
|
|||||||
goto no_match;
|
goto no_match;
|
||||||
|
|
||||||
ADD_COUNTER(e->counters,
|
ADD_COUNTER(e->counters,
|
||||||
ntohs((*pskb)->nh.ipv6h->payload_len)
|
ntohs(ipv6_hdr(*pskb)->payload_len)
|
||||||
+ IPV6_HDR_LEN,
|
+ IPV6_HDR_LEN,
|
||||||
1);
|
1);
|
||||||
|
|
||||||
@ -1448,8 +1448,8 @@ static void __exit ip6_tables_fini(void)
|
|||||||
int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
|
int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
|
||||||
int target, unsigned short *fragoff)
|
int target, unsigned short *fragoff)
|
||||||
{
|
{
|
||||||
unsigned int start = (u8*)(skb->nh.ipv6h + 1) - skb->data;
|
unsigned int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
|
||||||
u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
u8 nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
unsigned int len = skb->len - start;
|
unsigned int len = skb->len - start;
|
||||||
|
|
||||||
if (fragoff)
|
if (fragoff)
|
||||||
|
@ -32,7 +32,7 @@ static unsigned int ip6t_hl_target(struct sk_buff **pskb,
|
|||||||
if (!skb_make_writable(pskb, (*pskb)->len))
|
if (!skb_make_writable(pskb, (*pskb)->len))
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
|
|
||||||
ip6h = (*pskb)->nh.ipv6h;
|
ip6h = ipv6_hdr(*pskb);
|
||||||
|
|
||||||
switch (info->mode) {
|
switch (info->mode) {
|
||||||
case IP6T_HL_SET:
|
case IP6T_HL_SET:
|
||||||
|
@ -422,7 +422,7 @@ ip6t_log_packet(unsigned int pf,
|
|||||||
printk(" ");
|
printk(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_packet(loginfo, skb, (u8*)skb->nh.ipv6h - skb->data, 1);
|
dump_packet(loginfo, skb, skb_network_offset(skb), 1);
|
||||||
printk("\n");
|
printk("\n");
|
||||||
spin_unlock_bh(&log_lock);
|
spin_unlock_bh(&log_lock);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ static void send_reset(struct sk_buff *oldskb)
|
|||||||
struct tcphdr otcph, *tcph;
|
struct tcphdr otcph, *tcph;
|
||||||
unsigned int otcplen, hh_len;
|
unsigned int otcplen, hh_len;
|
||||||
int tcphoff, needs_ack;
|
int tcphoff, needs_ack;
|
||||||
struct ipv6hdr *oip6h = oldskb->nh.ipv6h, *ip6h;
|
struct ipv6hdr *oip6h = ipv6_hdr(oldskb), *ip6h;
|
||||||
struct dst_entry *dst = NULL;
|
struct dst_entry *dst = NULL;
|
||||||
u8 proto;
|
u8 proto;
|
||||||
struct flowi fl;
|
struct flowi fl;
|
||||||
@ -122,7 +122,7 @@ static void send_reset(struct sk_buff *oldskb)
|
|||||||
|
|
||||||
skb_put(nskb, sizeof(struct ipv6hdr));
|
skb_put(nskb, sizeof(struct ipv6hdr));
|
||||||
skb_reset_network_header(nskb);
|
skb_reset_network_header(nskb);
|
||||||
ip6h = nskb->nh.ipv6h;
|
ip6h = ipv6_hdr(nskb);
|
||||||
ip6h->version = 6;
|
ip6h->version = 6;
|
||||||
ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT);
|
ip6h->hop_limit = dst_metric(dst, RTAX_HOPLIMIT);
|
||||||
ip6h->nexthdr = IPPROTO_TCP;
|
ip6h->nexthdr = IPPROTO_TCP;
|
||||||
@ -156,8 +156,8 @@ static void send_reset(struct sk_buff *oldskb)
|
|||||||
tcph->check = 0;
|
tcph->check = 0;
|
||||||
|
|
||||||
/* Adjust TCP checksum */
|
/* Adjust TCP checksum */
|
||||||
tcph->check = csum_ipv6_magic(&nskb->nh.ipv6h->saddr,
|
tcph->check = csum_ipv6_magic(&ipv6_hdr(nskb)->saddr,
|
||||||
&nskb->nh.ipv6h->daddr,
|
&ipv6_hdr(nskb)->daddr,
|
||||||
sizeof(struct tcphdr), IPPROTO_TCP,
|
sizeof(struct tcphdr), IPPROTO_TCP,
|
||||||
csum_partial((char *)tcph,
|
csum_partial((char *)tcph,
|
||||||
sizeof(struct tcphdr), 0));
|
sizeof(struct tcphdr), 0));
|
||||||
|
@ -42,7 +42,7 @@ match(const struct sk_buff *skb,
|
|||||||
memset(eui64, 0, sizeof(eui64));
|
memset(eui64, 0, sizeof(eui64));
|
||||||
|
|
||||||
if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {
|
if (eth_hdr(skb)->h_proto == htons(ETH_P_IPV6)) {
|
||||||
if (skb->nh.ipv6h->version == 0x6) {
|
if (ipv6_hdr(skb)->version == 0x6) {
|
||||||
memcpy(eui64, eth_hdr(skb)->h_source, 3);
|
memcpy(eui64, eth_hdr(skb)->h_source, 3);
|
||||||
memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
|
memcpy(eui64 + 5, eth_hdr(skb)->h_source + 3, 3);
|
||||||
eui64[3] = 0xff;
|
eui64[3] = 0xff;
|
||||||
@ -50,7 +50,7 @@ match(const struct sk_buff *skb,
|
|||||||
eui64[0] |= 0x02;
|
eui64[0] |= 0x02;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((skb->nh.ipv6h->saddr.s6_addr[8+i] == eui64[i])
|
while ((ipv6_hdr(skb)->saddr.s6_addr[8 + i] == eui64[i])
|
||||||
&& (i < 8))
|
&& (i < 8))
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ static int match(const struct sk_buff *skb,
|
|||||||
int offset, unsigned int protoff, int *hotdrop)
|
int offset, unsigned int protoff, int *hotdrop)
|
||||||
{
|
{
|
||||||
const struct ip6t_hl_info *info = matchinfo;
|
const struct ip6t_hl_info *info = matchinfo;
|
||||||
const struct ipv6hdr *ip6h = skb->nh.ipv6h;
|
const struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||||
|
|
||||||
switch (info->mode) {
|
switch (info->mode) {
|
||||||
case IP6T_HL_EQ:
|
case IP6T_HL_EQ:
|
||||||
|
@ -45,7 +45,7 @@ ipv6header_match(const struct sk_buff *skb,
|
|||||||
/* Make sure this isn't an evil packet */
|
/* Make sure this isn't an evil packet */
|
||||||
|
|
||||||
/* type of the 1st exthdr */
|
/* type of the 1st exthdr */
|
||||||
nexthdr = skb->nh.ipv6h->nexthdr;
|
nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
/* pointer to the 1st exthdr */
|
/* pointer to the 1st exthdr */
|
||||||
ptr = sizeof(struct ipv6hdr);
|
ptr = sizeof(struct ipv6hdr);
|
||||||
/* available length */
|
/* available length */
|
||||||
|
@ -146,21 +146,21 @@ ip6t_local_hook(unsigned int hook,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* save source/dest address, mark, hoplimit, flowlabel, priority, */
|
/* save source/dest address, mark, hoplimit, flowlabel, priority, */
|
||||||
memcpy(&saddr, &(*pskb)->nh.ipv6h->saddr, sizeof(saddr));
|
memcpy(&saddr, &ipv6_hdr(*pskb)->saddr, sizeof(saddr));
|
||||||
memcpy(&daddr, &(*pskb)->nh.ipv6h->daddr, sizeof(daddr));
|
memcpy(&daddr, &ipv6_hdr(*pskb)->daddr, sizeof(daddr));
|
||||||
mark = (*pskb)->mark;
|
mark = (*pskb)->mark;
|
||||||
hop_limit = (*pskb)->nh.ipv6h->hop_limit;
|
hop_limit = ipv6_hdr(*pskb)->hop_limit;
|
||||||
|
|
||||||
/* flowlabel and prio (includes version, which shouldn't change either */
|
/* flowlabel and prio (includes version, which shouldn't change either */
|
||||||
flowlabel = *((u_int32_t *) (*pskb)->nh.ipv6h);
|
flowlabel = *((u_int32_t *)ipv6_hdr(*pskb));
|
||||||
|
|
||||||
ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
|
ret = ip6t_do_table(pskb, hook, in, out, &packet_mangler);
|
||||||
|
|
||||||
if (ret != NF_DROP && ret != NF_STOLEN
|
if (ret != NF_DROP && ret != NF_STOLEN
|
||||||
&& (memcmp(&(*pskb)->nh.ipv6h->saddr, &saddr, sizeof(saddr))
|
&& (memcmp(&ipv6_hdr(*pskb)->saddr, &saddr, sizeof(saddr))
|
||||||
|| memcmp(&(*pskb)->nh.ipv6h->daddr, &daddr, sizeof(daddr))
|
|| memcmp(&ipv6_hdr(*pskb)->daddr, &daddr, sizeof(daddr))
|
||||||
|| (*pskb)->mark != mark
|
|| (*pskb)->mark != mark
|
||||||
|| (*pskb)->nh.ipv6h->hop_limit != hop_limit))
|
|| ipv6_hdr(*pskb)->hop_limit != hop_limit))
|
||||||
return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP;
|
return ip6_route_me_harder(*pskb) == 0 ? ret : NF_DROP;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -138,16 +138,10 @@ static int
|
|||||||
ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,
|
ipv6_prepare(struct sk_buff **pskb, unsigned int hooknum, unsigned int *dataoff,
|
||||||
u_int8_t *protonum)
|
u_int8_t *protonum)
|
||||||
{
|
{
|
||||||
unsigned int extoff;
|
unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
|
||||||
unsigned char pnum;
|
unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
|
||||||
int protoff;
|
int protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
|
||||||
|
(*pskb)->len - extoff);
|
||||||
extoff = (u8*)((*pskb)->nh.ipv6h + 1) - (*pskb)->data;
|
|
||||||
pnum = (*pskb)->nh.ipv6h->nexthdr;
|
|
||||||
|
|
||||||
protoff = nf_ct_ipv6_skip_exthdr(*pskb, extoff, &pnum,
|
|
||||||
(*pskb)->len - extoff);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (protoff == (*pskb)->len) mean that the packet doesn't have no data
|
* (protoff == (*pskb)->len) mean that the packet doesn't have no data
|
||||||
* except of IPv6 & ext headers. but it's tracked anyway. - YK
|
* except of IPv6 & ext headers. but it's tracked anyway. - YK
|
||||||
@ -179,9 +173,8 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
|
|||||||
struct nf_conn_help *help;
|
struct nf_conn_help *help;
|
||||||
enum ip_conntrack_info ctinfo;
|
enum ip_conntrack_info ctinfo;
|
||||||
unsigned int ret, protoff;
|
unsigned int ret, protoff;
|
||||||
unsigned int extoff = (u8*)((*pskb)->nh.ipv6h + 1)
|
unsigned int extoff = (u8 *)(ipv6_hdr(*pskb) + 1) - (*pskb)->data;
|
||||||
- (*pskb)->data;
|
unsigned char pnum = ipv6_hdr(*pskb)->nexthdr;
|
||||||
unsigned char pnum = (*pskb)->nh.ipv6h->nexthdr;
|
|
||||||
|
|
||||||
|
|
||||||
/* This is where we call the helper: as the packet goes out. */
|
/* This is where we call the helper: as the packet goes out. */
|
||||||
|
@ -400,8 +400,8 @@ static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
offset = ntohs(fhdr->frag_off) & ~0x7;
|
offset = ntohs(fhdr->frag_off) & ~0x7;
|
||||||
end = offset + (ntohs(skb->nh.ipv6h->payload_len) -
|
end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
|
||||||
((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
|
((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
|
||||||
|
|
||||||
if ((unsigned int)end > IPV6_MAXPLEN) {
|
if ((unsigned int)end > IPV6_MAXPLEN) {
|
||||||
DEBUGP("offset is too large.\n");
|
DEBUGP("offset is too large.\n");
|
||||||
@ -652,7 +652,7 @@ nf_ct_frag6_reasm(struct nf_ct_frag6_queue *fq, struct net_device *dev)
|
|||||||
head->next = NULL;
|
head->next = NULL;
|
||||||
head->dev = dev;
|
head->dev = dev;
|
||||||
head->tstamp = fq->stamp;
|
head->tstamp = fq->stamp;
|
||||||
head->nh.ipv6h->payload_len = htons(payload_len);
|
ipv6_hdr(head)->payload_len = htons(payload_len);
|
||||||
|
|
||||||
/* Yes, and fold redundant checksum back. 8) */
|
/* Yes, and fold redundant checksum back. 8) */
|
||||||
if (head->ip_summed == CHECKSUM_COMPLETE)
|
if (head->ip_summed == CHECKSUM_COMPLETE)
|
||||||
@ -706,9 +706,9 @@ out_fail:
|
|||||||
static int
|
static int
|
||||||
find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
|
find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
|
||||||
{
|
{
|
||||||
u8 nexthdr = skb->nh.ipv6h->nexthdr;
|
u8 nexthdr = ipv6_hdr(skb)->nexthdr;
|
||||||
u8 prev_nhoff = (u8 *)&skb->nh.ipv6h->nexthdr - skb->data;
|
u8 prev_nhoff = (u8 *)&ipv6_hdr(skb)->nexthdr - skb->data;
|
||||||
int start = (u8 *)(skb->nh.ipv6h+1) - skb->data;
|
int start = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;
|
||||||
int len = skb->len - start;
|
int len = skb->len - start;
|
||||||
u8 prevhdr = NEXTHDR_IPV6;
|
u8 prevhdr = NEXTHDR_IPV6;
|
||||||
|
|
||||||
@ -764,7 +764,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
|
|||||||
struct sk_buff *ret_skb = NULL;
|
struct sk_buff *ret_skb = NULL;
|
||||||
|
|
||||||
/* Jumbo payload inhibits frag. header */
|
/* Jumbo payload inhibits frag. header */
|
||||||
if (skb->nh.ipv6h->payload_len == 0) {
|
if (ipv6_hdr(skb)->payload_len == 0) {
|
||||||
DEBUGP("payload len = 0\n");
|
DEBUGP("payload len = 0\n");
|
||||||
return skb;
|
return skb;
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
clone->h.raw = clone->data + fhoff;
|
clone->h.raw = clone->data + fhoff;
|
||||||
hdr = clone->nh.ipv6h;
|
hdr = ipv6_hdr(clone);
|
||||||
fhdr = (struct frag_hdr *)clone->h.raw;
|
fhdr = (struct frag_hdr *)clone->h.raw;
|
||||||
|
|
||||||
if (!(fhdr->frag_off & htons(0xFFF9))) {
|
if (!(fhdr->frag_off & htons(0xFFF9))) {
|
||||||
|
@ -152,7 +152,7 @@ int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
|
|||||||
int delivered = 0;
|
int delivered = 0;
|
||||||
__u8 hash;
|
__u8 hash;
|
||||||
|
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
daddr = saddr + 1;
|
daddr = saddr + 1;
|
||||||
|
|
||||||
hash = nexthdr & (MAX_INET_PROTOS - 1);
|
hash = nexthdr & (MAX_INET_PROTOS - 1);
|
||||||
@ -363,15 +363,16 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
|
|||||||
if (skb->ip_summed == CHECKSUM_COMPLETE) {
|
if (skb->ip_summed == CHECKSUM_COMPLETE) {
|
||||||
skb_postpull_rcsum(skb, skb_network_header(skb),
|
skb_postpull_rcsum(skb, skb_network_header(skb),
|
||||||
skb->h.raw - skb->nh.raw);
|
skb->h.raw - skb->nh.raw);
|
||||||
if (!csum_ipv6_magic(&skb->nh.ipv6h->saddr,
|
if (!csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->daddr,
|
||||||
skb->len, inet->num, skb->csum))
|
skb->len, inet->num, skb->csum))
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
}
|
}
|
||||||
if (skb->ip_summed != CHECKSUM_UNNECESSARY)
|
if (skb->ip_summed != CHECKSUM_UNNECESSARY)
|
||||||
skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
|
skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->daddr,
|
||||||
skb->len, inet->num, 0));
|
skb->len,
|
||||||
|
inet->num, 0));
|
||||||
|
|
||||||
if (inet->hdrincl) {
|
if (inet->hdrincl) {
|
||||||
if (skb_checksum_complete(skb)) {
|
if (skb_checksum_complete(skb)) {
|
||||||
@ -438,7 +439,7 @@ static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk,
|
|||||||
if (sin6) {
|
if (sin6) {
|
||||||
sin6->sin6_family = AF_INET6;
|
sin6->sin6_family = AF_INET6;
|
||||||
sin6->sin6_port = 0;
|
sin6->sin6_port = 0;
|
||||||
ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
|
||||||
sin6->sin6_flowinfo = 0;
|
sin6->sin6_flowinfo = 0;
|
||||||
sin6->sin6_scope_id = 0;
|
sin6->sin6_scope_id = 0;
|
||||||
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||||
@ -578,7 +579,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
|
|||||||
|
|
||||||
skb_put(skb, length);
|
skb_put(skb, length);
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
skb->ip_summed = CHECKSUM_NONE;
|
skb->ip_summed = CHECKSUM_NONE;
|
||||||
|
|
||||||
|
@ -430,8 +430,8 @@ static void ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
offset = ntohs(fhdr->frag_off) & ~0x7;
|
offset = ntohs(fhdr->frag_off) & ~0x7;
|
||||||
end = offset + (ntohs(skb->nh.ipv6h->payload_len) -
|
end = offset + (ntohs(ipv6_hdr(skb)->payload_len) -
|
||||||
((u8 *) (fhdr + 1) - (u8 *) (skb->nh.ipv6h + 1)));
|
((u8 *)(fhdr + 1) - (u8 *)(ipv6_hdr(skb) + 1)));
|
||||||
|
|
||||||
if ((unsigned int)end > IPV6_MAXPLEN) {
|
if ((unsigned int)end > IPV6_MAXPLEN) {
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst),
|
||||||
@ -671,7 +671,7 @@ static int ip6_frag_reasm(struct frag_queue *fq, struct sk_buff **skb_in,
|
|||||||
head->next = NULL;
|
head->next = NULL;
|
||||||
head->dev = dev;
|
head->dev = dev;
|
||||||
head->tstamp = fq->stamp;
|
head->tstamp = fq->stamp;
|
||||||
head->nh.ipv6h->payload_len = htons(payload_len);
|
ipv6_hdr(head)->payload_len = htons(payload_len);
|
||||||
IP6CB(head)->nhoff = nhoff;
|
IP6CB(head)->nhoff = nhoff;
|
||||||
|
|
||||||
*skb_in = head;
|
*skb_in = head;
|
||||||
@ -708,9 +708,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
|
|||||||
struct net_device *dev = skb->dev;
|
struct net_device *dev = skb->dev;
|
||||||
struct frag_hdr *fhdr;
|
struct frag_hdr *fhdr;
|
||||||
struct frag_queue *fq;
|
struct frag_queue *fq;
|
||||||
struct ipv6hdr *hdr;
|
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
|
||||||
|
|
||||||
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
|
IP6_INC_STATS_BH(ip6_dst_idev(skb->dst), IPSTATS_MIB_REASMREQDS);
|
||||||
|
|
||||||
@ -726,7 +724,7 @@ static int ipv6_frag_rcv(struct sk_buff **skbp)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
hdr = skb->nh.ipv6h;
|
hdr = ipv6_hdr(skb);
|
||||||
fhdr = (struct frag_hdr *)skb->h.raw;
|
fhdr = (struct frag_hdr *)skb->h.raw;
|
||||||
|
|
||||||
if (!(fhdr->frag_off & htons(0xFFF9))) {
|
if (!(fhdr->frag_off & htons(0xFFF9))) {
|
||||||
|
@ -726,7 +726,7 @@ out2:
|
|||||||
|
|
||||||
void ip6_route_input(struct sk_buff *skb)
|
void ip6_route_input(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
int flags = RT6_LOOKUP_F_HAS_SADDR;
|
int flags = RT6_LOOKUP_F_HAS_SADDR;
|
||||||
struct flowi fl = {
|
struct flowi fl = {
|
||||||
.iif = skb->dev->ifindex,
|
.iif = skb->dev->ifindex,
|
||||||
@ -1775,7 +1775,7 @@ static inline int ip6_pkt_drop(struct sk_buff *skb, int code,
|
|||||||
int type;
|
int type;
|
||||||
switch (ipstats_mib_noroutes) {
|
switch (ipstats_mib_noroutes) {
|
||||||
case IPSTATS_MIB_INNOROUTES:
|
case IPSTATS_MIB_INNOROUTES:
|
||||||
type = ipv6_addr_type(&skb->nh.ipv6h->daddr);
|
type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
|
||||||
if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
|
if (type == IPV6_ADDR_ANY || type == IPV6_ADDR_RESERVED) {
|
||||||
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
|
IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_INADDRERRORS);
|
||||||
break;
|
break;
|
||||||
|
@ -366,7 +366,7 @@ out:
|
|||||||
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
|
static inline void ipip6_ecn_decapsulate(struct iphdr *iph, struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (INET_ECN_is_ce(iph->tos))
|
if (INET_ECN_is_ce(iph->tos))
|
||||||
IP6_ECN_set_ce(skb->nh.ipv6h);
|
IP6_ECN_set_ce(ipv6_hdr(skb));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ipip6_rcv(struct sk_buff *skb)
|
static int ipip6_rcv(struct sk_buff *skb)
|
||||||
@ -430,7 +430,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
struct ip_tunnel *tunnel = netdev_priv(dev);
|
struct ip_tunnel *tunnel = netdev_priv(dev);
|
||||||
struct net_device_stats *stats = &tunnel->stat;
|
struct net_device_stats *stats = &tunnel->stat;
|
||||||
struct iphdr *tiph = &tunnel->parms.iph;
|
struct iphdr *tiph = &tunnel->parms.iph;
|
||||||
struct ipv6hdr *iph6 = skb->nh.ipv6h;
|
struct ipv6hdr *iph6 = ipv6_hdr(skb);
|
||||||
u8 tos = tunnel->parms.iph.tos;
|
u8 tos = tunnel->parms.iph.tos;
|
||||||
struct rtable *rt; /* Route to the other host */
|
struct rtable *rt; /* Route to the other host */
|
||||||
struct net_device *tdev; /* Device to other host */
|
struct net_device *tdev; /* Device to other host */
|
||||||
@ -468,7 +468,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
addr_type = ipv6_addr_type(addr6);
|
addr_type = ipv6_addr_type(addr6);
|
||||||
|
|
||||||
if (addr_type == IPV6_ADDR_ANY) {
|
if (addr_type == IPV6_ADDR_ANY) {
|
||||||
addr6 = &skb->nh.ipv6h->daddr;
|
addr6 = &ipv6_hdr(skb)->daddr;
|
||||||
addr_type = ipv6_addr_type(addr6);
|
addr_type = ipv6_addr_type(addr6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,7 +550,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
|
|||||||
skb_set_owner_w(new_skb, skb->sk);
|
skb_set_owner_w(new_skb, skb->sk);
|
||||||
dev_kfree_skb(skb);
|
dev_kfree_skb(skb);
|
||||||
skb = new_skb;
|
skb = new_skb;
|
||||||
iph6 = skb->nh.ipv6h;
|
iph6 = ipv6_hdr(skb);
|
||||||
}
|
}
|
||||||
|
|
||||||
skb->h.raw = skb->nh.raw;
|
skb->h.raw = skb->nh.raw;
|
||||||
|
@ -115,8 +115,8 @@ static __inline__ __sum16 tcp_v6_check(struct tcphdr *th, int len,
|
|||||||
|
|
||||||
static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
|
static __u32 tcp_v6_init_sequence(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return secure_tcpv6_sequence_number(skb->nh.ipv6h->daddr.s6_addr32,
|
return secure_tcpv6_sequence_number(ipv6_hdr(skb)->daddr.s6_addr32,
|
||||||
skb->nh.ipv6h->saddr.s6_addr32,
|
ipv6_hdr(skb)->saddr.s6_addr32,
|
||||||
skb->h.th->dest,
|
skb->h.th->dest,
|
||||||
skb->h.th->source);
|
skb->h.th->source);
|
||||||
}
|
}
|
||||||
@ -837,7 +837,7 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
|
|||||||
{
|
{
|
||||||
__u8 *hash_location = NULL;
|
__u8 *hash_location = NULL;
|
||||||
struct tcp_md5sig_key *hash_expected;
|
struct tcp_md5sig_key *hash_expected;
|
||||||
struct ipv6hdr *ip6h = skb->nh.ipv6h;
|
struct ipv6hdr *ip6h = ipv6_hdr(skb);
|
||||||
struct tcphdr *th = skb->h.th;
|
struct tcphdr *th = skb->h.th;
|
||||||
int length = (th->doff << 2) - sizeof (*th);
|
int length = (th->doff << 2) - sizeof (*th);
|
||||||
int genhash;
|
int genhash;
|
||||||
@ -966,7 +966,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
|
|||||||
if (!pskb_may_pull(skb, sizeof(*th)))
|
if (!pskb_may_pull(skb, sizeof(*th)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ipv6h = skb->nh.ipv6h;
|
ipv6h = ipv6_hdr(skb);
|
||||||
th = skb->h.th;
|
th = skb->h.th;
|
||||||
|
|
||||||
th->check = 0;
|
th->check = 0;
|
||||||
@ -995,7 +995,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
|
|||||||
|
|
||||||
#ifdef CONFIG_TCP_MD5SIG
|
#ifdef CONFIG_TCP_MD5SIG
|
||||||
if (sk)
|
if (sk)
|
||||||
key = tcp_v6_md5_do_lookup(sk, &skb->nh.ipv6h->daddr);
|
key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
|
||||||
else
|
else
|
||||||
key = NULL;
|
key = NULL;
|
||||||
|
|
||||||
@ -1039,20 +1039,18 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
|
|||||||
(TCPOPT_NOP << 16) |
|
(TCPOPT_NOP << 16) |
|
||||||
(TCPOPT_MD5SIG << 8) |
|
(TCPOPT_MD5SIG << 8) |
|
||||||
TCPOLEN_MD5SIG);
|
TCPOLEN_MD5SIG);
|
||||||
tcp_v6_do_calc_md5_hash((__u8*)&opt[1],
|
tcp_v6_do_calc_md5_hash((__u8 *)&opt[1], key,
|
||||||
key,
|
&ipv6_hdr(skb)->daddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->saddr,
|
t1, IPPROTO_TCP, tot_len);
|
||||||
t1, IPPROTO_TCP,
|
|
||||||
tot_len);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buff->csum = csum_partial((char *)t1, sizeof(*t1), 0);
|
buff->csum = csum_partial((char *)t1, sizeof(*t1), 0);
|
||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
|
||||||
ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
|
||||||
|
|
||||||
t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
|
t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
|
||||||
sizeof(*t1), IPPROTO_TCP,
|
sizeof(*t1), IPPROTO_TCP,
|
||||||
@ -1093,7 +1091,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
|
|||||||
|
|
||||||
#ifdef CONFIG_TCP_MD5SIG
|
#ifdef CONFIG_TCP_MD5SIG
|
||||||
if (!tw && skb->sk) {
|
if (!tw && skb->sk) {
|
||||||
key = tcp_v6_md5_do_lookup(skb->sk, &skb->nh.ipv6h->daddr);
|
key = tcp_v6_md5_do_lookup(skb->sk, &ipv6_hdr(skb)->daddr);
|
||||||
} else if (tw && tw->tw_md5_keylen) {
|
} else if (tw && tw->tw_md5_keylen) {
|
||||||
tw_key.key = tw->tw_md5_key;
|
tw_key.key = tw->tw_md5_key;
|
||||||
tw_key.keylen = tw->tw_md5_keylen;
|
tw_key.keylen = tw->tw_md5_keylen;
|
||||||
@ -1142,20 +1140,18 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw,
|
|||||||
if (key) {
|
if (key) {
|
||||||
*topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
|
*topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
|
||||||
(TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
|
(TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
|
||||||
tcp_v6_do_calc_md5_hash((__u8 *)topt,
|
tcp_v6_do_calc_md5_hash((__u8 *)topt, key,
|
||||||
key,
|
&ipv6_hdr(skb)->daddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->saddr,
|
t1, IPPROTO_TCP, tot_len);
|
||||||
t1, IPPROTO_TCP,
|
|
||||||
tot_len);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buff->csum = csum_partial((char *)t1, tot_len, 0);
|
buff->csum = csum_partial((char *)t1, tot_len, 0);
|
||||||
|
|
||||||
memset(&fl, 0, sizeof(fl));
|
memset(&fl, 0, sizeof(fl));
|
||||||
ipv6_addr_copy(&fl.fl6_dst, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&fl.fl6_dst, &ipv6_hdr(skb)->saddr);
|
||||||
ipv6_addr_copy(&fl.fl6_src, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&fl.fl6_src, &ipv6_hdr(skb)->daddr);
|
||||||
|
|
||||||
t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
|
t1->check = csum_ipv6_magic(&fl.fl6_src, &fl.fl6_dst,
|
||||||
tot_len, IPPROTO_TCP,
|
tot_len, IPPROTO_TCP,
|
||||||
@ -1204,13 +1200,13 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb)
|
|||||||
|
|
||||||
/* Find possible connection requests. */
|
/* Find possible connection requests. */
|
||||||
req = inet6_csk_search_req(sk, &prev, th->source,
|
req = inet6_csk_search_req(sk, &prev, th->source,
|
||||||
&skb->nh.ipv6h->saddr,
|
&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr, inet6_iif(skb));
|
&ipv6_hdr(skb)->daddr, inet6_iif(skb));
|
||||||
if (req)
|
if (req)
|
||||||
return tcp_check_req(sk, skb, req, prev);
|
return tcp_check_req(sk, skb, req, prev);
|
||||||
|
|
||||||
nsk = __inet6_lookup_established(&tcp_hashinfo, &skb->nh.ipv6h->saddr,
|
nsk = __inet6_lookup_established(&tcp_hashinfo, &ipv6_hdr(skb)->saddr,
|
||||||
th->source, &skb->nh.ipv6h->daddr,
|
th->source, &ipv6_hdr(skb)->daddr,
|
||||||
ntohs(th->dest), inet6_iif(skb));
|
ntohs(th->dest), inet6_iif(skb));
|
||||||
|
|
||||||
if (nsk) {
|
if (nsk) {
|
||||||
@ -1277,8 +1273,8 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
|
|||||||
tcp_openreq_init(req, &tmp_opt, skb);
|
tcp_openreq_init(req, &tmp_opt, skb);
|
||||||
|
|
||||||
treq = inet6_rsk(req);
|
treq = inet6_rsk(req);
|
||||||
ipv6_addr_copy(&treq->rmt_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&treq->rmt_addr, &ipv6_hdr(skb)->saddr);
|
||||||
ipv6_addr_copy(&treq->loc_addr, &skb->nh.ipv6h->daddr);
|
ipv6_addr_copy(&treq->loc_addr, &ipv6_hdr(skb)->daddr);
|
||||||
TCP_ECN_create_request(req, skb->h.th);
|
TCP_ECN_create_request(req, skb->h.th);
|
||||||
treq->pktopts = NULL;
|
treq->pktopts = NULL;
|
||||||
if (ipv6_opt_accepted(sk, skb) ||
|
if (ipv6_opt_accepted(sk, skb) ||
|
||||||
@ -1365,7 +1361,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
newnp->pktoptions = NULL;
|
newnp->pktoptions = NULL;
|
||||||
newnp->opt = NULL;
|
newnp->opt = NULL;
|
||||||
newnp->mcast_oif = inet6_iif(skb);
|
newnp->mcast_oif = inet6_iif(skb);
|
||||||
newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
|
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
|
* No need to charge this sock to the relevant IPv6 refcnt debug socks count
|
||||||
@ -1473,7 +1469,7 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
|
|||||||
}
|
}
|
||||||
newnp->opt = NULL;
|
newnp->opt = NULL;
|
||||||
newnp->mcast_oif = inet6_iif(skb);
|
newnp->mcast_oif = inet6_iif(skb);
|
||||||
newnp->mcast_hops = skb->nh.ipv6h->hop_limit;
|
newnp->mcast_hops = ipv6_hdr(skb)->hop_limit;
|
||||||
|
|
||||||
/* Clone native IPv6 options from listening socket (if any)
|
/* Clone native IPv6 options from listening socket (if any)
|
||||||
|
|
||||||
@ -1532,15 +1528,16 @@ out:
|
|||||||
static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
|
static __sum16 tcp_v6_checksum_init(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (skb->ip_summed == CHECKSUM_COMPLETE) {
|
if (skb->ip_summed == CHECKSUM_COMPLETE) {
|
||||||
if (!tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
|
if (!tcp_v6_check(skb->h.th, skb->len, &ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr,skb->csum)) {
|
&ipv6_hdr(skb)->daddr, skb->csum)) {
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th,skb->len,&skb->nh.ipv6h->saddr,
|
skb->csum = ~csum_unfold(tcp_v6_check(skb->h.th, skb->len,
|
||||||
&skb->nh.ipv6h->daddr, 0));
|
&ipv6_hdr(skb)->saddr,
|
||||||
|
&ipv6_hdr(skb)->daddr, 0));
|
||||||
|
|
||||||
if (skb->len <= 76) {
|
if (skb->len <= 76) {
|
||||||
return __skb_checksum_complete(skb);
|
return __skb_checksum_complete(skb);
|
||||||
@ -1668,7 +1665,7 @@ ipv6_pktoptions:
|
|||||||
if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo)
|
if (np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo)
|
||||||
np->mcast_oif = inet6_iif(opt_skb);
|
np->mcast_oif = inet6_iif(opt_skb);
|
||||||
if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
|
if (np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim)
|
||||||
np->mcast_hops = opt_skb->nh.ipv6h->hop_limit;
|
np->mcast_hops = ipv6_hdr(opt_skb)->hop_limit;
|
||||||
if (ipv6_opt_accepted(sk, opt_skb)) {
|
if (ipv6_opt_accepted(sk, opt_skb)) {
|
||||||
skb_set_owner_r(opt_skb, sk);
|
skb_set_owner_r(opt_skb, sk);
|
||||||
opt_skb = xchg(&np->pktoptions, opt_skb);
|
opt_skb = xchg(&np->pktoptions, opt_skb);
|
||||||
@ -1718,11 +1715,11 @@ static int tcp_v6_rcv(struct sk_buff **pskb)
|
|||||||
skb->len - th->doff*4);
|
skb->len - th->doff*4);
|
||||||
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
|
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
|
||||||
TCP_SKB_CB(skb)->when = 0;
|
TCP_SKB_CB(skb)->when = 0;
|
||||||
TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h);
|
TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb));
|
||||||
TCP_SKB_CB(skb)->sacked = 0;
|
TCP_SKB_CB(skb)->sacked = 0;
|
||||||
|
|
||||||
sk = __inet6_lookup(&tcp_hashinfo, &skb->nh.ipv6h->saddr, th->source,
|
sk = __inet6_lookup(&tcp_hashinfo, &ipv6_hdr(skb)->saddr, th->source,
|
||||||
&skb->nh.ipv6h->daddr, ntohs(th->dest),
|
&ipv6_hdr(skb)->daddr, ntohs(th->dest),
|
||||||
inet6_iif(skb));
|
inet6_iif(skb));
|
||||||
|
|
||||||
if (!sk)
|
if (!sk)
|
||||||
@ -1802,7 +1799,7 @@ do_time_wait:
|
|||||||
struct sock *sk2;
|
struct sock *sk2;
|
||||||
|
|
||||||
sk2 = inet6_lookup_listener(&tcp_hashinfo,
|
sk2 = inet6_lookup_listener(&tcp_hashinfo,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->daddr,
|
||||||
ntohs(th->dest), inet6_iif(skb));
|
ntohs(th->dest), inet6_iif(skb));
|
||||||
if (sk2 != NULL) {
|
if (sk2 != NULL) {
|
||||||
struct inet_timewait_sock *tw = inet_twsk(sk);
|
struct inet_timewait_sock *tw = inet_twsk(sk);
|
||||||
|
@ -180,7 +180,8 @@ try_again:
|
|||||||
ipv6_addr_set(&sin6->sin6_addr, 0, 0,
|
ipv6_addr_set(&sin6->sin6_addr, 0, 0,
|
||||||
htonl(0xffff), ip_hdr(skb)->saddr);
|
htonl(0xffff), ip_hdr(skb)->saddr);
|
||||||
else {
|
else {
|
||||||
ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&sin6->sin6_addr,
|
||||||
|
&ipv6_hdr(skb)->saddr);
|
||||||
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
|
||||||
sin6->sin6_scope_id = IP6CB(skb)->iif;
|
sin6->sin6_scope_id = IP6CB(skb)->iif;
|
||||||
}
|
}
|
||||||
@ -392,13 +393,13 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (skb->ip_summed == CHECKSUM_COMPLETE &&
|
if (skb->ip_summed == CHECKSUM_COMPLETE &&
|
||||||
!csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
|
!csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
|
||||||
skb->len, proto, skb->csum))
|
skb->len, proto, skb->csum))
|
||||||
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
skb->ip_summed = CHECKSUM_UNNECESSARY;
|
||||||
|
|
||||||
if (skb->ip_summed != CHECKSUM_UNNECESSARY)
|
if (skb->ip_summed != CHECKSUM_UNNECESSARY)
|
||||||
skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
|
skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
|
||||||
&skb->nh.ipv6h->daddr,
|
&ipv6_hdr(skb)->daddr,
|
||||||
skb->len, proto, 0));
|
skb->len, proto, 0));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -417,8 +418,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
|
|||||||
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
|
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
|
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
daddr = &skb->nh.ipv6h->daddr;
|
daddr = &ipv6_hdr(skb)->daddr;
|
||||||
uh = skb->h.uh;
|
uh = skb->h.uh;
|
||||||
|
|
||||||
ulen = ntohs(uh->len);
|
ulen = ntohs(uh->len);
|
||||||
@ -438,8 +439,8 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
|
|||||||
if (ulen < skb->len) {
|
if (ulen < skb->len) {
|
||||||
if (pskb_trim_rcsum(skb, ulen))
|
if (pskb_trim_rcsum(skb, ulen))
|
||||||
goto short_packet;
|
goto short_packet;
|
||||||
saddr = &skb->nh.ipv6h->saddr;
|
saddr = &ipv6_hdr(skb)->saddr;
|
||||||
daddr = &skb->nh.ipv6h->daddr;
|
daddr = &ipv6_hdr(skb)->daddr;
|
||||||
uh = skb->h.uh;
|
uh = skb->h.uh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
|
|||||||
goto drop;
|
goto drop;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
if (xfrm_nr == XFRM_MAX_DEPTH)
|
if (xfrm_nr == XFRM_MAX_DEPTH)
|
||||||
goto drop;
|
goto drop;
|
||||||
@ -112,7 +112,7 @@ int xfrm6_rcv_spi(struct sk_buff *skb, __be32 spi)
|
|||||||
return -1;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_NETFILTER
|
#ifdef CONFIG_NETFILTER
|
||||||
skb->nh.ipv6h->payload_len = htons(skb->len);
|
ipv6_hdr(skb)->payload_len = htons(skb->len);
|
||||||
__skb_push(skb, skb->data - skb_network_header(skb));
|
__skb_push(skb, skb->data - skb_network_header(skb));
|
||||||
|
|
||||||
NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
|
NF_HOOK(PF_INET6, NF_IP6_PRE_ROUTING, skb, skb->dev, NULL,
|
||||||
|
@ -38,7 +38,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
int hdr_len;
|
int hdr_len;
|
||||||
|
|
||||||
skb_push(skb, x->props.header_len);
|
skb_push(skb, x->props.header_len);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
|
hdr_len = ip6_find_1stfragopt(skb, &prevhdr);
|
||||||
skb->nh.raw = prevhdr - x->props.header_len;
|
skb->nh.raw = prevhdr - x->props.header_len;
|
||||||
@ -46,7 +46,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
memmove(skb->data, iph, hdr_len);
|
memmove(skb->data, iph, hdr_len);
|
||||||
|
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
top_iph = skb->nh.ipv6h;
|
top_iph = ipv6_hdr(skb);
|
||||||
skb->nh.raw = &top_iph->nexthdr;
|
skb->nh.raw = &top_iph->nexthdr;
|
||||||
skb->h.ipv6h = top_iph + 1;
|
skb->h.ipv6h = top_iph + 1;
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
skb_set_mac_header(skb, -skb->mac_len);
|
skb_set_mac_header(skb, -skb->mac_len);
|
||||||
memmove(skb_mac_header(skb), old_mac, skb->mac_len);
|
memmove(skb_mac_header(skb), old_mac, skb->mac_len);
|
||||||
|
|
||||||
ip6h = skb->nh.ipv6h;
|
ip6h = ipv6_hdr(skb);
|
||||||
ip6h->payload_len = htons(skb->len - size);
|
ip6h->payload_len = htons(skb->len - size);
|
||||||
ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
|
ipv6_addr_copy(&ip6h->daddr, (struct in6_addr *) &x->sel.daddr.a6);
|
||||||
ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);
|
ipv6_addr_copy(&ip6h->saddr, (struct in6_addr *) &x->sel.saddr.a6);
|
||||||
|
@ -50,7 +50,7 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
int hdr_len;
|
int hdr_len;
|
||||||
|
|
||||||
skb_push(skb, x->props.header_len);
|
skb_push(skb, x->props.header_len);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
||||||
skb->nh.raw = prevhdr - x->props.header_len;
|
skb->nh.raw = prevhdr - x->props.header_len;
|
||||||
|
@ -32,7 +32,7 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
int hdr_len;
|
int hdr_len;
|
||||||
|
|
||||||
skb_push(skb, x->props.header_len);
|
skb_push(skb, x->props.header_len);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
||||||
skb->nh.raw = prevhdr - x->props.header_len;
|
skb->nh.raw = prevhdr - x->props.header_len;
|
||||||
@ -57,7 +57,7 @@ static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
memmove(skb->h.raw, skb_network_header(skb), ihl);
|
memmove(skb->h.raw, skb_network_header(skb), ihl);
|
||||||
skb->nh.raw = skb->h.raw;
|
skb->nh.raw = skb->h.raw;
|
||||||
}
|
}
|
||||||
skb->nh.ipv6h->payload_len = htons(skb->len + ihl -
|
ipv6_hdr(skb)->payload_len = htons(skb->len + ihl -
|
||||||
sizeof(struct ipv6hdr));
|
sizeof(struct ipv6hdr));
|
||||||
skb->h.raw = skb->data;
|
skb->h.raw = skb->data;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
|
static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *outer_iph = skb->nh.ipv6h;
|
struct ipv6hdr *outer_iph = ipv6_hdr(skb);
|
||||||
struct ipv6hdr *inner_iph = skb->h.ipv6h;
|
struct ipv6hdr *inner_iph = skb->h.ipv6h;
|
||||||
|
|
||||||
if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
|
if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
|
||||||
@ -27,7 +27,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
|
|||||||
|
|
||||||
static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb)
|
static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (INET_ECN_is_ce(ipv6_get_dsfield(skb->nh.ipv6h)))
|
if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6_hdr(skb))))
|
||||||
IP_ECN_set_ce(skb->h.ipiph);
|
IP_ECN_set_ce(skb->h.ipiph);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,10 +51,10 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
int dsfield;
|
int dsfield;
|
||||||
|
|
||||||
skb_push(skb, x->props.header_len);
|
skb_push(skb, x->props.header_len);
|
||||||
iph = skb->nh.ipv6h;
|
iph = ipv6_hdr(skb);
|
||||||
|
|
||||||
skb_reset_network_header(skb);
|
skb_reset_network_header(skb);
|
||||||
top_iph = skb->nh.ipv6h;
|
top_iph = ipv6_hdr(skb);
|
||||||
skb->nh.raw = &top_iph->nexthdr;
|
skb->nh.raw = &top_iph->nexthdr;
|
||||||
skb->h.ipv6h = top_iph + 1;
|
skb->h.ipv6h = top_iph + 1;
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
nh = skb_network_header(skb);
|
nh = skb_network_header(skb);
|
||||||
if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) {
|
if (nh[IP6CB(skb)->nhoff] == IPPROTO_IPV6) {
|
||||||
if (x->props.flags & XFRM_STATE_DECAP_DSCP)
|
if (x->props.flags & XFRM_STATE_DECAP_DSCP)
|
||||||
ipv6_copy_dscp(skb->nh.ipv6h, skb->h.ipv6h);
|
ipv6_copy_dscp(ipv6_hdr(skb), skb->h.ipv6h);
|
||||||
if (!(x->props.flags & XFRM_STATE_NOECN))
|
if (!(x->props.flags & XFRM_STATE_NOECN))
|
||||||
ipip6_ecn_decapsulate(skb);
|
ipip6_ecn_decapsulate(skb);
|
||||||
} else {
|
} else {
|
||||||
|
@ -271,7 +271,7 @@ static inline void
|
|||||||
_decode_session6(struct sk_buff *skb, struct flowi *fl)
|
_decode_session6(struct sk_buff *skb, struct flowi *fl)
|
||||||
{
|
{
|
||||||
u16 offset = skb->h.raw - skb->nh.raw;
|
u16 offset = skb->h.raw - skb->nh.raw;
|
||||||
struct ipv6hdr *hdr = skb->nh.ipv6h;
|
struct ipv6hdr *hdr = ipv6_hdr(skb);
|
||||||
struct ipv6_opt_hdr *exthdr;
|
struct ipv6_opt_hdr *exthdr;
|
||||||
const unsigned char *nh = skb_network_header(skb);
|
const unsigned char *nh = skb_network_header(skb);
|
||||||
u8 nexthdr = nh[IP6CB(skb)->nhoff];
|
u8 nexthdr = nh[IP6CB(skb)->nhoff];
|
||||||
|
@ -257,7 +257,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
|
|||||||
|
|
||||||
static int xfrm6_tunnel_rcv(struct sk_buff *skb)
|
static int xfrm6_tunnel_rcv(struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
__be32 spi;
|
__be32 spi;
|
||||||
|
|
||||||
spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
|
spi = xfrm6_tunnel_spi_lookup((xfrm_address_t *)&iph->saddr);
|
||||||
|
@ -56,13 +56,13 @@ static unsigned int target6(struct sk_buff **pskb,
|
|||||||
const void *targinfo)
|
const void *targinfo)
|
||||||
{
|
{
|
||||||
const struct xt_DSCP_info *dinfo = targinfo;
|
const struct xt_DSCP_info *dinfo = targinfo;
|
||||||
u_int8_t dscp = ipv6_get_dsfield((*pskb)->nh.ipv6h) >> XT_DSCP_SHIFT;
|
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(*pskb)) >> XT_DSCP_SHIFT;
|
||||||
|
|
||||||
if (dscp != dinfo->dscp) {
|
if (dscp != dinfo->dscp) {
|
||||||
if (!skb_make_writable(pskb, sizeof(struct ipv6hdr)))
|
if (!skb_make_writable(pskb, sizeof(struct ipv6hdr)))
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
|
|
||||||
ipv6_change_dsfield((*pskb)->nh.ipv6h, (__u8)(~XT_DSCP_MASK),
|
ipv6_change_dsfield(ipv6_hdr(*pskb), (__u8)(~XT_DSCP_MASK),
|
||||||
dinfo->dscp << XT_DSCP_SHIFT);
|
dinfo->dscp << XT_DSCP_SHIFT);
|
||||||
}
|
}
|
||||||
return XT_CONTINUE;
|
return XT_CONTINUE;
|
||||||
|
@ -171,7 +171,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
|
|||||||
const struct xt_target *target,
|
const struct xt_target *target,
|
||||||
const void *targinfo)
|
const void *targinfo)
|
||||||
{
|
{
|
||||||
struct ipv6hdr *ipv6h = (*pskb)->nh.ipv6h;
|
struct ipv6hdr *ipv6h = ipv6_hdr(*pskb);
|
||||||
u8 nexthdr;
|
u8 nexthdr;
|
||||||
int tcphoff;
|
int tcphoff;
|
||||||
int ret;
|
int ret;
|
||||||
@ -187,7 +187,7 @@ xt_tcpmss_target6(struct sk_buff **pskb,
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return NF_DROP;
|
return NF_DROP;
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
ipv6h = (*pskb)->nh.ipv6h;
|
ipv6h = ipv6_hdr(*pskb);
|
||||||
ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret);
|
ipv6h->payload_len = htons(ntohs(ipv6h->payload_len) + ret);
|
||||||
}
|
}
|
||||||
return XT_CONTINUE;
|
return XT_CONTINUE;
|
||||||
|
@ -49,7 +49,7 @@ static int match6(const struct sk_buff *skb,
|
|||||||
int *hotdrop)
|
int *hotdrop)
|
||||||
{
|
{
|
||||||
const struct xt_dscp_info *info = matchinfo;
|
const struct xt_dscp_info *info = matchinfo;
|
||||||
u_int8_t dscp = ipv6_get_dsfield(skb->nh.ipv6h) >> XT_DSCP_SHIFT;
|
u_int8_t dscp = ipv6_get_dsfield(ipv6_hdr(skb)) >> XT_DSCP_SHIFT;
|
||||||
|
|
||||||
return (dscp == info->dscp) ^ !!info->invert;
|
return (dscp == info->dscp) ^ !!info->invert;
|
||||||
}
|
}
|
||||||
|
@ -392,10 +392,10 @@ hashlimit_init_dst(struct xt_hashlimit_htable *hinfo, struct dsthash_dst *dst,
|
|||||||
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
#if defined(CONFIG_IP6_NF_IPTABLES) || defined(CONFIG_IP6_NF_IPTABLES_MODULE)
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
|
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_DIP)
|
||||||
memcpy(&dst->addr.ip6.dst, &skb->nh.ipv6h->daddr,
|
memcpy(&dst->addr.ip6.dst, &ipv6_hdr(skb)->daddr,
|
||||||
sizeof(dst->addr.ip6.dst));
|
sizeof(dst->addr.ip6.dst));
|
||||||
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
|
if (hinfo->cfg.mode & XT_HASHLIMIT_HASH_SIP)
|
||||||
memcpy(&dst->addr.ip6.src, &skb->nh.ipv6h->saddr,
|
memcpy(&dst->addr.ip6.src, &ipv6_hdr(skb)->saddr,
|
||||||
sizeof(dst->addr.ip6.src));
|
sizeof(dst->addr.ip6.src));
|
||||||
|
|
||||||
if (!(hinfo->cfg.mode &
|
if (!(hinfo->cfg.mode &
|
||||||
|
@ -47,7 +47,8 @@ match6(const struct sk_buff *skb,
|
|||||||
int *hotdrop)
|
int *hotdrop)
|
||||||
{
|
{
|
||||||
const struct xt_length_info *info = matchinfo;
|
const struct xt_length_info *info = matchinfo;
|
||||||
u_int16_t pktlen = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr);
|
const u_int16_t pktlen = (ntohs(ipv6_hdr(skb)->payload_len) +
|
||||||
|
sizeof(struct ipv6hdr));
|
||||||
|
|
||||||
return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
|
return (pktlen >= info->min && pktlen <= info->max) ^ info->invert;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ static int rsvp_classify(struct sk_buff *skb, struct tcf_proto *tp,
|
|||||||
u8 tunnelid = 0;
|
u8 tunnelid = 0;
|
||||||
u8 *xprt;
|
u8 *xprt;
|
||||||
#if RSVP_DST_LEN == 4
|
#if RSVP_DST_LEN == 4
|
||||||
struct ipv6hdr *nhptr = skb->nh.ipv6h;
|
struct ipv6hdr *nhptr = ipv6_hdr(skb);
|
||||||
#else
|
#else
|
||||||
struct iphdr *nhptr = ip_hdr(skb);
|
struct iphdr *nhptr = ip_hdr(skb);
|
||||||
#endif
|
#endif
|
||||||
|
@ -220,7 +220,7 @@ static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
|
|||||||
& ~INET_ECN_MASK;
|
& ~INET_ECN_MASK;
|
||||||
break;
|
break;
|
||||||
case __constant_htons(ETH_P_IPV6):
|
case __constant_htons(ETH_P_IPV6):
|
||||||
skb->tc_index = ipv6_get_dsfield(skb->nh.ipv6h)
|
skb->tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
|
||||||
& ~INET_ECN_MASK;
|
& ~INET_ECN_MASK;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -296,7 +296,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
|
|||||||
p->value[index]);
|
p->value[index]);
|
||||||
break;
|
break;
|
||||||
case __constant_htons(ETH_P_IPV6):
|
case __constant_htons(ETH_P_IPV6):
|
||||||
ipv6_change_dsfield(skb->nh.ipv6h, p->mask[index],
|
ipv6_change_dsfield(ipv6_hdr(skb), p->mask[index],
|
||||||
p->value[index]);
|
p->value[index]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -152,7 +152,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
|
|||||||
}
|
}
|
||||||
case __constant_htons(ETH_P_IPV6):
|
case __constant_htons(ETH_P_IPV6):
|
||||||
{
|
{
|
||||||
struct ipv6hdr *iph = skb->nh.ipv6h;
|
struct ipv6hdr *iph = ipv6_hdr(skb);
|
||||||
h = iph->daddr.s6_addr32[3];
|
h = iph->daddr.s6_addr32[3];
|
||||||
h2 = iph->saddr.s6_addr32[3]^iph->nexthdr;
|
h2 = iph->saddr.s6_addr32[3]^iph->nexthdr;
|
||||||
if (iph->nexthdr == IPPROTO_TCP ||
|
if (iph->nexthdr == IPPROTO_TCP ||
|
||||||
|
@ -393,10 +393,10 @@ static void sctp_v6_from_skb(union sctp_addr *addr,struct sk_buff *skb,
|
|||||||
sh = (struct sctphdr *) skb->h.raw;
|
sh = (struct sctphdr *) skb->h.raw;
|
||||||
if (is_saddr) {
|
if (is_saddr) {
|
||||||
*port = sh->source;
|
*port = sh->source;
|
||||||
from = &skb->nh.ipv6h->saddr;
|
from = &ipv6_hdr(skb)->saddr;
|
||||||
} else {
|
} else {
|
||||||
*port = sh->dest;
|
*port = sh->dest;
|
||||||
from = &skb->nh.ipv6h->daddr;
|
from = &ipv6_hdr(skb)->daddr;
|
||||||
}
|
}
|
||||||
ipv6_addr_copy(&addr->v6.sin6_addr, from);
|
ipv6_addr_copy(&addr->v6.sin6_addr, from);
|
||||||
}
|
}
|
||||||
@ -698,7 +698,7 @@ static int sctp_v6_skb_iif(const struct sk_buff *skb)
|
|||||||
/* Was this packet marked by Explicit Congestion Notification? */
|
/* Was this packet marked by Explicit Congestion Notification? */
|
||||||
static int sctp_v6_is_ce(const struct sk_buff *skb)
|
static int sctp_v6_is_ce(const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
return *((__u32 *)(skb->nh.ipv6h)) & htonl(1<<20);
|
return *((__u32 *)(ipv6_hdr(skb))) & htonl(1 << 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump the v6 addr to the seq file. */
|
/* Dump the v6 addr to the seq file. */
|
||||||
@ -777,7 +777,7 @@ static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, just copy the v6 address. */
|
/* Otherwise, just copy the v6 address. */
|
||||||
ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
|
ipv6_addr_copy(&sin6->sin6_addr, &ipv6_hdr(skb)->saddr);
|
||||||
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
|
if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL) {
|
||||||
struct sctp_ulpevent *ev = sctp_skb2event(skb);
|
struct sctp_ulpevent *ev = sctp_skb2event(skb);
|
||||||
sin6->sin6_scope_id = ev->iif;
|
sin6->sin6_scope_id = ev->iif;
|
||||||
|
Loading…
Reference in New Issue
Block a user