|
| FILE_LICENCE (GPL2_OR_LATER) |
|
static struct ipv6conf * | ipv6conf_demux (struct net_device *netdev) |
| Identify IPv6 configurator by network device. More...
|
|
static int | ipv6conf_rx_router_advertisement (struct net_device *netdev, struct in6_addr *router, struct ndp_router_advertisement_header *radv, size_t len) |
| Handle router advertisement during IPv6 autoconfiguration. More...
|
|
static int | ndp_tx_ll_addr (struct net_device *netdev, struct sockaddr_in6 *sin6_src, struct sockaddr_in6 *sin6_dest, const void *data, size_t len, unsigned int option_type) |
| Transmit NDP packet with link-layer address option. More...
|
|
static int | ndp_tx_request (struct net_device *netdev, struct net_protocol *net_protocol __unused, const void *net_dest, const void *net_source) |
| Transmit NDP neighbour discovery request. More...
|
|
static int | ndp_tx_router_solicitation (struct net_device *netdev) |
| Transmit NDP router solicitation. More...
|
|
static int | ndp_rx_neighbour_solicitation_ll_source (struct net_device *netdev, struct sockaddr_in6 *sin6_src, union ndp_header *ndp, union ndp_option *option, size_t len) |
| Process NDP neighbour solicitation source link-layer address option. More...
|
|
static int | ndp_rx_neighbour_advertisement_ll_target (struct net_device *netdev, struct sockaddr_in6 *sin6_src __unused, union ndp_header *ndp, union ndp_option *option, size_t len) |
| Process NDP neighbour advertisement target link-layer address option. More...
|
|
static int | ndp_rx_router_advertisement_ll_source (struct net_device *netdev, struct sockaddr_in6 *sin6_src, union ndp_header *ndp __unused, union ndp_option *option, size_t len) |
| Process NDP router advertisement source link-layer address option. More...
|
|
static int | ndp_rx_router_advertisement_prefix (struct net_device *netdev, struct sockaddr_in6 *sin6_src, union ndp_header *ndp, union ndp_option *option, size_t len) |
| Process NDP router advertisement prefix information option. More...
|
|
static int | ndp_rx_option (struct net_device *netdev, struct sockaddr_in6 *sin6_src, union ndp_header *ndp, union ndp_option *option, size_t len) |
| Process received NDP option. More...
|
|
static int | ndp_rx_options (struct net_device *netdev, struct sockaddr_in6 *sin6_src, union ndp_header *ndp, size_t offset, size_t len) |
| Process received NDP packet options. More...
|
|
static int | ndp_rx_neighbour (struct io_buffer *iobuf, struct net_device *netdev, struct sockaddr_in6 *sin6_src, struct sockaddr_in6 *sin6_dest __unused) |
| Process received NDP neighbour solicitation or advertisement. More...
|
|
static int | ndp_rx_router_advertisement (struct io_buffer *iobuf, struct net_device *netdev, struct sockaddr_in6 *sin6_src, struct sockaddr_in6 *sin6_dest __unused) |
| Process received NDP router advertisement. More...
|
|
static int | ndp_applies (struct settings *settings __unused, const struct setting *setting) |
| Check applicability of NDP setting. More...
|
|
static int | ndp_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
| Fetch value of NDP setting. More...
|
|
static int | ndp_prefix_applies (struct settings *settings __unused, const struct setting *setting) |
| Check applicability of NDP per-prefix setting. More...
|
|
static int | ndp_prefix_fetch_ip6 (struct settings *settings, void *data, size_t len) |
| Fetch value of NDP IPv6 address setting. More...
|
|
static int | ndp_prefix_fetch_len6 (struct settings *settings, void *data, size_t len) |
| Fetch value of NDP prefix length setting. More...
|
|
static int | ndp_prefix_fetch_gateway6 (struct settings *settings, void *data, size_t len) |
| Fetch value of NDP router address setting. More...
|
|
static int | ndp_prefix_fetch (struct settings *settings, struct setting *setting, void *data, size_t len) |
| Fetch value of NDP pre-prefix setting. More...
|
|
static int | ndp_register_settings (struct net_device *netdev, struct in6_addr *router, unsigned int lifetime, union ndp_option *options, size_t len) |
| Register NDP settings. More...
|
|
const struct setting ndp_dns6_setting | __setting (SETTING_IP6_EXTRA, dns6) |
| DNS server setting. More...
|
|
const struct setting ndp_dnssl_setting | __setting (SETTING_IP_EXTRA, dnssl) |
| DNS search list setting. More...
|
|
static | LIST_HEAD (ipv6confs) |
| List of IPv6 configurators. More...
|
|
static void | ipv6conf_free (struct refcnt *refcnt) |
| Free IPv6 configurator. More...
|
|
static void | ipv6conf_done (struct ipv6conf *ipv6conf, int rc) |
| Finish IPv6 autoconfiguration. More...
|
|
static void | ipv6conf_expired (struct retry_timer *timer, int fail) |
| Handle IPv6 configurator timer expiry. More...
|
|
int | start_ipv6conf (struct interface *job, struct net_device *netdev) |
| Start IPv6 autoconfiguration. More...
|
|
IPv6 neighbour discovery protocol.
Definition in file ndp.c.
Handle router advertisement during IPv6 autoconfiguration.
- Parameters
-
netdev | Network device |
router | Router address |
radv | Router advertisement |
len | Length of router advertisement |
- Return values
-
This function assumes that the router advertisement is well-formed, since it must have already passed through option processing.
Definition at line 1191 of file ndp.c.
1218 radv->
option, option_len ) ) != 0 )
1225 stateful ) ) != 0 ) {
1226 DBGC (
netdev,
"NDP %s could not start state%s DHCPv6: " 1228 ( stateful ?
"ful" :
"less" ),
strerror (
rc ) );
struct arbelprm_rc_send_wqe rc
struct interface dhcp
DHCPv6 interface.
#define offsetof(type, field)
Get offset of a field within a structure.
#define NDP_ROUTER_MANAGED
NDP managed address configuration.
int start_dhcpv6(struct interface *job, struct net_device *netdev, struct in6_addr *router, int stateful)
Start DHCPv6.
static void ipv6conf_done(struct ipv6conf *ipv6conf, int rc)
Finish IPv6 autoconfiguration.
A long option, as used for getopt_long()
static struct net_device * netdev
char * strerror(int errno)
Retrieve string representation of error number.
static struct ipv6conf * ipv6conf_demux(struct net_device *netdev)
Identify IPv6 configurator by network device.
struct retry_timer timer
Retransmission timer.
void stop_timer(struct retry_timer *timer)
Stop timer.
char name[NETDEV_NAME_LEN]
Name of this network device.
static int ndp_register_settings(struct net_device *netdev, struct in6_addr *router, unsigned int lifetime, union ndp_option *options, size_t len)
Register NDP settings.
typeof(acpi_finder=acpi_find)
ACPI table finder.
#define NDP_ROUTER_OTHER
NDP other configuration.
References DBGC, ipv6conf::dhcp, ndp_router_advertisement_header::flags, ipv6conf_demux(), ipv6conf_done(), len, ndp_router_advertisement_header::lifetime, net_device::name, ndp_register_settings(), NDP_ROUTER_MANAGED, NDP_ROUTER_OTHER, netdev, ntohl, offsetof, ndp_router_advertisement_header::option, rc, start_dhcpv6(), stop_timer(), strerror(), ipv6conf::timer, and typeof().
Referenced by ndp_rx_router_advertisement().
Transmit NDP packet with link-layer address option.
- Parameters
-
netdev | Network device |
sin6_src | Source socket address |
sin6_dest | Destination socket address |
data | NDP header |
len | Size of NDP header |
option_type | NDP option type |
- Return values
-
Definition at line 73 of file ndp.c.
90 option_len = ( (
sizeof ( *ll_addr_opt ) +
98 ll_addr_opt =
iob_put ( iobuf, option_len );
107 if ( (
rc =
tcpip_tx ( iobuf, &icmpv6_protocol, st_src, st_dest,
109 DBGC (
netdev,
"NDP %s could not transmit packet: %s\n",
struct arbelprm_rc_send_wqe rc
#define iob_put(iobuf, len)
uint8_t ll_addr_len
Link-layer address length.
uint8_t ll_addr[0]
Link-layer address.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
NDP source or target link-layer address option.
struct ndp_option_header header
NDP option header.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define MAX_LL_NET_HEADER_LEN
Maximum combined length of a link-layer and network-layer header.
static struct net_device * netdev
char * strerror(int errno)
Retrieve string representation of error number.
#define iob_reserve(iobuf, len)
char name[NETDEV_NAME_LEN]
Name of this network device.
void * data
Start of data.
uint8_t data[48]
Additional event data.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
int tcpip_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 a TCP/IP packet.
uint16_t tcpip_chksum(const void *data, size_t len)
Calculate TCP/IP checkum.
#define NDP_OPTION_BLKSZ
NDP option block size.
struct ll_protocol * ll_protocol
Link-layer protocol.
References alloc_iob(), ndp_option_header::blocks, icmp_header::chksum, data, io_buffer::data, DBGC, ENOMEM, ndp_ll_addr_option::header, ndp_header::icmp, iob_put, iob_reserve, len, ndp_ll_addr_option::ll_addr, net_device::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, MAX_LL_NET_HEADER_LEN, memcpy(), net_device::name, NDP_OPTION_BLKSZ, netdev, rc, strerror(), tcpip_chksum(), tcpip_tx(), and ndp_option_header::type.
Referenced by ndp_rx_neighbour_solicitation_ll_source(), ndp_tx_request(), and ndp_tx_router_solicitation().
Process NDP neighbour solicitation source link-layer address option.
- Parameters
-
netdev | Network device |
sin6_src | Source socket address |
ndp | NDP packet |
option | NDP option |
len | NDP option length |
- Return values
-
Definition at line 206 of file ndp.c.
225 DBGC (
netdev,
"NDP %s neighbour solicitation link-layer " 226 "address option too short at %zd bytes\n",
234 ll_addr_opt->
ll_addr ) ) != 0 ) {
235 DBGC (
netdev,
"NDP %s could not define %s => %s: %s\n",
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
uint8_t ll_addr_len
Link-layer address length.
char * inet6_ntoa(const struct in6_addr *in)
Convert IPv6 address to standard notation.
uint8_t ll_addr[0]
Link-layer address.
#define NDP_OPT_LL_TARGET
NDP target link-layer address option.
#define offsetof(type, field)
Get offset of a field within a structure.
NDP source or target link-layer address option.
#define NDP_NEIGHBOUR_SOLICITED
NDP solicited flag.
A long option, as used for getopt_long()
int neighbour_define(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *ll_dest)
Define neighbour cache entry.
static struct net_device * netdev
char * strerror(int errno)
Retrieve string representation of error number.
#define NDP_NEIGHBOUR_OVERRIDE
NDP override flag.
char name[NETDEV_NAME_LEN]
Name of this network device.
#define ICMPV6_NEIGHBOUR_ADVERTISEMENT
ICMPv6 neighbour advertisement.
int ipv6_has_addr(struct net_device *netdev, struct in6_addr *addr)
Check if network device has a specific IPv6 address.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
static int ndp_tx_ll_addr(struct net_device *netdev, struct sockaddr_in6 *sin6_src, struct sockaddr_in6 *sin6_dest, const void *data, size_t len, unsigned int option_type)
Transmit NDP packet with link-layer address option.
typeof(acpi_finder=acpi_find)
ACPI table finder.
#define NULL
NULL pointer (VOID *)
struct in6_addr sin6_addr
IPv6 address.
struct ll_protocol * ll_protocol
Link-layer protocol.
void * memset(void *dest, int character, size_t len) __nonnull
References DBGC, EINVAL, ndp_neighbour_header::flags, ndp_neighbour_header::icmp, ICMPV6_NEIGHBOUR_ADVERTISEMENT, inet6_ntoa(), ipv6_has_addr(), len, ndp_ll_addr_option::ll_addr, ll_protocol::ll_addr_len, net_device::ll_protocol, memset(), net_device::name, NDP_NEIGHBOUR_OVERRIDE, NDP_NEIGHBOUR_SOLICITED, NDP_OPT_LL_TARGET, ndp_tx_ll_addr(), ndp_header::neigh, neighbour_define(), netdev, ll_protocol::ntoa, NULL, offsetof, rc, sockaddr_in6::sin6_addr, strerror(), ndp_neighbour_header::target, icmp_header::type, and typeof().
Fetch value of NDP setting.
- Parameters
-
settings | Settings block |
setting | Setting to fetch |
data | Buffer to fill with setting data |
len | Length of buffer |
- Return values
-
len | Length of setting data, or negative error |
Definition at line 689 of file ndp.c.
698 unsigned int tag_type;
699 unsigned int tag_offset;
700 unsigned int tag_len;
701 unsigned int tag_instance;
723 if (
option->header.type != tag_type )
727 if ( tag_instance-- != 0 )
731 if ( ( tag_offset + tag_len ) > option_len ) {
732 DBGC (
netdev,
"NDP %s option %d too short\n",
737 tag_len = ( option_len - tag_offset );
738 option_data = ( ( (
void * )
option ) + tag_offset );
#define EINVAL
Invalid argument.
#define NDP_TAG_INSTANCE(tag)
Extract NDP tag instance.
struct settings * parent
Parent settings block.
#define ENOENT
No such file or directory.
#define NDP_TAG_LEN(tag)
Extract NDP tag length.
uint64_t tag
Setting tag, if applicable.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define container_of(ptr, type, field)
Get containing structure.
A long option, as used for getopt_long()
size_t len
Length of NDP options.
static struct net_device * netdev
const struct setting_type * type
Setting type.
#define NDP_TAG_TYPE(tag)
Extract NDP tag type.
union ndp_option options[0]
NDP options.
char name[NETDEV_NAME_LEN]
Name of this network device.
#define NDP_TAG_OFFSET(tag)
Extract NDP tag offset.
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
#define NDP_OPTION_BLKSZ
NDP option block size.
References container_of, data, DBGC, EINVAL, ENOENT, len, ndp_settings::len, memcpy(), net_device::name, NDP_OPTION_BLKSZ, NDP_TAG_INSTANCE, NDP_TAG_LEN, NDP_TAG_OFFSET, NDP_TAG_TYPE, netdev, offset, ndp_settings::options, settings::parent, setting::tag, and setting::type.
Register NDP settings.
- Parameters
-
netdev | Network device |
router | Router address |
lifetime | Router lifetime |
options | NDP options |
len | Length of options |
- Return values
-
Definition at line 948 of file ndp.c.
958 unsigned int prefixes;
959 unsigned int instance;
985 ndpset =
zalloc (
sizeof ( *ndpset ) +
len +
986 ( prefixes *
sizeof ( *prefset ) ) );
999 prefset = ( ( (
void * ) ndpset->
options ) +
len );
1029 prefset->
name ) ) != 0 )
1030 goto err_register_prefix;
1035 assert ( instance == prefixes );
1040 err_register_prefix:
#define NDP_OPT_PREFIX
NDP prefix information option.
struct arbelprm_rc_send_wqe rc
#define NDP_SETTINGS_NAME
NDP settings block name.
unsigned int lifetime
Router lifetime.
void unregister_settings(struct settings *settings)
Unregister settings block.
#define ref_init(refcnt, free)
Initialise a reference counter.
struct settings * parent
Parent settings block.
static struct settings_operations ndp_settings_operations
NDP settings operations.
static const struct settings_scope ndp_settings_scope
NDP settings scope.
static struct settings * netdev_settings(struct net_device *netdev)
Get per-netdevice configuration settings block.
static void settings_init(struct settings *settings, struct settings_operations *op, struct refcnt *refcnt, const struct settings_scope *default_scope)
Initialise a settings block.
static struct settings_operations ndp_prefix_settings_operations
NDP per-prefix settings operations.
#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)
A long option, as used for getopt_long()
size_t len
Length of NDP options.
static struct net_device * netdev
Address assigned via SLAAC.
struct refcnt refcnt
Reference counter.
void * zalloc(size_t size)
Allocate cleared memory.
struct ndp_prefix_information_option * prefix
Prefix information option.
u32 lifetime
For Lifetime-type KDEs, the lifetime in seconds.
An NDP prefix settings block.
struct in6_addr router
Router address.
int order
Sibling ordering.
union ndp_option options[0]
NDP options.
struct settings settings
Settings interface.
#define NDP_PREFIX_AUTONOMOUS
NDP autonomous address configuration flag.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
int register_settings(struct settings *settings, struct settings *parent, const char *name)
Register settings block.
uint16_t offset
Offset to command line.
#define NDP_OPTION_BLKSZ
NDP option block size.
#define NULL
NULL pointer (VOID *)
struct settings settings
Settings interface.
#define ref_put(refcnt)
Drop reference to object.
References assert(), ENOMEM, IPV6_ORDER_PREFIX_ONLY, IPV6_ORDER_SLAAC, len, ndp_settings::len, lifetime, ndp_settings::lifetime, memcpy(), ndp_prefix_settings::name, NDP_OPT_PREFIX, NDP_OPTION_BLKSZ, NDP_PREFIX_AUTONOMOUS, ndp_prefix_settings_operations, NDP_SETTINGS_NAME, ndp_settings_operations, ndp_settings_scope, netdev, netdev_settings(), NULL, offset, options, ndp_settings::options, settings::order, settings::parent, ndp_prefix_settings::prefix, rc, ref_init, ref_put, ndp_settings::refcnt, register_settings(), ndp_settings::router, ndp_prefix_settings::settings, ndp_settings::settings, settings_init(), snprintf(), unregister_settings(), and zalloc().
Referenced by ipv6conf_rx_router_advertisement().