|
| | FILE_LICENCE (GPL2_OR_LATER) |
| |
| struct ip_statistics_family ipv6_statistics_family | __ip_statistics_family (IP_STATISTICS_IPV6) |
| | IPv6 statistics family. More...
|
| |
| static uint32_t | ipv6col (struct in6_addr *in) |
| | Determine debugging colour for IPv6 debug messages. More...
|
| |
| static unsigned int | ipv6_scope (const struct in6_addr *addr) |
| | Determine IPv6 address scope. More...
|
| |
| static void | ipv6_dump_miniroute (struct ipv6_miniroute *miniroute) |
| | Dump IPv6 routing table entry. More...
|
| |
| int | ipv6_has_addr (struct net_device *netdev, struct in6_addr *addr) |
| | Check if network device has a specific IPv6 address. More...
|
| |
| static unsigned int | ipv6_match_len (struct ipv6_miniroute *miniroute, struct in6_addr *address) |
| | Count matching bits of an IPv6 routing table entry prefix. More...
|
| |
| static struct ipv6_miniroute * | ipv6_miniroute (struct net_device *netdev, struct in6_addr *address) |
| | Find IPv6 routing table entry for a given address. More...
|
| |
| int | ipv6_add_miniroute (struct net_device *netdev, struct in6_addr *address, unsigned int prefix_len, struct in6_addr *router) |
| | Add IPv6 routing table entry. More...
|
| |
| void | ipv6_del_miniroute (struct ipv6_miniroute *miniroute) |
| | Delete IPv6 minirouting table entry. More...
|
| |
| struct ipv6_miniroute * | ipv6_route (unsigned int scope_id, struct in6_addr **dest) |
| | Perform IPv6 routing. More...
|
| |
| static struct net_device * | ipv6_netdev (struct sockaddr_tcpip *st_dest) |
| | Determine transmitting network device. More...
|
| |
| static int | ipv6_check_options (struct ipv6_header *iphdr, struct ipv6_options_header *options, size_t len) |
| | Check that received options can be safely ignored. More...
|
| |
| static int | ipv6_is_fragment (struct fragment *fragment, struct io_buffer *iobuf, size_t hdrlen) |
| | Check if fragment matches fragment reassembly buffer. More...
|
| |
| static size_t | ipv6_fragment_offset (struct io_buffer *iobuf, size_t hdrlen) |
| | Get fragment offset. More...
|
| |
| static int | ipv6_more_fragments (struct io_buffer *iobuf, size_t hdrlen) |
| | Check if more fragments exist. More...
|
| |
| static uint16_t | ipv6_pshdr_chksum (struct ipv6_header *iphdr, size_t len, int next_header, uint16_t csum) |
| | Calculate IPv6 pseudo-header checksum. More...
|
| |
| static int | ipv6_tx (struct io_buffer *iobuf, struct tcpip_protocol *tcpip_protocol, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, struct net_device *netdev, uint16_t *trans_csum) |
| | Transmit IPv6 packet. More...
|
| |
| static int | ipv6_rx (struct io_buffer *iobuf, struct net_device *netdev, const void *ll_dest __unused, const void *ll_source __unused, unsigned int flags __unused) |
| | Process incoming IPv6 packets. More...
|
| |
| int | inet6_aton (const char *string, struct in6_addr *in) |
| | Parse IPv6 address. More...
|
| |
| char * | inet6_ntoa (const struct in6_addr *in) |
| | Convert IPv6 address to standard notation. More...
|
| |
| static const char * | ipv6_ntoa (const void *net_addr) |
| | Transcribe IPv6 address. More...
|
| |
| static const char * | ipv6_sock_ntoa (struct sockaddr *sa) |
| | Transcribe IPv6 socket address. More...
|
| |
| static int | ipv6_sock_aton (const char *string, struct sockaddr *sa) |
| | Parse IPv6 socket address. More...
|
| |
| int | parse_ipv6_setting (const struct setting_type *type __unused, const char *value, void *buf, size_t len) |
| | Parse IPv6 address setting value. More...
|
| |
| int | format_ipv6_setting (const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len) |
| | Format IPv6 address setting value. More...
|
| |
| const struct setting ip6_setting | __setting (SETTING_IP6, ip6) |
| | IPv6 address setting. More...
|
| |
| const struct setting len6_setting | __setting (SETTING_IP6, len6) |
| | IPv6 prefix length setting. More...
|
| |
| const struct setting gateway6_setting | __setting (SETTING_IP6, gateway6) |
| | Default gateway setting. More...
|
| |
| static int | ipv6_applies (struct settings *settings __unused, const struct setting *setting) |
| | Check applicability of IPv6 link-local address setting. More...
|
| |
| static int | ipv6_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
| | Fetch IPv6 link-local address setting. More...
|
| |
| static int | ipv6_register_settings (struct net_device *netdev, void *priv) |
| | Register IPv6 link-local address settings. More...
|
| |
| static int | ipv6_create_routes (struct net_device *netdev, struct settings *settings) |
| | Create IPv6 routing table based on configured settings. More...
|
| |
| static int | ipv6_create_all_routes (void) |
| | Create IPv6 routing table based on configured settings. More...
|
| |
| | REQUIRING_SYMBOL (ipv6_protocol) |
| |
| | REQUIRE_OBJECT (icmpv6) |
| |
| | REQUIRE_OBJECT (ndp) |
| |
IPv6 protocol.
Definition in file ipv6.c.
| int ipv6_add_miniroute |
( |
struct net_device * |
netdev, |
|
|
struct in6_addr * |
address, |
|
|
unsigned int |
prefix_len, |
|
|
struct in6_addr * |
router |
|
) |
| |
Add IPv6 routing table entry.
- Parameters
-
| netdev | Network device |
| address | IPv6 address (or prefix) |
| prefix_len | Prefix length |
| router | Router address (if any) |
- Return values
-
Definition at line 217 of file ipv6.c.
221 unsigned int remaining;
234 miniroute =
zalloc (
sizeof ( *miniroute ) );
239 sizeof ( miniroute->
address ) );
261 for ( i = 0 ; i < (
sizeof (
address->s6_addr32 ) /
262 sizeof (
address->s6_addr32[0] ) ) ; i++ ) {
266 sizeof ( miniroute->
address ) );
279 sizeof ( miniroute->
router ) );
#define IPV6_DEFAULT_PREFIX_LEN
IPv6 default prefix length.
#define list_add(new, head)
Add a new entry to the head of a list.
#define IPV6_MAX_PREFIX_LEN
IPv6 maximum prefix length.
static unsigned int ipv6_scope(const struct in6_addr *addr)
Determine IPv6 address scope.
uint64_t address
Base address.
An IPv6 address/routing table entry.
struct in6_addr router
Router address.
#define list_del(list)
Delete an entry from a list.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static struct net_device * netdev
struct list_head list
List of miniroutes.
void * zalloc(size_t size)
Allocate cleared memory.
struct list_head ipv6_miniroutes
List of IPv6 miniroutes.
struct net_device * netdev
Network device.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
static void ipv6_dump_miniroute(struct ipv6_miniroute *miniroute)
Dump IPv6 routing table entry.
Routing table entry address is valid.
Routing table entry router address is valid.
unsigned int prefix_len
Prefix length.
struct in6_addr address
IPv6 address (or prefix if no address is defined)
static struct ipv6_miniroute * ipv6_miniroute(struct net_device *netdev, struct in6_addr *address)
Find IPv6 routing table entry for a given address.
struct in6_addr prefix_mask
IPv6 prefix mask (derived from prefix length)
References address, ipv6_miniroute::address, assert(), ENOMEM, ipv6_miniroute::flags, IPV6_DEFAULT_PREFIX_LEN, ipv6_dump_miniroute(), IPV6_HAS_ADDRESS, IPV6_HAS_ROUTER, IPV6_MAX_PREFIX_LEN, ipv6_miniroute(), ipv6_miniroutes, ipv6_scope(), ipv6_miniroute::list, list_add, list_del, memcpy(), netdev, ipv6_miniroute::netdev, netdev_get(), ipv6_miniroute::prefix_len, ipv6_miniroute::prefix_mask, ipv6_miniroute::router, ipv6_miniroute::scope, and zalloc().
Referenced by ipv6_create_routes(), and ipv6_table_okx().
Transmit IPv6 packet.
- Parameters
-
| iobuf | I/O buffer |
| tcpip | Transport-layer protocol |
| st_src | Source network-layer address |
| st_dest | Destination network-layer address |
| netdev | Network device to use if no route found, or NULL |
| trans_csum | Transport-layer checksum to complete, or NULL |
- Return values
-
This function expects a transport-layer segment and prepends the IPv6 header
Definition at line 525 of file ipv6.c.
558 &next_hop ) ) !=
NULL ) {
594 ll_dest_buf ) ) !=0){
596 "multicast %s: %s\n",
inet6_ntoa ( next_hop ),
600 ll_dest = ll_dest_buf;
615 "transmit packet via %s: %s\n",
623 "transmit packet via %s: %s\n",
static struct ip_statistics ipv6_stats
IPv6 statistics.
struct arbelprm_rc_send_wqe rc
#define AF_INET6
IPv6 Internet addresses.
char * inet6_ntoa(const struct in6_addr *in)
Convert IPv6 address to standard notation.
#define iob_push(iobuf, len)
struct ipv6_miniroute * ipv6_route(unsigned int scope_id, struct in6_addr **dest)
Perform IPv6 routing.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
uint8_t tcpip_proto
Transport-layer protocol number.
static uint32_t ipv6col(struct in6_addr *in)
Determine debugging colour for IPv6 debug messages.
static uint16_t ipv6_pshdr_chksum(struct ipv6_header *iphdr, size_t len, int next_header, uint16_t csum)
Calculate IPv6 pseudo-header checksum.
uint16_t sin6_scope_id
Scope ID (part of struct sockaddr_tcpip)
An IPv6 address/routing table entry.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define MAX_LL_ADDR_LEN
Maximum length of a link-layer address.
unsigned long out_no_routes
ipSystemStatsOutNoRoutes
static struct net_device * netdev
#define IPV6_HOP_LIMIT
IPv6 maximum hop limit.
#define IN6_IS_ADDR_UNSPECIFIED(addr)
char * strerror(int errno)
Retrieve string representation of error number.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
unsigned long out_mcast_pkts
ipSystemStatsOutMcastPkts
struct net_device * netdev
Network device.
int(* mc_hash)(unsigned int af, const void *net_addr, void *ll_addr)
Hash multicast address.
A transport-layer protocol of the TCP/IP stack (eg.
uint16_t zero_csum
Preferred zero checksum value.
#define IPV6_VER
IPv6 version.
char name[NETDEV_NAME_LEN]
Name of this network device.
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
unsigned long out_requests
ipSystemStatsOutRequests
static int ndp_tx(struct io_buffer *iobuf, struct net_device *netdev, const void *net_dest, const void *net_source, const void *ll_source)
Transmit packet, determining link-layer address via NDP.
#define IN6_IS_ADDR_MULTICAST(addr)
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
#define ENETUNREACH
Network unreachable.
#define NULL
NULL pointer (VOID *)
struct in6_addr address
IPv6 address (or prefix if no address is defined)
unsigned long out_octets
ipSystemStatsOutOctets
struct in6_addr sin6_addr
IPv6 address.
struct ll_protocol * ll_protocol
Link-layer protocol.
unsigned long out_transmits
ipSystemStatsOutTransmits
void * memset(void *dest, int character, size_t len) __nonnull
References ipv6_miniroute::address, AF_INET6, DBGC, DBGC2, iphdr::dest, ENETUNREACH, free_iob(), htonl, htons, IN6_IS_ADDR_MULTICAST, IN6_IS_ADDR_UNSPECIFIED, inet6_ntoa(), iob_len(), iob_push, IPV6_HOP_LIMIT, ipv6_pshdr_chksum(), ipv6_route(), ipv6_stats, IPV6_VER, ipv6col(), iphdr::len, len, net_device::ll_addr, net_device::ll_protocol, MAX_LL_ADDR_LEN, ll_protocol::mc_hash, memcpy(), memset(), net_device::name, ndp_tx(), net_tx(), netdev, ipv6_miniroute::netdev, NULL, ip_statistics::out_mcast_pkts, ip_statistics::out_no_routes, ip_statistics::out_octets, ip_statistics::out_requests, ip_statistics::out_transmits, rc, sockaddr_in6::sin6_addr, sockaddr_in6::sin6_scope_id, iphdr::src, src, strerror(), tcpip_protocol::tcpip_proto, and tcpip_protocol::zero_csum.
| static int ipv6_rx |
( |
struct io_buffer * |
iobuf, |
|
|
struct net_device * |
netdev, |
|
|
const void *ll_dest |
__unused, |
|
|
const void *ll_source |
__unused, |
|
|
unsigned int flags |
__unused |
|
) |
| |
|
static |
Process incoming IPv6 packets.
- Parameters
-
| iobuf | I/O buffer |
| netdev | Network device |
| ll_dest | Link-layer destination address |
| ll_source | Link-layer destination source |
| flags | Packet flags |
- Return values
-
This function expects an IPv6 network datagram. It processes the headers and sends it to the transport layer.
Definition at line 649 of file ipv6.c.
679 "bytes (min %zd bytes)\n",
iob_len ( iobuf ),
687 "supported\n",
ntohl (
iphdr->ver_tc_label ) );
696 "bytes (packet is %zd bytes)\n",
len,
iob_len ( iobuf ));
702 hdrlen =
sizeof ( *iphdr );
721 next_header =
iphdr->next_header;
725 this_header = next_header;
726 ext = ( iobuf->
data + hdrlen );
727 extlen =
sizeof (
ext->pad );
728 if (
iob_len ( iobuf ) < ( hdrlen + extlen ) ) {
730 "extension header type %d at %zd bytes (min " 731 "%zd bytes)\n", this_header,
732 (
iob_len ( iobuf ) - hdrlen ), extlen );
742 extlen +=
ext->common.len;
749 if (
iob_len ( iobuf ) < ( hdrlen + extlen ) ) {
751 "extension header type %d at %zd bytes (min " 752 "%zd bytes)\n", this_header,
753 (
iob_len ( iobuf ) - hdrlen ), extlen );
758 next_header =
ext->common.next_header;
763 extlen, next_header );
791 sizeof (
src.sin6.sin6_addr ) );
796 sizeof (
dest.sin6.sin6_addr ) );
#define LL_MULTICAST
Packet is a multicast (including broadcast) packet.
#define iob_pull(iobuf, len)
static struct ip_statistics ipv6_stats
IPv6 statistics.
struct arbelprm_rc_send_wqe rc
#define AF_INET6
IPv6 Internet addresses.
unsigned long in_receives
ipSystemStatsInReceives
char * inet6_ntoa(const struct in6_addr *in)
Convert IPv6 address to standard notation.
#define TCPIP_EMPTY_CSUM
Empty checksum value.
IPv6 hop-by-hop options header type.
unsigned long in_addr_errors
ipSystemStatsInAddrErrors
int tcpip_rx(struct io_buffer *iobuf, struct net_device *netdev, uint8_t tcpip_proto, struct sockaddr_tcpip *st_src, struct sockaddr_tcpip *st_dest, uint16_t pshdr_csum, struct ip_statistics *stats)
Process a received TCP/IP packet.
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
#define EPIPE
Broken pipe.
static uint32_t ipv6col(struct in6_addr *in)
Determine debugging colour for IPv6 debug messages.
static uint16_t ipv6_pshdr_chksum(struct ipv6_header *iphdr, size_t len, int next_header, uint16_t csum)
Calculate IPv6 pseudo-header checksum.
IPv6 destination options header type.
unsigned int scope_id
Scope ID.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
unsigned long in_mcast_pkts
ipSystemStatsInMcastPkts
IPv6 fragment header type.
struct io_buffer * fragment_reassemble(struct fragment_reassembler *fragments, struct io_buffer *iobuf, size_t *hdrlen)
Reassemble packet.
static struct fragment_reassembler ipv6_reassembler
Fragment reassembler.
unsigned long in_truncated_pkts
ipSystemStatsInTruncatedPkts
static struct net_device * netdev
IPv6 routing header type.
#define iob_unput(iobuf, len)
char * strerror(int errno)
Retrieve string representation of error number.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
#define IPV6_MASK_VER
IPv6 version mask.
static int ipv6_check_options(struct ipv6_header *iphdr, struct ipv6_options_header *options, size_t len)
Check that received options can be safely ignored.
uint16_t ext
Extended status.
#define LL_BROADCAST
Packet is a broadcast packet.
#define IPV6_VER
IPv6 version.
void * data
Start of data.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
int ipv6_has_addr(struct net_device *netdev, struct in6_addr *addr)
Check if network device has a specific IPv6 address.
unsigned long in_hdr_errors
ipSystemStatsInHdrErrors
unsigned long in_bcast_pkts
ipSystemStatsInBcastPkts
unsigned long in_octets
ipSystemStatsInOctets
void * memset(void *dest, int character, size_t len) __nonnull
References AF_INET6, io_buffer::data, DBGC, DBGC2, iphdr::dest, dest, EINVAL_LEN, ENOTSUP_VER, EPIPE, ext, flags, fragment_reassemble(), free_iob(), htonl, ip_statistics::in_addr_errors, ip_statistics::in_bcast_pkts, ip_statistics::in_hdr_errors, ip_statistics::in_mcast_pkts, ip_statistics::in_octets, ip_statistics::in_receives, ip_statistics::in_truncated_pkts, inet6_ntoa(), iob_len(), iob_pull, iob_unput, ipv6_check_options(), IPV6_DESTINATION, IPV6_FRAGMENT, ipv6_has_addr(), IPV6_HOPBYHOP, IPV6_MASK_VER, ipv6_pshdr_chksum(), ipv6_reassembler, IPV6_ROUTING, ipv6_stats, IPV6_VER, ipv6col(), iphdr::len, len, LL_BROADCAST, LL_MULTICAST, memcpy(), memset(), netdev, ntohl, ntohs, rc, net_device::scope_id, sin6, iphdr::src, src, st, strerror(), TCPIP_EMPTY_CSUM, and tcpip_rx().
| char* inet6_ntoa |
( |
const struct in6_addr * |
in | ) |
|
Convert IPv6 address to standard notation.
- Parameters
-
- Return values
-
| string | IPv6 address string in canonical format |
RFC5952 defines the canonical format for IPv6 textual representation.
Definition at line 894 of file ipv6.c.
897 char *longest_start =
NULL;
906 for ( i = 0 ; i < (
sizeof (
in->s6_addr16 ) /
907 sizeof (
in->s6_addr16[0] ) ) ; i++ ) {
912 if (
len > longest_len ) {
913 longest_start =
start;
923 if ( longest_start ) {
925 ( longest_start + ( 2 * longest_len ) ) );
926 if (
dest[0] ==
'\0' )
930 return ( ( longest_start == buf ) ? buf : ( buf + 1 ) );
#define sprintf(buf, fmt,...)
Write a formatted string to a buffer.
uint32_t start
Starting offset.
pseudo_bit_t value[0x00020]
char * strcpy(char *dest, const char *src)
Copy string.
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" return dest
#define NULL
NULL pointer (VOID *)
References dest, in, len, ntohs, NULL, out, sprintf, start, strcpy(), and value.
Referenced by dhcpv6_rx(), format_ipv6_setting(), inet6_aton_okx(), inet6_ntoa_okx(), ipv6_dump_miniroute(), ipv6_ntoa(), ipv6_route_okx(), ipv6_rx(), ipv6_sock_ntoa(), ipv6_tx(), ndp_prefix_fetch_ip6(), ndp_rx_neighbour_advertisement_ll_target(), ndp_rx_neighbour_solicitation_ll_source(), ndp_rx_router_advertisement_ll_source(), ndp_rx_router_advertisement_prefix(), and route_ipv6_print().