ndp.c (133249) | ndp.c (151468) |
---|---|
1/* $FreeBSD: head/usr.sbin/ndp/ndp.c 133249 2004-08-07 04:28:56Z imp $ */ | 1/* $FreeBSD: head/usr.sbin/ndp/ndp.c 151468 2005-10-19 15:05:42Z suz $ */ |
2/* $KAME: ndp.c,v 1.104 2003/06/27 07:48:39 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 950 unchanged lines hidden (view full) --- 960 do {\ 961 if (strcmp(cp, (s)) == 0) {\ 962 if (clear)\ 963 newflags &= ~(f);\ 964 else\ 965 newflags |= (f);\ 966 }\ 967 } while (0) | 2/* $KAME: ndp.c,v 1.104 2003/06/27 07:48:39 itojun Exp $ */ 3 4/* 5 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 950 unchanged lines hidden (view full) --- 960 do {\ 961 if (strcmp(cp, (s)) == 0) {\ 962 if (clear)\ 963 newflags &= ~(f);\ 964 else\ 965 newflags |= (f);\ 966 }\ 967 } while (0) |
968/* 969 * XXX: this macro is not 100% correct, in that it matches "nud" against 970 * "nudbogus". But we just let it go since this is minor. 971 */ 972#define SETVALUE(f, v) \ 973 do { \ 974 char *valptr; \ 975 unsigned long newval; \ 976 v = 0; /* unspecified */ \ 977 if (strncmp(cp, f, strlen(f)) == 0) { \ 978 valptr = strchr(cp, '='); \ 979 if (valptr == NULL) \ 980 err(1, "syntax error in %s field", (f)); \ 981 errno = 0; \ 982 newval = strtoul(++valptr, NULL, 0); \ 983 if (errno) \ 984 err(1, "syntax error in %s's value", (f)); \ 985 v = newval; \ 986 } \ 987 } while (0) 988 |
|
968 SETFLAG("nud", ND6_IFF_PERFORMNUD); 969#ifdef ND6_IFF_ACCEPT_RTADV 970 SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV); 971#endif 972#ifdef ND6_IFF_PREFER_SOURCE 973 SETFLAG("prefer_source", ND6_IFF_PREFER_SOURCE); 974#endif | 989 SETFLAG("nud", ND6_IFF_PERFORMNUD); 990#ifdef ND6_IFF_ACCEPT_RTADV 991 SETFLAG("accept_rtadv", ND6_IFF_ACCEPT_RTADV); 992#endif 993#ifdef ND6_IFF_PREFER_SOURCE 994 SETFLAG("prefer_source", ND6_IFF_PREFER_SOURCE); 995#endif |
996 SETVALUE("basereachable", ND.basereachable); 997 SETVALUE("retrans", ND.retrans); 998 SETVALUE("curhlim", ND.chlim); |
|
975 976 ND.flags = newflags; | 999 1000 ND.flags = newflags; |
977 if (ioctl(s, SIOCSIFINFO_FLAGS, (caddr_t)&nd) < 0) { 978 err(1, "ioctl(SIOCSIFINFO_FLAGS)"); | 1001 if (ioctl(s, SIOCSIFINFO_IN6, (caddr_t)&nd) < 0) { 1002 err(1, "ioctl(SIOCSIFINFO_IN6)"); |
979 /* NOTREACHED */ 980 } 981#undef SETFLAG | 1003 /* NOTREACHED */ 1004 } 1005#undef SETFLAG |
1006#undef SETVALUE |
|
982 } 983 984 if (!ND.initialized) { 985 errx(1, "%s: not initialized yet", ifname); 986 /* NOTREACHED */ 987 } 988 | 1007 } 1008 1009 if (!ND.initialized) { 1010 errx(1, "%s: not initialized yet", ifname); 1011 /* NOTREACHED */ 1012 } 1013 |
1014 if (ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd) < 0) { 1015 err(1, "ioctl(SIOCGIFINFO_IN6)"); 1016 /* NOTREACHED */ 1017 } |
|
989 printf("linkmtu=%d", ND.linkmtu); 990 printf(", maxmtu=%d", ND.maxmtu); 991 printf(", curhlim=%d", ND.chlim); 992 printf(", basereachable=%ds%dms", 993 ND.basereachable / 1000, ND.basereachable % 1000); 994 printf(", reachable=%ds", ND.reachable); 995 printf(", retrans=%ds%dms", ND.retrans / 1000, ND.retrans % 1000); 996#ifdef IPV6CTL_USETEMPADDR --- 582 unchanged lines hidden --- | 1018 printf("linkmtu=%d", ND.linkmtu); 1019 printf(", maxmtu=%d", ND.maxmtu); 1020 printf(", curhlim=%d", ND.chlim); 1021 printf(", basereachable=%ds%dms", 1022 ND.basereachable / 1000, ND.basereachable % 1000); 1023 printf(", reachable=%ds", ND.reachable); 1024 printf(", retrans=%ds%dms", ND.retrans / 1000, ND.retrans % 1000); 1025#ifdef IPV6CTL_USETEMPADDR --- 582 unchanged lines hidden --- |