Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_ratelimit.c
Show First 20 Lines • Show All 1,348 Lines • ▼ Show 20 Lines | if (tp->t_inpcb->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) { | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
rte = rt_setup_rate(tp->t_inpcb, ifp, bytes_per_sec, flags, error, lower_rate); | rte = rt_setup_rate(tp->t_inpcb, ifp, bytes_per_sec, flags, error, lower_rate); | ||||
if (rte) | if (rte) | ||||
rl_increment_using(rte); | rl_increment_using(rte); | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
if (rte != NULL && tls != NULL && tls->snd_tag != NULL) { | if (rte != NULL && tls != NULL && tls->snd_rcv_tag != NULL) { | ||||
/* | /* | ||||
* Fake a route change error to reset the TLS | * Fake a route change error to reset the TLS | ||||
* send tag. This will convert the existing | * send tag. This will convert the existing | ||||
* tag to a TLS ratelimit tag. | * tag to a TLS ratelimit tag. | ||||
*/ | */ | ||||
MPASS(tls->snd_tag->sw->type == IF_SND_TAG_TYPE_TLS); | MPASS(tls->snd_rcv_tag->sw->type == IF_SND_TAG_TYPE_TLS); | ||||
ktls_output_eagain(tp->t_inpcb, tls); | ktls_output_eagain(tp->t_inpcb); | ||||
} | } | ||||
#endif | #endif | ||||
} else { | } else { | ||||
/* | /* | ||||
* We are modifying a rate, wrong interface? | * We are modifying a rate, wrong interface? | ||||
*/ | */ | ||||
if (error) | if (error) | ||||
*error = EINVAL; | *error = EINVAL; | ||||
Show All 26 Lines | if (error) | ||||
*error = EINVAL; | *error = EINVAL; | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
#ifdef KERN_TLS | #ifdef KERN_TLS | ||||
if (tp->t_inpcb->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) { | if (tp->t_inpcb->inp_socket->so_snd.sb_flags & SB_TLS_IFNET) { | ||||
tls = tp->t_inpcb->inp_socket->so_snd.sb_tls_info; | tls = tp->t_inpcb->inp_socket->so_snd.sb_tls_info; | ||||
MPASS(tls->mode == TCP_TLS_MODE_IFNET); | MPASS(tls->mode == TCP_TLS_MODE_IFNET); | ||||
if (tls->snd_tag != NULL && | if (tls->snd_rcv_tag != NULL && | ||||
tls->snd_tag->sw->type != IF_SND_TAG_TYPE_TLS_RATE_LIMIT) { | tls->snd_rcv_tag->sw->type != IF_SND_TAG_TYPE_TLS_RATE_LIMIT) { | ||||
/* | /* | ||||
* NIC probably doesn't support ratelimit TLS | * NIC probably doesn't support ratelimit TLS | ||||
* tags if it didn't allocate one when an | * tags if it didn't allocate one when an | ||||
* existing rate was present, so ignore. | * existing rate was present, so ignore. | ||||
*/ | */ | ||||
if (error) | if (error) | ||||
*error = EOPNOTSUPP; | *error = EOPNOTSUPP; | ||||
return (NULL); | return (NULL); | ||||
▲ Show 20 Lines • Show All 318 Lines • Show Last 20 Lines |