Commit 362807fc authored by Hideaki Yoshifuji's avatar Hideaki Yoshifuji Committed by David S. Miller

[IPV6]: Move NIP6 macro into general header.

parent fa7c9b64
...@@ -134,6 +134,16 @@ extern void dump_stack(void); ...@@ -134,6 +134,16 @@ extern void dump_stack(void);
((unsigned char *)&addr)[2], \ ((unsigned char *)&addr)[2], \
((unsigned char *)&addr)[3] ((unsigned char *)&addr)[3]
#define NIP6(addr) \
ntohs((addr).s6_addr16[0]), \
ntohs((addr).s6_addr16[1]), \
ntohs((addr).s6_addr16[2]), \
ntohs((addr).s6_addr16[3]), \
ntohs((addr).s6_addr16[4]), \
ntohs((addr).s6_addr16[5]), \
ntohs((addr).s6_addr16[6]), \
ntohs((addr).s6_addr16[7])
#if defined(__LITTLE_ENDIAN) #if defined(__LITTLE_ENDIAN)
#define HIPQUAD(addr) \ #define HIPQUAD(addr) \
((unsigned char *)&addr)[3], \ ((unsigned char *)&addr)[3], \
......
...@@ -36,17 +36,6 @@ ...@@ -36,17 +36,6 @@
#include <net/xfrm.h> #include <net/xfrm.h>
#include <asm/scatterlist.h> #include <asm/scatterlist.h>
/* XXX no ipv6 ah specific */
#define NIP6(addr) \
ntohs((addr).s6_addr16[0]),\
ntohs((addr).s6_addr16[1]),\
ntohs((addr).s6_addr16[2]),\
ntohs((addr).s6_addr16[3]),\
ntohs((addr).s6_addr16[4]),\
ntohs((addr).s6_addr16[5]),\
ntohs((addr).s6_addr16[6]),\
ntohs((addr).s6_addr16[7])
int ah6_output(struct sk_buff *skb) int ah6_output(struct sk_buff *skb)
{ {
int err; int err;
......
...@@ -46,17 +46,6 @@ ...@@ -46,17 +46,6 @@
/* Move to common area: it is shared with AH. */ /* Move to common area: it is shared with AH. */
/* Common with AH after some work on arguments. */ /* Common with AH after some work on arguments. */
/* XXX no ipv6 esp specific */
#define NIP6(addr) \
ntohs((addr).s6_addr16[0]),\
ntohs((addr).s6_addr16[1]),\
ntohs((addr).s6_addr16[2]),\
ntohs((addr).s6_addr16[3]),\
ntohs((addr).s6_addr16[4]),\
ntohs((addr).s6_addr16[5]),\
ntohs((addr).s6_addr16[6]),\
ntohs((addr).s6_addr16[7])
static int get_offset(u8 *packet, u32 packet_len, u8 *nexthdr, struct ipv6_opt_hdr **prevhdr) static int get_offset(u8 *packet, u32 packet_len, u8 *nexthdr, struct ipv6_opt_hdr **prevhdr)
{ {
u16 offset = sizeof(struct ipv6hdr); u16 offset = sizeof(struct ipv6hdr);
......
...@@ -557,22 +557,7 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) ...@@ -557,22 +557,7 @@ static int icmpv6_rcv(struct sk_buff **pskb, unsigned int *nhoffp)
skb_checksum(skb, 0, skb->len, 0))) { skb_checksum(skb, 0, skb->len, 0))) {
if (net_ratelimit()) if (net_ratelimit())
printk(KERN_DEBUG "ICMPv6 checksum failed [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x > %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]\n", printk(KERN_DEBUG "ICMPv6 checksum failed [%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x > %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x]\n",
ntohs(saddr->s6_addr16[0]), NIP6(*saddr), NIP6(*daddr));
ntohs(saddr->s6_addr16[1]),
ntohs(saddr->s6_addr16[2]),
ntohs(saddr->s6_addr16[3]),
ntohs(saddr->s6_addr16[4]),
ntohs(saddr->s6_addr16[5]),
ntohs(saddr->s6_addr16[6]),
ntohs(saddr->s6_addr16[7]),
ntohs(daddr->s6_addr16[0]),
ntohs(daddr->s6_addr16[1]),
ntohs(daddr->s6_addr16[2]),
ntohs(daddr->s6_addr16[3]),
ntohs(daddr->s6_addr16[4]),
ntohs(daddr->s6_addr16[5]),
ntohs(daddr->s6_addr16[6]),
ntohs(daddr->s6_addr16[7]));
goto discard_it; goto discard_it;
} }
} }
......
...@@ -44,17 +44,6 @@ ...@@ -44,17 +44,6 @@
#include <linux/ipv6.h> #include <linux/ipv6.h>
#include <linux/icmpv6.h> #include <linux/icmpv6.h>
/* XXX no ipv6 ipcomp specific */
#define NIP6(addr) \
ntohs((addr).s6_addr16[0]),\
ntohs((addr).s6_addr16[1]),\
ntohs((addr).s6_addr16[2]),\
ntohs((addr).s6_addr16[3]),\
ntohs((addr).s6_addr16[4]),\
ntohs((addr).s6_addr16[5]),\
ntohs((addr).s6_addr16[6]),\
ntohs((addr).s6_addr16[7])
static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb) static int ipcomp6_input(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
{ {
int err = 0; int err = 0;
......
...@@ -25,16 +25,6 @@ struct in_device; ...@@ -25,16 +25,6 @@ struct in_device;
#define DEBUGP(format, args...) #define DEBUGP(format, args...)
#endif #endif
#define NIP6(addr) \
ntohs((addr).s6_addr16[0]), \
ntohs((addr).s6_addr16[1]), \
ntohs((addr).s6_addr16[2]), \
ntohs((addr).s6_addr16[3]), \
ntohs((addr).s6_addr16[4]), \
ntohs((addr).s6_addr16[5]), \
ntohs((addr).s6_addr16[6]), \
ntohs((addr).s6_addr16[7])
struct esphdr { struct esphdr {
__u32 spi; __u32 spi;
}; /* FIXME evil kludge */ }; /* FIXME evil kludge */
......
...@@ -77,17 +77,6 @@ ...@@ -77,17 +77,6 @@
extern struct notifier_block sctp_inetaddr_notifier; extern struct notifier_block sctp_inetaddr_notifier;
/* FIXME: This macro needs to be moved to a common header file. */
#define NIP6(addr) \
ntohs((addr)->s6_addr16[0]), \
ntohs((addr)->s6_addr16[1]), \
ntohs((addr)->s6_addr16[2]), \
ntohs((addr)->s6_addr16[3]), \
ntohs((addr)->s6_addr16[4]), \
ntohs((addr)->s6_addr16[5]), \
ntohs((addr)->s6_addr16[6]), \
ntohs((addr)->s6_addr16[7])
/* ICMP error handler. */ /* ICMP error handler. */
void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
int type, int code, int offset, __u32 info) int type, int code, int offset, __u32 info)
...@@ -180,8 +169,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport, ...@@ -180,8 +169,8 @@ static int sctp_v6_xmit(struct sk_buff *skb, struct sctp_transport *transport,
SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, " SCTP_DEBUG_PRINTK("%s: skb:%p, len:%d, "
"src:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x " "src:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x "
"dst:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", "dst:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
__FUNCTION__, skb, skb->len, NIP6(fl.fl6_src), __FUNCTION__, skb, skb->len,
NIP6(fl.fl6_dst)); NIP6(*fl.fl6_src), NIP6(*fl.fl6_dst));
SCTP_INC_STATS(SctpOutSCTPPacks); SCTP_INC_STATS(SctpOutSCTPPacks);
...@@ -200,13 +189,13 @@ struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, ...@@ -200,13 +189,13 @@ struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
.nl_u = { .ip6_u = { .daddr = &daddr->v6.sin6_addr, } } }; .nl_u = { .ip6_u = { .daddr = &daddr->v6.sin6_addr, } } };
SCTP_DEBUG_PRINTK("%s: DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", SCTP_DEBUG_PRINTK("%s: DST=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ",
__FUNCTION__, NIP6(fl.fl6_dst)); __FUNCTION__, NIP6(*fl.fl6_dst));
if (saddr) { if (saddr) {
fl.fl6_src = &saddr->v6.sin6_addr; fl.fl6_src = &saddr->v6.sin6_addr;
SCTP_DEBUG_PRINTK( SCTP_DEBUG_PRINTK(
"SRC=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x - ", "SRC=%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x - ",
NIP6(fl.fl6_src)); NIP6(*fl.fl6_src));
} }
dst = ip6_route_output(NULL, &fl); dst = ip6_route_output(NULL, &fl);
...@@ -216,7 +205,7 @@ struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc, ...@@ -216,7 +205,7 @@ struct dst_entry *sctp_v6_get_dst(struct sctp_association *asoc,
SCTP_DEBUG_PRINTK( SCTP_DEBUG_PRINTK(
"rt6_dst:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x " "rt6_dst:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x "
"rt6_src:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", "rt6_src:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
NIP6(&rt->rt6i_dst.addr), NIP6(&rt->rt6i_src.addr)); NIP6(rt->rt6i_dst.addr), NIP6(rt->rt6i_src.addr));
} else { } else {
SCTP_DEBUG_PRINTK("NO ROUTE\n"); SCTP_DEBUG_PRINTK("NO ROUTE\n");
} }
...@@ -263,13 +252,13 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst, ...@@ -263,13 +252,13 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst,
SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p " SCTP_DEBUG_PRINTK("%s: asoc:%p dst:%p "
"daddr:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ", "daddr:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x ",
__FUNCTION__, asoc, dst, NIP6(&daddr->v6.sin6_addr)); __FUNCTION__, asoc, dst, NIP6(daddr->v6.sin6_addr));
if (!asoc) { if (!asoc) {
ipv6_get_saddr(dst, &daddr->v6.sin6_addr,&saddr->v6.sin6_addr); ipv6_get_saddr(dst, &daddr->v6.sin6_addr,&saddr->v6.sin6_addr);
SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: " SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: "
"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
NIP6(&saddr->v6.sin6_addr)); NIP6(saddr->v6.sin6_addr));
return; return;
} }
...@@ -298,12 +287,12 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst, ...@@ -298,12 +287,12 @@ void sctp_v6_get_saddr(struct sctp_association *asoc, struct dst_entry *dst,
memcpy(saddr, baddr, sizeof(union sctp_addr)); memcpy(saddr, baddr, sizeof(union sctp_addr));
SCTP_DEBUG_PRINTK("saddr: " SCTP_DEBUG_PRINTK("saddr: "
"%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
NIP6(&saddr->v6.sin6_addr)); NIP6(saddr->v6.sin6_addr));
} else { } else {
printk(KERN_ERR "%s: asoc:%p Could not find a valid source " printk(KERN_ERR "%s: asoc:%p Could not find a valid source "
"address for the " "address for the "
"dest:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n", "dest:%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
__FUNCTION__, asoc, NIP6(&daddr->v6.sin6_addr)); __FUNCTION__, asoc, NIP6(daddr->v6.sin6_addr));
} }
sctp_read_unlock(addr_lock); sctp_read_unlock(addr_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment