| 227 | } |
| 228 | |
| 229 | void |
| 230 | mroutepr() |
| 231 | { |
| 232 | struct sockaddr_in sin; |
| 233 | struct sockaddr *sa = (struct sockaddr *)&sin; |
| 234 | struct vif viftable[MAXVIFS]; |
| 235 | struct vif *v; |
| 236 | struct mfc *m; |
| 237 | #ifndef FSTACK |
| 238 | u_long pmfchashtbl, pmfctablesize, pviftbl; |
| 239 | #endif |
| 240 | int banner_printed; |
| 241 | int saved_numeric_addr; |
| 242 | size_t len; |
| 243 | vifi_t vifi, maxvif; |
| 244 | |
| 245 | saved_numeric_addr = numeric_addr; |
| 246 | numeric_addr = 1; |
| 247 | |
| 248 | memset(&sin, 0, sizeof(sin)); |
| 249 | sin.sin_len = sizeof(sin); |
| 250 | sin.sin_family = AF_INET; |
| 251 | |
| 252 | /* |
| 253 | * TODO: |
| 254 | * The VIF table will move to hanging off the struct if_info for |
| 255 | * each IPv4 configured interface. Currently it is statically |
| 256 | * allocated, and retrieved either using KVM or an opaque SYSCTL. |
| 257 | * |
| 258 | * This can't happen until the API documented in multicast(4) |
| 259 | * is itself refactored. The historical reason why VIFs use |
| 260 | * a separate ifindex space is entirely due to the legacy |
| 261 | * capability of the MROUTING code to create IPIP tunnels on |
| 262 | * the fly to support DVMRP. When gif(4) became available, this |
| 263 | * functionality was deprecated, as PIM does not use it. |
| 264 | */ |
| 265 | maxvif = 0; |
| 266 | #ifndef FSTACK |
| 267 | pmfchashtbl = pmfctablesize = pviftbl = 0; |
| 268 | #endif |
| 269 | |
| 270 | len = sizeof(viftable); |
| 271 | if (live) { |
| 272 | if (sysctlbyname("net.inet.ip.viftable", viftable, &len, NULL, |
| 273 | 0) < 0) { |
| 274 | xo_warn("sysctl: net.inet.ip.viftable"); |
| 275 | return; |
| 276 | } |
| 277 | } else { |
| 278 | #ifndef FSTACK |
| 279 | pmfchashtbl = nl[N_MFCHASHTBL].n_value; |
| 280 | pmfctablesize = nl[N_MFCTABLESIZE].n_value; |
| 281 | pviftbl = nl[N_VIFTABLE].n_value; |
| 282 | |
| 283 | if (pmfchashtbl == 0 || pmfctablesize == 0 || pviftbl == 0) { |
| 284 | xo_warnx("No IPv4 MROUTING kernel support."); |
| 285 | return; |
| 286 | } |
no test coverage detected