if_ipsec.c (28d2a72bbfa47c52b06a5a535b10a11dc9a1de72) | if_ipsec.c (dd4490fdab598b56c40619e1bbb51b2da4420518) |
---|---|
1/*- 2 * Copyright (c) 2016-2018 Yandex LLC 3 * Copyright (c) 2016-2018 Andrey V. Elsukov <ae@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 156 unchanged lines hidden (view full) --- 165 struct sockaddr *, uint32_t); 166static void ipsec_delete_tunnel(struct ipsec_softc *); 167 168static int ipsec_set_addresses(struct ifnet *, struct sockaddr *, 169 struct sockaddr *); 170static int ipsec_set_reqid(struct ipsec_softc *, uint32_t); 171static void ipsec_set_running(struct ipsec_softc *); 172 | 1/*- 2 * Copyright (c) 2016-2018 Yandex LLC 3 * Copyright (c) 2016-2018 Andrey V. Elsukov <ae@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 156 unchanged lines hidden (view full) --- 165 struct sockaddr *, uint32_t); 166static void ipsec_delete_tunnel(struct ipsec_softc *); 167 168static int ipsec_set_addresses(struct ifnet *, struct sockaddr *, 169 struct sockaddr *); 170static int ipsec_set_reqid(struct ipsec_softc *, uint32_t); 171static void ipsec_set_running(struct ipsec_softc *); 172 |
173#ifdef VIMAGE 174static void ipsec_reassign(struct ifnet *, struct vnet *, char *); 175#endif |
|
173static void ipsec_srcaddr(void *, const struct sockaddr *, int); 174static int ipsec_ioctl(struct ifnet *, u_long, caddr_t); 175static int ipsec_transmit(struct ifnet *, struct mbuf *); 176static int ipsec_output(struct ifnet *, struct mbuf *, 177 const struct sockaddr *, struct route *); 178static void ipsec_qflush(struct ifnet *); 179static int ipsec_clone_create(struct if_clone *, int, caddr_t); 180static void ipsec_clone_destroy(struct ifnet *); --- 15 unchanged lines hidden (view full) --- 196 197 ifp->if_addrlen = 0; 198 ifp->if_mtu = IPSEC_MTU; 199 ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; 200 ifp->if_ioctl = ipsec_ioctl; 201 ifp->if_transmit = ipsec_transmit; 202 ifp->if_qflush = ipsec_qflush; 203 ifp->if_output = ipsec_output; | 176static void ipsec_srcaddr(void *, const struct sockaddr *, int); 177static int ipsec_ioctl(struct ifnet *, u_long, caddr_t); 178static int ipsec_transmit(struct ifnet *, struct mbuf *); 179static int ipsec_output(struct ifnet *, struct mbuf *, 180 const struct sockaddr *, struct route *); 181static void ipsec_qflush(struct ifnet *); 182static int ipsec_clone_create(struct if_clone *, int, caddr_t); 183static void ipsec_clone_destroy(struct ifnet *); --- 15 unchanged lines hidden (view full) --- 199 200 ifp->if_addrlen = 0; 201 ifp->if_mtu = IPSEC_MTU; 202 ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; 203 ifp->if_ioctl = ipsec_ioctl; 204 ifp->if_transmit = ipsec_transmit; 205 ifp->if_qflush = ipsec_qflush; 206 ifp->if_output = ipsec_output; |
207#ifdef VIMAGE 208 ifp->if_reassign = ipsec_reassign; 209#endif |
|
204 if_attach(ifp); 205 bpfattach(ifp, DLT_NULL, sizeof(uint32_t)); 206 207 return (0); 208} 209 | 210 if_attach(ifp); 211 bpfattach(ifp, DLT_NULL, sizeof(uint32_t)); 212 213 return (0); 214} 215 |
216#ifdef VIMAGE |
|
210static void | 217static void |
218ipsec_reassign(struct ifnet *ifp, struct vnet *new_vnet __unused, 219 char *unused __unused) 220{ 221 struct ipsec_softc *sc; 222 223 sx_xlock(&ipsec_ioctl_sx); 224 sc = ifp->if_softc; 225 if (sc != NULL) 226 ipsec_delete_tunnel(sc); 227 sx_xunlock(&ipsec_ioctl_sx); 228} 229#endif /* VIMAGE */ 230 231static void |
|
211ipsec_clone_destroy(struct ifnet *ifp) 212{ 213 struct ipsec_softc *sc; 214 215 sx_xlock(&ipsec_ioctl_sx); 216 sc = ifp->if_softc; 217 ipsec_delete_tunnel(sc); 218 /* --- 827 unchanged lines hidden --- | 232ipsec_clone_destroy(struct ifnet *ifp) 233{ 234 struct ipsec_softc *sc; 235 236 sx_xlock(&ipsec_ioctl_sx); 237 sc = ifp->if_softc; 238 ipsec_delete_tunnel(sc); 239 /* --- 827 unchanged lines hidden --- |