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

Bugfix 20240902 #995

Merged
merged 4 commits into from
Sep 13, 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
3 changes: 3 additions & 0 deletions conf/dpvs.conf.items
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ ipv4_defs {
ipv6_defs {
disable off <off, on/off>
forwarding off <off, on/off>
addr_gen_mode eui64 <eui64,none,stable-privacy,random>
stable_secret "" <128-bit hexadecimal string, used in stable-privacy mode >
<stable_secret can be produced by `uuidgen | sed 's/-//g'>
route6 {
<init> method "hlist" <"hlist"/"lpm">
recycle_time 10 <10, 1-36000>
Expand Down
1 change: 1 addition & 0 deletions include/conf/inetaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum {

/* leverage IFA_F_XXX in linux/if_addr.h*/
#define IFA_F_SAPOOL 0x10000 /* if address with sockaddr pool */
#define IFA_F_LINKLOCAL 0x20000 /* ipv6 link-local address */

/* ifa command flags */
#define IFA_F_OPS_VERBOSE 0x0001
Expand Down
1 change: 1 addition & 0 deletions include/ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ int msg_dump(const struct dpvs_msg *msg, char *buf, int len);
#define MSG_TYPE_IPSET_SET 40
#define MSG_TYPE_DEST_CHECK_NOTIFY_MASTER 41
#define MSG_TYPE_DEST_CHECK_NOTIFY_SLAVES 42
#define MSG_TYPE_IFA_IDEVINIT 43
#define MSG_TYPE_IPVS_RANGE_START 100

/* for svc per_core, refer to service.h*/
Expand Down
14 changes: 13 additions & 1 deletion include/inetaddr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@
#include "dpdk.h"
#include "list.h"


enum {
IDEV_F_NO_IPV6 = 0x00000001,
IDEV_F_NO_ROUTE = 0x00000002,
};

struct inet_device {
struct netif_port *dev;
struct list_head ifa_list[DPVS_MAX_LCORE]; /* inet_ifaddr list */
struct list_head ifm_list[DPVS_MAX_LCORE]; /* inet_ifmcaddr list*/
uint32_t ifa_cnt[DPVS_MAX_LCORE];
uint32_t ifm_cnt[DPVS_MAX_LCORE];
rte_atomic32_t refcnt; /* not used yet */
uint32_t flags; /* IDEV_F_XXX */
#define this_ifa_list ifa_list[rte_lcore_id()]
#define this_ifm_list ifm_list[rte_lcore_id()]
#define this_ifa_cnt ifa_cnt[rte_lcore_id()]
Expand Down Expand Up @@ -119,7 +126,12 @@ bool inet_chk_mcast_addr(int af, struct netif_port *dev,

void inet_ifaddr_dad_failure(struct inet_ifaddr *ifa);

int idev_add_mcast_init(struct netif_port *dev);
struct inet_device *dev_get_idev(const struct netif_port *dev);

void idev_put(struct inet_device *idev);

int idev_addr_init(struct inet_device *idev);


int inet_addr_init(void);
int inet_addr_term(void);
Expand Down
2 changes: 2 additions & 0 deletions include/ip_tunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ int ip_tunnel_xmit(struct rte_mbuf *mbuf, struct netif_port *dev,

int ip_tunnel_pull_header(struct rte_mbuf *mbuf, int hlen, __be16 in_proto);

int ip_tunnel_dev_init(struct netif_port *dev);
int ip_tunnel_set_mc_list(struct netif_port *dev);
int ip_tunnel_get_link(struct netif_port *dev, struct rte_eth_link *link);
int ip_tunnel_get_stats(struct netif_port *dev, struct rte_eth_stats *stats);
int ip_tunnel_get_promisc(struct netif_port *dev, bool *promisc);
Expand Down
23 changes: 23 additions & 0 deletions include/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@
#define IPV6
#define RTE_LOGTYPE_IPV6 RTE_LOGTYPE_USER1

enum ip6_addr_gen_mode {
IP6_ADDR_GEN_MODE_EUI64 = 1,
IP6_ADDR_GEN_MODE_NONE,
IP6_ADDR_GEN_MODE_STABLE_PRIVACY,
IP6_ADDR_GEN_MODE_RANDOM,
IP6_ADDR_GFN_MODE_MAX = 64,
};

struct ipv6_stable_secret {
bool initialized;
struct in6_addr secret;
};

struct ipv6_config {
unsigned disable:1;
unsigned forwarding:1;
unsigned addr_gen_mode:6;
struct ipv6_stable_secret secret_stable;
struct ipv6_stable_secret secret_random;
};

const struct ipv6_config *ip6_config_get(void);

/*
* helper functions
*/
Expand Down
13 changes: 13 additions & 0 deletions include/linux_ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,19 @@ static inline int ipv6_saddr_preferred(int type)
return 0;
}

static inline bool ipv6_reserved_interfaceid(const struct in6_addr *addr)
{
if ((addr->s6_addr32[2] | addr->s6_addr32[3]) == 0)
return true;
if (addr->s6_addr32[2] == htonl(0x02005eff) &&
((addr->s6_addr32[3] & htonl(0xfe000000)) == htonl(0xfe000000)))
return true;
if (addr->s6_addr32[2] == htonl(0xfdffffff) &&
((addr->s6_addr32[3] & htonl(0xffffff80)) == htonl(0xffffff80)))
return true;
return false;
}

#ifdef __DPVS__
/*functions below were edited from addrconf.c*/

Expand Down
4 changes: 2 additions & 2 deletions include/netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ enum {

#define NETIF_ALIGN 32

#define NETIF_PORT_ID_INVALID 0xFF
#define NETIF_PORT_ID_INVALID NETIF_MAX_PORTS
#define NETIF_PORT_ID_ALL NETIF_PORT_ID_INVALID

#define NETIF_LCORE_ID_INVALID 0xFF
Expand Down Expand Up @@ -283,7 +283,7 @@ int netif_get_promisc(struct netif_port *dev, bool *promisc);
int netif_get_allmulticast(struct netif_port *dev, bool *allmulticast);
int netif_get_stats(struct netif_port *dev, struct rte_eth_stats *stats);
int netif_get_xstats(struct netif_port *dev, netif_nic_xstats_get_t **xstats);
struct netif_port *netif_alloc(size_t priv_size, const char *namefmt,
struct netif_port *netif_alloc(portid_t id, size_t priv_size, const char *namefmt,
unsigned int nrxq, unsigned int ntxq,
void (*setup)(struct netif_port *));
portid_t netif_port_count(void);
Expand Down
Loading
Loading