Changeset View
Changeset View
Standalone View
Standalone View
sys/netpfil/ipfw/ip_fw_iface.c
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
| static void handle_ifdetach(struct ip_fw_chain *ch, struct ipfw_iface *iif, | static void handle_ifdetach(struct ip_fw_chain *ch, struct ipfw_iface *iif, | ||||
| uint16_t ifindex); | uint16_t ifindex); | ||||
| static void handle_ifattach(struct ip_fw_chain *ch, struct ipfw_iface *iif, | static void handle_ifattach(struct ip_fw_chain *ch, struct ipfw_iface *iif, | ||||
| uint16_t ifindex); | uint16_t ifindex); | ||||
| static int list_ifaces(struct ip_fw_chain *ch, ip_fw3_opheader *op3, | static int list_ifaces(struct ip_fw_chain *ch, ip_fw3_opheader *op3, | ||||
| struct sockopt_data *sd); | struct sockopt_data *sd); | ||||
| static struct ipfw_sopt_handler scodes[] = { | static struct ipfw_sopt_handler scodes[] = { | ||||
| { IP_FW_XIFLIST, 0, HDIR_GET, list_ifaces }, | { IP_FW_XIFLIST, IP_FW3_OPVER, HDIR_GET, list_ifaces }, | ||||
| }; | }; | ||||
| /* | /* | ||||
| * FreeBSD Kernel interface. | * FreeBSD Kernel interface. | ||||
| */ | */ | ||||
| static void ipfw_kifhandler(void *arg, struct ifnet *ifp); | static void ipfw_kifhandler(void *arg, struct ifnet *ifp); | ||||
| static int ipfw_kiflookup(char *name); | static int ipfw_kiflookup(char *name); | ||||
| static void iface_khandler_register(void); | static void iface_khandler_register(void); | ||||
| ▲ Show 20 Lines • Show All 145 Lines • ▼ Show 20 Lines | |||||
| * Perform actual init on internal request. | * Perform actual init on internal request. | ||||
| * Inits both namehash and global khandler. | * Inits both namehash and global khandler. | ||||
| */ | */ | ||||
| static void | static void | ||||
| vnet_ipfw_iface_init(struct ip_fw_chain *ch) | vnet_ipfw_iface_init(struct ip_fw_chain *ch) | ||||
| { | { | ||||
| struct namedobj_instance *ii; | struct namedobj_instance *ii; | ||||
| ii = ipfw_objhash_create(DEFAULT_IFACES); | ii = ipfw_objhash_create(DEFAULT_IFACES, DEFAULT_OBJHASH_SIZE); | ||||
| IPFW_UH_WLOCK(ch); | IPFW_UH_WLOCK(ch); | ||||
| if (ch->ifcfg == NULL) { | if (ch->ifcfg == NULL) { | ||||
| ch->ifcfg = ii; | ch->ifcfg = ii; | ||||
| ii = NULL; | ii = NULL; | ||||
| } | } | ||||
| IPFW_UH_WUNLOCK(ch); | IPFW_UH_WUNLOCK(ch); | ||||
| if (ii != NULL) { | if (ii != NULL) { | ||||
| ▲ Show 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | export_iface_internal(struct namedobj_instance *ii, struct named_object *no, | ||||
| i->ifindex = iif->ifindex; | i->ifindex = iif->ifindex; | ||||
| i->refcnt = iif->no.refcnt; | i->refcnt = iif->no.refcnt; | ||||
| i->gencnt = iif->gencnt; | i->gencnt = iif->gencnt; | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| /* | /* | ||||
| * Lists all interface currently tracked by ipfw. | * Lists all interface currently tracked by ipfw. | ||||
| * Data layout (v0)(current): | * Data layout (v1)(current): | ||||
| * Request: [ ipfw_obj_lheader ], size = ipfw_obj_lheader.size | * Request: [ ipfw_obj_lheader ], size = ipfw_obj_lheader.size | ||||
| * Reply: [ ipfw_obj_lheader ipfw_iface_info x N ] | * Reply: [ ipfw_obj_lheader ipfw_iface_info x N ] | ||||
| * | * | ||||
| * Returns 0 on success | * Returns 0 on success | ||||
| */ | */ | ||||
| static int | static int | ||||
| list_ifaces(struct ip_fw_chain *ch, ip_fw3_opheader *op3, | list_ifaces(struct ip_fw_chain *ch, ip_fw3_opheader *op3, | ||||
| struct sockopt_data *sd) | struct sockopt_data *sd) | ||||
| Show All 40 Lines | |||||