Skip to content

Commit

Permalink
Patch for VCL(w/o link local)
Browse files Browse the repository at this point in the history
  • Loading branch information
KusakabeShi authored and testscript committed Aug 7, 2021
1 parent d085e27 commit 819449e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
14 changes: 13 additions & 1 deletion sysdep/linux/sysio.h
Expand Up @@ -30,7 +30,19 @@ struct tcp_md5sig_ext {


/* Linux does not care if sa_len is larger than needed */
#define SA_LEN(x) sizeof(sockaddr)
/* But VPP care */
static inline int
SA_LEN(sockaddr x){
struct sockaddr_in *sa = (struct sockaddr_in*)&x;
short af = sa->sin_family;
//printf("AF=%hu\n",af);
if (af == AF_INET){
return sizeof(struct sockaddr_in);
}else if (af == AF_INET6){
return sizeof(struct sockaddr_in6);
}
return 32;
};


/*
Expand Down
16 changes: 4 additions & 12 deletions sysdep/unix/io.c
Expand Up @@ -431,36 +431,28 @@ sk_prepare_cmsgs6(sock *s, struct msghdr *msg, void *cbuf, size_t cbuflen)
static inline int
sk_set_ttl4(sock *s, int ttl)
{
if (setsockopt(s->fd, SOL_IP, IP_TTL, &ttl, sizeof(ttl)) < 0)
ERR("IP_TTL");

// Doesn't support by VPP Host Stack
return 0;
}

static inline int
sk_set_ttl6(sock *s, int ttl)
{
if (setsockopt(s->fd, SOL_IPV6, IPV6_UNICAST_HOPS, &ttl, sizeof(ttl)) < 0)
ERR("IPV6_UNICAST_HOPS");

// Doesn't support by VPP Host Stack
return 0;
}

static inline int
sk_set_tos4(sock *s, int tos)
{
if (setsockopt(s->fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0)
ERR("IP_TOS");

// Doesn't support by VPP Host Stack
return 0;
}

static inline int
sk_set_tos6(sock *s, int tos)
{
if (setsockopt(s->fd, SOL_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0)
ERR("IPV6_TCLASS");

// Doesn't support by VPP Host Stack
return 0;
}

Expand Down

0 comments on commit 819449e

Please sign in to comment.