Print this page
7127  remove -Wno-missing-braces from Makefile.uts


 223 }
 224 
 225 static int
 226 icmp_get_buf_prop(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
 227     void *val, uint_t psize, uint_t flags)
 228 {
 229         return (mod_get_buf_prop(stack->netstack_icmp->is_propinfo_tbl, stack,
 230             pinfo, ifname, val, psize, flags));
 231 }
 232 
 233 /*
 234  * All of these are alterable, within the min/max values given, at run time.
 235  *
 236  * Note: All those tunables which do not start with "icmp_" are Committed and
 237  * therefore are public. See PSARC 2010/080.
 238  */
 239 static mod_prop_info_t icmp_propinfo_tbl[] = {
 240         /* tunable - 0 */
 241         { "_wroff_extra", MOD_PROTO_RAWIP,
 242             mod_set_uint32, mod_get_uint32,
 243             {0, 128, 32}, {32} },
 244 
 245         { "_ipv4_ttl", MOD_PROTO_RAWIP,
 246             mod_set_uint32, mod_get_uint32,
 247             {1, 255, 255}, {255} },
 248 
 249         { "_ipv6_hoplimit", MOD_PROTO_RAWIP,
 250             mod_set_uint32, mod_get_uint32,
 251             {0, IPV6_MAX_HOPS, IPV6_DEFAULT_HOPS},
 252             {IPV6_DEFAULT_HOPS} },
 253 
 254         { "_bsd_compat", MOD_PROTO_RAWIP,
 255             mod_set_boolean, mod_get_boolean,
 256             {B_TRUE}, {B_TRUE} },
 257 
 258         { "send_buf", MOD_PROTO_RAWIP,
 259             icmp_set_buf_prop, icmp_get_buf_prop,
 260             {4096, 65536, 8192}, {8192} },
 261 
 262         { "_xmit_lowat", MOD_PROTO_RAWIP,
 263             mod_set_uint32, mod_get_uint32,
 264             {0, 65536, 1024}, {1024} },
 265 
 266         { "recv_buf", MOD_PROTO_RAWIP,
 267             icmp_set_buf_prop, icmp_get_buf_prop,
 268             {4096, 65536, 8192}, {8192} },
 269 
 270         { "max_buf", MOD_PROTO_RAWIP,
 271             mod_set_uint32, mod_get_uint32,
 272             {65536, ULP_MAX_BUF, 256*1024}, {256*1024} },
 273 
 274         { "_pmtu_discovery", MOD_PROTO_RAWIP,
 275             mod_set_boolean, mod_get_boolean,
 276             {B_FALSE}, {B_FALSE} },
 277 
 278         { "_sendto_ignerr", MOD_PROTO_RAWIP,
 279             mod_set_boolean, mod_get_boolean,
 280             {B_FALSE}, {B_FALSE} },
 281 
 282         { "?", MOD_PROTO_RAWIP, NULL, mod_get_allprop, {0}, {0} },
 283 
 284         { NULL, 0, NULL, NULL, {0}, {0} }
 285 };
 286 
 287 #define is_wroff_extra                  is_propinfo_tbl[0].prop_cur_uval
 288 #define is_ipv4_ttl                     is_propinfo_tbl[1].prop_cur_uval
 289 #define is_ipv6_hoplimit                is_propinfo_tbl[2].prop_cur_uval
 290 #define is_bsd_compat                   is_propinfo_tbl[3].prop_cur_bval
 291 #define is_xmit_hiwat                   is_propinfo_tbl[4].prop_cur_uval
 292 #define is_xmit_lowat                   is_propinfo_tbl[5].prop_cur_uval
 293 #define is_recv_hiwat                   is_propinfo_tbl[6].prop_cur_uval
 294 #define is_max_buf                      is_propinfo_tbl[7].prop_cur_uval
 295 #define is_pmtu_discovery               is_propinfo_tbl[8].prop_cur_bval
 296 #define is_sendto_ignerr                is_propinfo_tbl[9].prop_cur_bval
 297 
 298 typedef union T_primitives *t_primp_t;
 299 
 300 /*
 301  * This routine is called to handle each O_T_BIND_REQ/T_BIND_REQ message
 302  * passed to icmp_wput.
 303  * It calls IP to verify the local IP address, and calls IP to insert
 304  * the conn_t in the fanout table.


5014  */
5015 static void
5016 rawip_stack_fini(netstackid_t stackid, void *arg)
5017 {
5018         icmp_stack_t *is = (icmp_stack_t *)arg;
5019 
5020         kmem_free(is->is_propinfo_tbl, sizeof (icmp_propinfo_tbl));
5021         is->is_propinfo_tbl = NULL;
5022 
5023         rawip_kstat_fini(stackid, is->is_ksp);
5024         is->is_ksp = NULL;
5025         ldi_ident_release(is->is_ldi_ident);
5026         kmem_free(is, sizeof (*is));
5027 }
5028 
5029 static void *
5030 rawip_kstat_init(netstackid_t stackid) {
5031         kstat_t *ksp;
5032 
5033         rawip_named_kstat_t template = {
5034                 { "inDatagrams",        KSTAT_DATA_UINT32, 0 },
5035                 { "inCksumErrs",        KSTAT_DATA_UINT32, 0 },
5036                 { "inErrors",           KSTAT_DATA_UINT32, 0 },
5037                 { "outDatagrams",       KSTAT_DATA_UINT32, 0 },
5038                 { "outErrors",          KSTAT_DATA_UINT32, 0 },
5039         };
5040 
5041         ksp = kstat_create_netstack("icmp", 0, "rawip", "mib2",
5042                                         KSTAT_TYPE_NAMED,
5043                                         NUM_OF_FIELDS(rawip_named_kstat_t),
5044                                         0, stackid);
5045         if (ksp == NULL || ksp->ks_data == NULL)
5046                 return (NULL);
5047 
5048         bcopy(&template, ksp->ks_data, sizeof (template));
5049         ksp->ks_update = rawip_kstat_update;
5050         ksp->ks_private = (void *)(uintptr_t)stackid;
5051 
5052         kstat_install(ksp);
5053         return (ksp);
5054 }
5055 
5056 static void
5057 rawip_kstat_fini(netstackid_t stackid, kstat_t *ksp)
5058 {




 223 }
 224 
 225 static int
 226 icmp_get_buf_prop(netstack_t *stack, mod_prop_info_t *pinfo, const char *ifname,
 227     void *val, uint_t psize, uint_t flags)
 228 {
 229         return (mod_get_buf_prop(stack->netstack_icmp->is_propinfo_tbl, stack,
 230             pinfo, ifname, val, psize, flags));
 231 }
 232 
 233 /*
 234  * All of these are alterable, within the min/max values given, at run time.
 235  *
 236  * Note: All those tunables which do not start with "icmp_" are Committed and
 237  * therefore are public. See PSARC 2010/080.
 238  */
 239 static mod_prop_info_t icmp_propinfo_tbl[] = {
 240         /* tunable - 0 */
 241         { "_wroff_extra", MOD_PROTO_RAWIP,
 242             mod_set_uint32, mod_get_uint32,
 243             {{0, 128, 32}}, {32} },
 244 
 245         { "_ipv4_ttl", MOD_PROTO_RAWIP,
 246             mod_set_uint32, mod_get_uint32,
 247             {{1, 255, 255}}, {255} },
 248 
 249         { "_ipv6_hoplimit", MOD_PROTO_RAWIP,
 250             mod_set_uint32, mod_get_uint32,
 251             {{0, IPV6_MAX_HOPS, IPV6_DEFAULT_HOPS}},
 252             {IPV6_DEFAULT_HOPS} },
 253 
 254         { "_bsd_compat", MOD_PROTO_RAWIP,
 255             mod_set_boolean, mod_get_boolean,
 256             {.mpi_bval = B_TRUE}, {B_TRUE} },
 257 
 258         { "send_buf", MOD_PROTO_RAWIP,
 259             icmp_set_buf_prop, icmp_get_buf_prop,
 260             {{4096, 65536, 8192}}, {8192} },
 261 
 262         { "_xmit_lowat", MOD_PROTO_RAWIP,
 263             mod_set_uint32, mod_get_uint32,
 264             {{0, 65536, 1024}}, {1024} },
 265 
 266         { "recv_buf", MOD_PROTO_RAWIP,
 267             icmp_set_buf_prop, icmp_get_buf_prop,
 268             {{4096, 65536, 8192}}, {8192} },
 269 
 270         { "max_buf", MOD_PROTO_RAWIP,
 271             mod_set_uint32, mod_get_uint32,
 272             {{65536, ULP_MAX_BUF, 256*1024}}, {256*1024} },
 273 
 274         { "_pmtu_discovery", MOD_PROTO_RAWIP,
 275             mod_set_boolean, mod_get_boolean,
 276             {.mpi_bval = B_FALSE}, {B_FALSE} },
 277 
 278         { "_sendto_ignerr", MOD_PROTO_RAWIP,
 279             mod_set_boolean, mod_get_boolean,
 280             {.mpi_bval = B_FALSE}, {B_FALSE} },
 281 
 282         { "?", MOD_PROTO_RAWIP, NULL, mod_get_allprop, {{0}}, {0} },
 283 
 284         { NULL, 0, NULL, NULL, {{0}}, {0} }
 285 };
 286 
 287 #define is_wroff_extra                  is_propinfo_tbl[0].prop_cur_uval
 288 #define is_ipv4_ttl                     is_propinfo_tbl[1].prop_cur_uval
 289 #define is_ipv6_hoplimit                is_propinfo_tbl[2].prop_cur_uval
 290 #define is_bsd_compat                   is_propinfo_tbl[3].prop_cur_bval
 291 #define is_xmit_hiwat                   is_propinfo_tbl[4].prop_cur_uval
 292 #define is_xmit_lowat                   is_propinfo_tbl[5].prop_cur_uval
 293 #define is_recv_hiwat                   is_propinfo_tbl[6].prop_cur_uval
 294 #define is_max_buf                      is_propinfo_tbl[7].prop_cur_uval
 295 #define is_pmtu_discovery               is_propinfo_tbl[8].prop_cur_bval
 296 #define is_sendto_ignerr                is_propinfo_tbl[9].prop_cur_bval
 297 
 298 typedef union T_primitives *t_primp_t;
 299 
 300 /*
 301  * This routine is called to handle each O_T_BIND_REQ/T_BIND_REQ message
 302  * passed to icmp_wput.
 303  * It calls IP to verify the local IP address, and calls IP to insert
 304  * the conn_t in the fanout table.


5014  */
5015 static void
5016 rawip_stack_fini(netstackid_t stackid, void *arg)
5017 {
5018         icmp_stack_t *is = (icmp_stack_t *)arg;
5019 
5020         kmem_free(is->is_propinfo_tbl, sizeof (icmp_propinfo_tbl));
5021         is->is_propinfo_tbl = NULL;
5022 
5023         rawip_kstat_fini(stackid, is->is_ksp);
5024         is->is_ksp = NULL;
5025         ldi_ident_release(is->is_ldi_ident);
5026         kmem_free(is, sizeof (*is));
5027 }
5028 
5029 static void *
5030 rawip_kstat_init(netstackid_t stackid) {
5031         kstat_t *ksp;
5032 
5033         rawip_named_kstat_t template = {
5034                 { "inDatagrams",        KSTAT_DATA_UINT32, {{0}} },
5035                 { "inCksumErrs",        KSTAT_DATA_UINT32, {{0}} },
5036                 { "inErrors",           KSTAT_DATA_UINT32, {{0}} },
5037                 { "outDatagrams",       KSTAT_DATA_UINT32, {{0}} },
5038                 { "outErrors",          KSTAT_DATA_UINT32, {{0}} },
5039         };
5040 
5041         ksp = kstat_create_netstack("icmp", 0, "rawip", "mib2",
5042                                         KSTAT_TYPE_NAMED,
5043                                         NUM_OF_FIELDS(rawip_named_kstat_t),
5044                                         0, stackid);
5045         if (ksp == NULL || ksp->ks_data == NULL)
5046                 return (NULL);
5047 
5048         bcopy(&template, ksp->ks_data, sizeof (template));
5049         ksp->ks_update = rawip_kstat_update;
5050         ksp->ks_private = (void *)(uintptr_t)stackid;
5051 
5052         kstat_install(ksp);
5053         return (ksp);
5054 }
5055 
5056 static void
5057 rawip_kstat_fini(netstackid_t stackid, kstat_t *ksp)
5058 {