Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for IPv6 #355

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/net/if_arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#define ARPHRD_CSLIP6 129
#define ARPHRD_PPP 130
#define ARPHRD_LOOPBACK 131
#define ARPHRD_SIT 132 /* sit0 device - IPv6-in-IPv4. */

struct arphdr {
unsigned short int ar_hrd; /* Format of hardware address. */
Expand Down
40 changes: 40 additions & 0 deletions include/net/ip6_route.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Phoenix-RTOS
*
* libphoenix
*
* net/ip6_route.h
*
* Copyright 2024 Phoenix Systems
* Author: Mateusz Kobak
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/


#ifndef _LIBPHOENIX_NET_IP6_ROUTE_H
#define _LIBPHOENIX_NET_IP6_ROUTE_H

#include <netinet/in.h>

/*
* This is needed to compile route.c in busybox.
* Routes for IPv6 are not implemented yet
*/
struct in6_rtmsg {
struct in6_addr rtmsg_dst;
struct in6_addr rtmsg_src;
struct in6_addr rtmsg_gateway;
uint32_t rtmsg_type;
uint16_t rtmsg_dst_len;
uint16_t rtmsg_src_len;
uint32_t rtmsg_metric;
unsigned long int rtmsg_info;
uint32_t rtmsg_flags;
int rtmsg_ifindex;
};


#endif /* _LIBPHOENIX_NET_IP6_ROUTE_H */
3 changes: 3 additions & 0 deletions include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define RTF_WINDOW 0x0080
#define RTF_IRTT 0x0100
#define RTF_REJECT 0x0200
#define RTF_DEFAULT 0x0400
#define RTF_ADDRCONF 0x0800
#define RTF_CACHE 0x1000
#define RTF_NONEXTHOP 0x00200000


Expand Down
53 changes: 53 additions & 0 deletions include/netinet/icmp6.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Phoenix-RTOS
*
* libphoenix
*
* netinet/icmp6.h
*
* Copyright 2024 Phoenix Systems
* Author: Mateusz Kobak
*
* This file is part of Phoenix-RTOS.
*
* %LICENSE%
*/

#ifndef _NETINET_ICMP6_H
#define _NETINET_ICMP6_H

#include <stdint.h>


struct icmp6_hdr {
uint8_t icmp6_type; /* type field */
uint8_t icmp6_code; /* code field */
uint16_t icmp6_cksum; /* checksum field */
union {
uint32_t icmp6_un_data32[1]; /* type-specific field */
uint16_t icmp6_un_data16[2]; /* type-specific field */
uint8_t icmp6_un_data8[4]; /* type-specific field */
} icmp6_dataun;
};

#define icmp6_data32 icmp6_dataun.icmp6_un_data32
#define icmp6_data16 icmp6_dataun.icmp6_un_data16
#define icmp6_data8 icmp6_dataun.icmp6_un_data8
#define icmp6_pptr icmp6_data32[0] /* parameter prob */
#define icmp6_mtu icmp6_data32[0] /* packet too big */
#define icmp6_id icmp6_data16[0] /* echo request/reply */
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */

#define ICMP6_DST_UNREACH 1
#define ICMP6_PACKET_TOO_BIG 2
#define ICMP6_TIME_EXCEEDED 3
#define ICMP6_PARAM_PROB 4

#define ICMP6_ECHO_REQUEST 128
#define ICMP6_ECHO_REPLY 129
#define MLD_LISTENER_QUERY 130
#define MLD_LISTENER_REPORT 131
#define MLD_LISTENER_REDUCTION 132

#endif /* _NETINET_ICMP6_H */
4 changes: 4 additions & 0 deletions include/netinet/in.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ enum {
IPPROTO_GRE = 47,
IPPROTO_ESP = 50,
IPPROTO_AH = 51,
IPPROTO_ICMPV6 = 58,
IPPROTO_SCTP = 132,
IPPROTO_UDPLITE = 136,
IPPROTO_RAW = 255,
Expand Down Expand Up @@ -94,6 +95,9 @@ extern const struct in6_addr in6addr_loopback;
#define IPV6_UNICAST_HOPS 0x00000020 /* Unicast hop limit */
#define IPV6_V6ONLY 0x00000040 /* Restrict AF_INET6 socket to IPv6 communications only */

#define IPV6_CHECKSUM 7
#define IPV6_HOPLIMIT 52 /* not implemented */

/* IPv6 multicast address scopes */
#define IPv6_ADDR_MC_SCOPE_NODELOCAL 0x1 /* Interface-Local scope */
#define IPv6_ADDR_MC_SCOPE_LINKLOCAL 0x2 /* Link-Local scope */
Expand Down
3 changes: 3 additions & 0 deletions include/sys/sockdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,7 @@
#define SOCK_NONBLOCK 0x8000
#define SOCK_CLOEXEC 0x4000

#define SOL_IPV6 41 /* IPPROTO_IPV6 */
#define SOL_RAW 255 /* IPPROTO_RAW */

#endif
Loading