Home | History | Annotate | Line # | Download | only in pppd
      1 /*	$NetBSD: eui64.c,v 1.6 2025/01/08 19:59:39 christos Exp $	*/
      2 
      3 /*
      4  * eui64.c - EUI64 routines for IPv6CP.
      5  *
      6  * Copyright (c) 1999 Tommi Komulainen.  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
     10  * are met:
     11  *
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  *
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in
     17  *    the documentation and/or other materials provided with the
     18  *    distribution.
     19  *
     20  * 3. The name(s) of the authors of this software must not be used to
     21  *    endorse or promote products derived from this software without
     22  *    prior written permission.
     23  *
     24  * 4. Redistributions of any form whatsoever must retain the following
     25  *    acknowledgment:
     26  *    "This product includes software developed by Tommi Komulainen
     27  *     <Tommi.Komulainen (at) iki.fi>".
     28  *
     29  * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
     30  * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
     31  * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
     32  * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     33  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
     34  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
     35  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     36  *
     37  */
     38 
     39 #include <sys/cdefs.h>
     40 __RCSID("$NetBSD: eui64.c,v 1.6 2025/01/08 19:59:39 christos Exp $");
     41 
     42 #ifdef HAVE_CONFIG_H
     43 #include "config.h"
     44 #endif
     45 
     46 #include "pppd-private.h"
     47 
     48 
     49 /*
     50  * eui64_ntoa - Make an ascii representation of an interface identifier
     51  */
     52 char *
     53 eui64_ntoa(eui64_t e)
     54 {
     55     static char buf[32];
     56 
     57     snprintf(buf, 32, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
     58 	     e.e8[0], e.e8[1], e.e8[2], e.e8[3],
     59 	     e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
     60     return buf;
     61 }
     62